查看完整版本: [-- x264怎样才能控制码率瞬间峰值? --]

『漫游』酷论坛 -> 『影音数码技术学习交流』 -> x264怎样才能控制码率瞬间峰值? [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

stu-p 2011-12-23 16:32

x264怎样才能控制码率瞬间峰值?

  1. x264 --preset medium  --tune film --bitrate 500 --ref 6 --bframes 6 --ratetol 0
    --vbv-bufsize auto_high --vbv-maxrate 500 ....

不用--vbv这些参数码率瞬间峰值更加难以控制,用了也是控制不住。用什么参数才能将码率瞬间峰值控制在自己指定的值范围内?
哪位老师能指点一下!
曾看到06_taro 老师曾经说过-vbv-maxrate 800 --bitrate 800 这两个值一致能实现cbr,试了也不行。
06_taro 老师路过的时候麻烦再次指点一下~最好给出一段能实现fps为cbr的完整命令。一直没弄出来过cbr的视频成品。
mediainfo:
General
Complete name                  : E:\kkkk.mp4
Format                         : MPEG-4
Format profile                 : Base Media / Version 2
Codec ID                       : mp42
File size                      : 4.99 MiB
Duration                       : 1mn 23s
Overall bit rate               : 502 Kbps
Encoded date                   : UTC 2011-12-23 08:15:16
Tagged date                    : UTC 2011-12-23 08:15:16

Video
ID                             : 1
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : High@L3.0
Format settings, CABAC         : Yes
Format settings, ReFrames      : 6 frames
Codec ID                       : avc1
Codec ID/Info                  : Advanced Video Coding
Duration                       : 1mn 23s
Bit rate                       : 500 Kbps
Maximum bit rate               : 1 483 Kbps





06_taro 2011-12-24 01:35
fps和cbr沒關係
MediaInfo裡的maxrate是錯的,沒有參考意義,我要是按照標準寫--vbv-maxrate 62500 --vbv-bufsize 78125的話它就會顯示maxrate是62500,實際上拿bitrate viewer看一下可能最高瞬時碼率才幾千k,mediainfo純屬扯蛋……

test:
引用
x264 version.mkv --bitrate 300 --vbv-maxrate 300 --vbv-bufsize 500 -o version-cbr.mkv

我上次說的不加vbv-bufsize是不對vbv做任何限制的情況,如果要限制maxrate的話bufsize不能省

MediaInfo:
引用
General
Complete name                    : D:\Program Files\Media\MeGUI\tools\x264\x264Mod\version-cbr.mkv
Format                           : Matroska
Format version                   : Version 2
File size                        : 19.8 KiB
Duration                         : 10s 0ms
Overall bit rate                 : 16.2 Kbps
Writing application              : x264 r2120+630_tMod+MixAQ-8bit 0cb4837
Writing library                  : Haali Matroska Writer b0

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : High@L1.2
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Codec ID                         : V_MPEG4/ISO/AVC
Duration                         : 10s 0ms
Bit rate                         : 15.9 Kbps
Nominal bit rate                 : 300 Kbps
Width                            : 752 pixels
Height                           : 80 pixels
Display aspect ratio             : 9.400
Frame rate mode                  : Constant
Frame rate                       : 1.200 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.220
Stream size                      : 19.4 KiB (98%)
Writing library                  : x264 core 120 r2120+630_tMod+MixAQ-8bit 0cb4837
Encoding settings                : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / fade_compensate=0.00 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / fgo=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=300 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=300 / vbv_bufsize=500 / nal_hrd=none / ip_ratio=1.40 / aq=1 / aq-strength=1.00 / aq-sensitivity=10.00 / aq-ifactor=1.00 / aq-pfactor=1.00 / aq-bfactor=1.00 / aq2=0
Language                         : English
Default                          : Yes
Forced                           : No

當然其實就算SEI裡寫的是cbr實際上碼率曲線也並不是完全水平的……本來做cbr就是很奇怪的行為……

話說啥設備這麼神奇能解碼ref=6@profile=High但是要求瞬時碼率卻不能超過800?據我所知PSP號稱必須限制到Main@Level 3.0 vbv-maxrate<=10000,實際上我餵個Main@Level 5.1 Maxrate=38000的東西進去時播放得好好的啥問題都沒有(6.60 me-1.6),不知道您的設備是怎麼限制的……






stu-p 2011-12-24 15:36
引用
引用第1楼06_taro于2011-12-24 01:35发表的  :
當然其實就算SEI裡寫的是cbr實際上碼率曲線也並不是完全水平的……本來做cbr就是很奇怪的行為……
話說啥設備這麼神奇能解碼ref=6@profile=High但是要求瞬時碼率卻不能超過800?據我所知PSP號稱必須限制到Main@Level 3.0 vbv-maxrate<=10000,實際上我餵個Main@Level 5.1 Maxrate=38000的東西進去時播放得好好的啥問題都沒有(6.60 me-1.6),不知道您的設備是怎麼限制的……

只是好奇不知道怎么压出cbr的视频。通过你的指点又学一招,我在翻翻旧帖,看看怎样提高画面的清晰度。
我现在迷迷糊糊的有些参数还没理解透,压出的视频ssim的值有的是0.988~~有的0.96~~。
真心感谢你的耐心帮助!!!
General
Complete name                  : E:\cbr.flv
Format                         : Flash Video
File size                      : 1.13 MiB
Duration                       : 12s 617ms
Overall bit rate mode          : Constant
Overall bit rate               : 422 Kbps

Video
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : High@L3.1
Format settings, CABAC         : Yes
Format settings, ReFrames      : 8 frames
Codec ID                       : 7
Duration                       : 12s 429ms
Bit rate mode                  : Constant
Bit rate                       : 356 Kbps
Width                          : 720 pixels
Height                         : 404 pixels
Display aspect ratio           : 2.2:1
Frame rate mode                : Constant
Frame rate                     : 23.976 fps
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.051
Stream size                    : 529 KiB (46%)


stu-p 2011-12-24 20:19
06_taro老师是如何计算DPB宏块大小的?你上面这个例子
x264 version.mkv --bitrate 300 --vbv-maxrate 300 --vbv-bufsize 500 -o version-cbr.mkv
我套用了一下能够完全的将码率控制在300以内。
我计算vbv-bufsize值是:ref数*(宽/16*高/16) 例如下面的:
3*(375/16*288/16)=1188
我也试了H.264 Level Calculator同样的值是1188。
命令:
x264 --bitrate 460 --tune film --ref 3 --bframes 3 --vbv-maxrate 460 --vbv-bufsize 1188 --keyint 50 --min-keyint 25 -o "new.mkv" "1.dat"
bitrate viewer查了一下最高瞬时码率为692kbps,这证明我计算方法不正确,你是怎样计算的那么精准?
2楼内结果下午时候我也忘记了怎么弄出来的,晕头了。郁闷~


06_taro 2011-12-24 23:47
我隨手寫的 -_,-


查看完整版本: [-- x264怎样才能控制码率瞬间峰值? --] [-- top --]


Powered by phpwind v8.5 Code ©2003-2011 phpwind
Time 0.007822 second(s),query:2 Gzip disabled