kierank / x262

x264 with MPEG-2 support. Part of the Open Broadcast Encoder project - http://www.ob-encoder.com/
GNU General Public License v2.0
54 stars 10 forks source link

VBV buffer underflow - static video #3

Open DJ8014 opened 11 years ago

DJ8014 commented 11 years ago

This same issue occurs with ffmpeg, but I'm hoping you can fix it in x262.

The "static" or "bad" video (it is supposed to represent the loss of video signal) causes buffer underflows. I'm limited to a video bit rate of 10.5 Mbps.

Here are the source files:

http://digispotdub.chartermedia.com/badvideo/

The MOV is the original, the M2V is made with ffmpeg - it does ok with it at VERY high bit rates, unfortunately, that doesn't help much.

I've tried using both sources, to no avail.

Any help you can provide is very much appreciated.

Thanks!

D:>x262 --bitrate 10500 --vbv-maxrate 10500 --vbv-bufsize 4000 --force-cfr --fp s 30000/1001 --nal-hrd cbr -o BVX.m2v BVF.m2v [mpegvideo @ 01512CA0] Estimating duration from bitrate, this may be inaccurate lavf [info]: 1920x1080p 1:1 @ 25/1 fps (cfr) x262 [info]: using SAR=1/1 x262 [info]: using cpu capabilities: MMX2 SSE2 SSE3 Cache64 x262 [info]: Main profile @ High level x262 [warning]: VBV underflow (frame 304, -590974 bits) x262 [warning]: VBV underflow (frame 305, -1062682 bits) x262 [warning]: VBV underflow (frame 306, -1124794 bits) x262 [warning]: VBV underflow (frame 307, -982506 bits) x262 [warning]: VBV underflow (frame 308, -1007698 bits) x262 [warning]: VBV underflow (frame 309, -999490 bits) x262 [warning]: VBV underflow (frame 310, -971506 bits) x262 [warning]: VBV underflow (frame 311, -973570 bits) x262 [warning]: VBV underflow (frame 312, -980674 bits) x262 [warning]: VBV underflow (frame 313, -978426 bits) x262 [warning]: VBV underflow (frame 314, -936850 bits) x262 [warning]: VBV underflow (frame 315, -953570 bits) x262 [warning]: VBV underflow (frame 316, -46714 bits) x262 [warning]: VBV underflow (frame 1018, -360134 bits) x262 [warning]: VBV underflow (frame 1019, -945346 bits) x262 [warning]: VBV underflow (frame 1020, -1003538 bits) x262 [warning]: VBV underflow (frame 1021, -964130 bits) x262 [warning]: VBV underflow (frame 1022, -978538 bits) x262 [warning]: VBV underflow (frame 1023, -964114 bits) x262 [warning]: VBV underflow (frame 1024, -932618 bits) x262 [warning]: VBV underflow (frame 1025, -936258 bits) x262 [warning]: VBV underflow (frame 1026, -946002 bits) x262 [warning]: VBV underflow (frame 1027, -951282 bits) x262 [warning]: VBV underflow (frame 1028, -44218 bits) x262 [info]: frame I:19 Avg QP: 8.96 size:109380 x262 [info]: frame P:396 Avg QP: 9.48 size: 38896 x262 [info]: frame B:785 Avg QP: 8.58 size: 26403 x262 [info]: consecutive B-frames: 12.0% 2.0% 1.0% 85.0% x262 [info]: mb I I16..4: 100.0% 0.0% 0.0% x262 [info]: mb P I16..4: 0.0% 0.0% 0.0% P16..4: 48.2% 0.0% 0.0% 0.0% 0 .0% skip:51.8% x262 [info]: mb B I16..4: 0.0% 0.0% 0.0% B16..8: 24.8% 0.0% 0.0% direct: 0.0% skip:75.2% L0:48.3% L1:39.5% BI:12.2% x262 [info]: coded y,uvDC,uvAC intra: 100.0% 100.0% 100.0% inter: 14.9% 8.0% 5.9 % x262 [info]: kb/s:7633.88

encoded 1200 frames, 7.59 fps, 7633.88 kb/s

kierank commented 11 years ago

I'm not even sure emergency mode works in x262 - it's the white noise that causes the problem. Same with --nal-hrd cbr, I think it writes MPEG-4/AVC stuffing. Have you tried with --nal-hrd vbr? Do you specifically need stuffing?

DJ8014 commented 11 years ago

Yes, unfortunately CBR is a necessity.

The white noise is a pain, but every now and then we do get a file where the producer used that effect, or something roughly similar, which causes this issue. I'm hoping someone can figure out a way to make it work.

Even without nal-hrd (or nal-hrd vbr) though, it shows underflow:

C:\Video>x262 --bitrate 10500 --vbv-bufsize 4000 --vbv-maxrate 10500 --fps 30000 /1001 -o BVX.m2v badvideo.mov lavf [info]: 1920x1080p 1:1 @ 30000/1001 fps (cfr) x262 [info]: using SAR=1/1 x262 [info]: using cpu capabilities: MMX2 SSE2Slow SSSE3 SSEMisalign LZCNT SlowP alignr x262 [info]: Main profile @ High level x262 [warning]: VBV underflow (frame 304, -418990 bits)05:33 x262 [warning]: VBV underflow (frame 305, -954730 bits)05:33 x262 [warning]: VBV underflow (frame 306, -989234 bits)05:33 x262 [warning]: VBV underflow (frame 307, -975066 bits) x262 [warning]: VBV underflow (frame 308, -963034 bits)05:32 x262 [warning]: VBV underflow (frame 309, -975794 bits)05:32 x262 [warning]: VBV underflow (frame 310, -936674 bits)05:32 x262 [warning]: VBV underflow (frame 311, -943314 bits)05:32 x262 [warning]: VBV underflow (frame 312, -954650 bits) x262 [warning]: VBV underflow (frame 313, -949754 bits)05:30 x262 [warning]: VBV underflow (frame 314, -919906 bits)05:31 x262 [warning]: VBV underflow (frame 315, -913994 bits) x262 [warning]: VBV underflow (frame 316, -45754 bits):05:31

kierank commented 11 years ago

Basically the emergency code from x264 needs to be fixed to work with MPEG-2. There isn't much focus on x262 for now, at least on my side.

Can't you add stuffing packets are the TS level? It's what I do for all the channels in MPEG-4. Filler at the codec level is 99.9% of the time unnecessary.

DJ8014 commented 11 years ago

Even without forcing CBR/packet-stuffing, I can't seem to generate a good transport stream, unless I throw the max rate up very high.

As I mentioned, this is the case with ffmpeg, so I guess it's understandable x262 would have the same issue. However, x264 does not have a problem with the white noise, so I guess I did have a little hope x262 would be able to handle it.