压缩

ffmpeg.exe -y -i D:\Liu_Dong\Brain_map_compression\ZhangYueYi\raw_brain\test_jpg\%05d.jpg -vcodec hevc_nvenc D:\Liu_Dong\Brain_map_compression\ZhangYueYi\raw_brain\output5.mkv

frame=  819 fps= 73 q=26.0 Lsize=    8178kB time=00:00:32.72 bitrate=2047.5kbits/s speed= 2.9x
video:8172kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.081658%

解压缩

ffmpeg.exe -y -i D:\Liu_Dong\Brain_map_compression\ZhangYueYi\raw_brain\output5.mkv -vcodec mjpeg D:\Liu_Dong\Brain_map_compression\ZhangYueYi\raw_brain\test_jpg_by_video\%05d.jpg

frame=  819 fps=103 q=24.8 Lsize=N/A time=00:00:32.76 bitrate=N/A speed=4.11x
video:8978kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

avr_psnr = 35.419837477543155 db

hevc详细参数

-preset

x265有10个预定义的—预设选项,可以优化编码速度(每秒编码帧数)和压缩效率(比特流中每比特的质量)之间的平衡。越快,是真越多,越慢,数据的质量越高。每一个option的详细参数表如(https://x265.readthedocs.io/en/default/presets.html#presets)

  1. ultrafast
  2. superfast
  3. veryfast
  4. faster
  5. fast
  6. medium (default)
  7. slow
  8. slower
  9. veryslow
  10. placebo

ultrafast编码速度最快,但压缩率低,生成的文件更大,placebo则正好相反。x264所取的默认值为medium。参考了维基百科,需要说明的是,preset预设决定了编码过程的速度 - 以压缩效率为代价。换句话说,如果选择ultrafast,编码过程将快速运行,但与medium相比,文件大小会更大。视觉质量将是相同的。

--profile

中文一直不知道怎么翻译,貌似是档次。为了提供不同应用之间的兼容互通,HEVC/H265 定义了不同的编码 Profile 档次、Level 水平、Tier 等级。profile 规定了码流中使用了哪些编码工具和算法

强制执行指定配置文件的要求,确保输出流可由支持该配置文件的解码器解码。如果为编码器选择的编译选项不能支持指定的配置文件,则可以中止编码(高位深度编码器将无法输出符合Main或MainStillPicture的比特流)。

x265支持以下配置文件。

8位配置文件:

* main, main-intra, mainstillpicture (or msp for short)
* main444-8, main444-intra, main444-stillpicture

请参阅下面有关发送内部和静止图像配置文件的注释。

10位配置文件:

* main10, main10-intra
* main422-10, main422-10-intra
* main444-10, main444-10-intra

12位配置文件:

* main12, main12-intra
* main422-12, main422-12-intra
* main444-12, main444-12-intra

从wiki上,看到了HEVC两个版本 的

Feature support in some of the video profiles[13]
Feature Version 1 Version 2
 Main  Main 10 Main 12 Main
4:2:2 10
Main
4:2:2 12
Main
4:4:4
Main
4:4:4 10
Main
4:4:4 12
Main
4:4:4 16
Intra
Bit depth 8 8 to 10 8 to 12 8 to 10 8 to 12 8 8 to 10 8 to 12 8 to 16

Chroma sampling formats(色度

采样格式)

4:2:0 4:2:0 4:2:0 4:2:0/
4:2:2
4:2:0/
4:2:2
4:2:0/
4:2:2/
4:4:4
4:2:0/
4:2:2/
4:4:4
4:2:0/
4:2:2/
4:4:4
4:2:0/
4:2:2/
4:4:4
4:0:0 (Monochrome)(黑白) No No Yes Yes Yes Yes Yes Yes Yes

High precision weighted prediction

(高精度加权预测)

No No Yes Yes Yes Yes Yes Yes Yes
Chroma QP offset list(色度偏移表) No No Yes Yes Yes Yes Yes Yes Yes

Cross-component prediction

(跨组件预测)

No No No No No Yes Yes Yes Yes
Intra smoothing disabling(内部平滑禁用) No No No No No Yes Yes Yes Yes

Persistent Rice adaptation

(稳固的 Rice adaptation)

No No No No No Yes Yes Yes Yes

RDPCM implicit/explicit

(RDPCM显示或隐式)

No No No No No Yes Yes Yes Yes
Transform skip block sizes larger than 4x4 (Transform skip 块大小大于4*4) No No No No No Yes Yes Yes Yes
Transform skip context/rotation(Transform skip 上下文或旋转) No No No No No Yes Yes Yes Yes
Extended precision processing(额外的精密步骤) No No No No No No No No Yes
  • 高精度加权预测:使用增加的加权预测精度,这提高了在高比特深度处淡化视频场景(fading video scenes,淡入淡出)的编码效率。
  • Cross-component prediction, using prediction between the chroma/luma components to improve coding efficiency.The reduction in bit rate can be up to 7% for YCbCr 4:4:4 video and up to 26% for RGB video.RGB video has a larger reduction in bit rate due to the greater correlation between the components.
  • Persistent Rice adaptation, using a Rice coding parameter derivation for entropy coding( 熵编码) that has memory that persists across transform coefficient(共同作用的的) sub-block(子块) boundaries.
  • RDPCM,对残差进行DPCM处理,利用周围临近残差值预测当前残差。
  • transform skip 技术。在人造序列(如动画片、游戏视频 等)中,图像呈平缓区域无变化、边界区域剧烈变化的趋势,预测之后的残差与 自然图像有明显的区别。这些残差数量较少,但值很大。经过变换,这些残差会 形成大量的高频信息,导致出现大量冗余。transform skip 技术在编码端决定是否 进行变换,在上述现象发生时不进行变换,从而使得人造序列的压缩率得到了极 大地提升。

-hp -hq

'hp'='高性能'(快速)
'hq'='高品质'(慢)

Tiers and levels

HEVC定义了两种tier: Main and High, and thirteen levels. levels are sets of constraints(约束) for a bitstream.The Main tier is a lower tier than the High tier. The tiers were made to deal with applications that differ in terms of (根据...) their maximum bit rate.The Main tier was designed for most applications while the High tier was designed for very demanding(要求很高的) applications.

兼容性上:A decoder that conforms to a given tier/level is required to be capable of decoding all bitstreams that are encoded for that tier/level and for all lower tiers/levels.

tier 和 level还应该注意的是:For levels below level 4 only the Main tier is allowed.

Tiers and levels with maximum property values(属性值)
Level Max luma (亮度)sample rate
(samples/s)
Max luma picture size(最大亮度图像尺寸)
(samples)
Max bit rate for Main
and Main 10 profiles (kbit/s)[A]

Example picture resolution @
highest frame rate(最高帧率)[B]
(MaxDpbSize——解码图片缓冲区中的最大图片数[C])

More/Fewer examples

Main tier High tier
1 552,960 36,864 128

128×96@33.7 (6)

176×144@15.0 (6)

2 3,686,400 122,880 1,500

176×144@100.0 (16)

352×288@30.0 (6)

2.1 7,372,800 245,760 3,000

352×288@60.0 (12)

640×360@30.0 (6)

3 16,588,800 552,960 6,000

640×360@67.5 (12)
720×576@37.5 (8)

960×540@30.0 (6)

3.1 33,177,600 983,040 10,000

720×576@75.0 (12)
960×540@60.0 (8)

1280×720@33.7 (6)

4 66,846,720 2,228,224 12,000 30,000

1,280×720@68.0 (12)
1,920×1,080@32.0 (6)

2,048×1,080@30.0 (6)

4.1 133,693,440 20,000 50,000

1,280×720@136.0 (12)
1,920×1,080@64.0 (6)

2,048×1,080@60.0 (6)

5 267,386,880 8,912,896 25,000 100,000

1,920×1,080@128.0 (16) 
3,840×2,160@32.0 (6)

4,096×2,160@30.0 (6)

5.1 534,773,760 40,000 160,000

1,920×1,080@256.0 (16) 
3,840×2,160@64.0 (6)

4,096×2,160@60.0 (6)

5.2 1,069,547,520 60,000 240,000

1,920×1,080@300.0 (16) 
3,840×2,160@128.0 (6)

4,096×2,160@120.0 (6)

6 1,069,547,520 35,651,584 60,000 240,000

3,840×2,160@128.0 (16) 
7,680×4,320@32.0 (6)

8,192×4,320@30.0 (6)

6.1 2,139,095,040 120,000 480,000

3,840×2,160@256.0 (16) 
7,680×4,320@64.0 (6)

8,192×4,320@60.0 (6)

6.2 4,278,190,080 240,000 800,000

3,840×2,160@300.0 (16) 
7,680×4,320@128.0 (6)

8,192×4,320@120.0 (6)

A The maximum bit rate of the profile is based on the combination of bit depth, chroma sampling, and the type of profile. For bit depth, the maximum bit rate increases by 1.5× for 12-bit profiles and 2× for 16-bit profiles. For chroma sampling the maximum bit rate increases by 1.5× for 4:2:2 profiles and 2× for 4:4:4 profiles. For the Intra profiles the maximum bit rate increases by 2×.

B The maximum frame rate supported by HEVC is 300 fps.

C The MaxDpbSize is the maximum number of pictures in the decoded picture buffer.

如何在ffmpeg中使用带有nvenc的CRF编码?

https://superuser.com/questions/1236275/how-can-i-use-crf-encoding-with-nvenc-in-ffmpeg/1236387

qmin 整数(编码,视频

设置最小视频量化比例(VBR)。必须包含在-1和69之间,默认值为2。

qmax 整数(编码,视频

设置最大视频量化器比例(VBR)。必须包含在-1和1024之间,默认值为31。

https://ffmpeg.org/ffmpeg-codecs.html#Codec-Options

!!!! 注意:qmin与qmax 必须同时设置,不然没用。

-qscale

对于有损编码,它控制图像质量,从0到100。对于无损编码,这控制了压缩更多内容所花费的精力和时间。默认值是75。越低质量越好。但是注意,他可能被h264的某些参数覆盖。比如 h264中的crf 参数。

-cq

恒定质量(CQ)模式(如x264编码器中的CRF),它将确保每个帧获得应该达到某个(感知)质量等级的比特数,而不是而不是强制流具有平均比特率。这样可以提高整体质量。如果您不关心文件大小,这应该是您选择的方法。

-crf(nvenc里没这个参数, cq类似)

CRF标度的范围是0-51,其中0是无损的,23是默认值,51是最差的质量。较低的值通常会导致更高的质量,主观的理智范围是17-28。考虑17或18在视觉上无损或几乎如此; 它应该与输入看起来相同或几乎相同,但它在技术上并不是无损的。

范围是指数级的,因此增加CRF值+6会导致大约一半的比特率/文件大小,而-6会导致大约两倍的比特率。

选择仍然提供可接受质量的最高CRF值。如果输出看起来不错,那么尝试更高的值。如果看起来不好,请选择较低的值。

色度格式

参考:

https://blog.csdn.net/ternence_hsu/article/details/73176810

http://www.strongene.com/cn/proOverview/HEVCTrans&Quantization%20.pdf

2-Pass Average Bitrate (2-Pass ABR)

Allowing the encoder to do two passes (or more) makes it possible for it to estimate what’s ahead in time. It can calculate the cost of encoding a frame in the first pass and then, in the second pass, more efficiently use the bits available. This ensures that the output quality is the best under a certain bitrate constraint.

这是为流式传输编码文件的最简单方法。有两点需要注意:你不知道最终的质量是什么,所以你必须做一些测试,以确保你的比特率实际上足够高,可以用于某些复杂的内容。此模式的另一个缺点是可能存在比特率的本地峰值,这意味着您可能发送超过客户端可以接收的峰值。

hevc_nvenc 详细分析1相关推荐

  1. hevc_nvenc 详细分析2 ——preset分析

    我想考虑的因素:preset,profile,level,tier,rc,cq,g,no-scenecut 我的图片格式都是lzw压缩的tiff格式(无损压缩) 我将16bit图拆分成两个8bit.压 ...

  2. Yolov1目标检测算法详细分析

    Yolov1目标检测算法详细分析 Yolov1介绍 这是继RCNN,fast-RCNN 和 faster-RCNN之后,rbg(Ross Girshick)大神挂名的又一大作,起了一个很娱乐化的名字: ...

  3. 详细分析本机号码一键登录原理

    详细分析本机号码一键登录原理! 很多 APP 的目前都支持「本机号码一键登录」功能.本机号码一键登录是基于运营商独有网关认证能力推出的账号认证产品.用户只需一键授权,即可实现以本机号码注册/登录,相比 ...

  4. linux shell数据重定向(输入重定向与输出重定向)详细分析

    转载自: linux shell数据重定向(输入重定向与输出重定向)详细分析 - 程默 - 博客园 http://www.cnblogs.com/chengmo/archive/2010/10/20/ ...

  5. Blueprint代码详细分析-Android10.0编译系统(七)

    摘要:Blueprint解析Android.bp到ninja的代码流程时如何走的? 阅读本文大约需要花费18分钟. 文章首发微信公众号:IngresGe 专注于Android系统级源码分析,Andro ...

  6. android 串口开发_详细分析Esp8266上电信息打印的数据,如何做到串口通讯上电不乱码打印...

    01 写在前面: 上篇关于如何在内置仅1M的Esp8285做到 OTA 升级的同步到微信公众号,竟然被安信可的某些运维人员看到了,想要转载,我很欣慰,竟然自己的笔记可以被这么大型的公司员工认可! 我是 ...

  7. C语言中的static 详细分析

    google了近三页的关于C语言中static的内容,发现可用的信息很少,要么长篇大论不知所云要么在关键之处几个字略过,对于想挖掘底层原理的初学者来说参考性不是很大.所以,我这篇博文博采众家之长,把互 ...

  8. 【数字信号处理】序列傅里叶变换 ( 序列傅里叶变换定义详细分析 | 证明单位复指数序列正交完备性 | 序列存在傅里叶变换的性质 | 序列绝对可和 → 序列傅里叶变换一定存在 )

    文章目录 一.序列傅里叶变换定义详细分析 二.证明单位复指数序列正交完备性 三.序列存在傅里叶变换的性质 一.序列傅里叶变换定义详细分析 序列傅里叶变换 SFT , 英文全称 " Seque ...

  9. 新手向:从不同的角度来详细分析Redis

    最近对华为云分布式缓存产品Redis做了一些研究,于是整理了一些基本的知识拿出来与大家分享,首先跟大家分享的是,如何从不同的角度来详细使用Redis. 小编将从以下9个角度来进行详细分析,希望可以帮到 ...

最新文章

  1. 安卓adb常用简单指令
  2. php json 数组 区别,PHP实战:JSON两种结构之对象和数组的理解
  3. 【Android APT】注解处理器 ( 根据注解生成 Java 代码 )
  4. Python入门100题 | 第011题
  5. hive json 获取_hive sql 解析json
  6. great sentences for university sentences
  7. java23中设计模式——行为模式——Memento(备忘机制)
  8. 三星s9php禁用列表,ADB禁用列表
  9. c# opencv 轮廓检测_基于OpenCV的区域分割、轮廓检测和阈值处理
  10. 计算机台账管理工作总结,台账工作总结(共6篇汇总).doc.docx
  11. 配置 LDAP 服务器
  12. 新风系统风速推荐表_实验室通风系统的设计和应用
  13. QQ2013的PC版协议,0825包和0826的数据分析
  14. eBay月入五万以上大卖家请进,解决你的提现和结汇问题!
  15. 看完此文,告诉你什么是黑中介
  16. ROS——基于python3实现opencv图像处理任务
  17. 判断一个对象是否是JSON对象
  18. ps彩色照片变黑白照片
  19. 小程序获取链接中的参数
  20. QQ空间直播秒开优化实践

热门文章

  1. php swoole 教程,PHP Swoole 基本使用
  2. 【笔记】Polygon mesh processing读书笔记(5)
  3. 【排队助手】投屏模式-使用指南
  4. 我是如何准备一个技术的分享?
  5. linux svn checkout代码shell脚本
  6. 人工智能时代:软件中的人工智能将如何改变程序员的角色
  7. 阿里工作9年,熬到技术总监的我,选择离职:想给还在努力的你提个醒……
  8. C++语言基础篇(二)
  9. iOS 应用商店评分StoreReview
  10. Linux删除文件,df查看磁盘空间未减少