[FFmpeg-user] h264 mkvs fail on TV/gigablue after conversion

Moritz Barsnick barsnick at gmx.net
Mon Jul 24 12:10:24 EEST 2017


On Mon, Jul 24, 2017 at 10:29:18 +0200, Frank Steiner wrote:

> Do you have any idea what could go wrong here? What I could change in
> converting to avoid that little "whatever" that disturbs the
> (obviously older) codecs on my TV and the Gigablye box? What kind of
> problem could cause the video stream to freeze?

TVs and hardware decoders often have a limited set of codec features
which they can decode. Back in the days of XviD, it was a bit of a
matter of luck of getting them to work. In these modern days, profiles
and levels describe the capabilities and features.

> ffmpeg -i test_works.mkv -c:v libx264 -preset veryslow -crf 20 -tune filme -c:a copy -c:s copy test_fails.mkv
[...]
>     Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1044, SAR 1:1 DAR 160:87, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
(There's something here ffmpeg doesn't tell us here by default. I used
mediainfo to tell, but ffprobe -show_streams also works.)

> [libx264 @ 0x12cdca0] profile High, level 5.1

This is it. Your working input video is profile High, level 4.1. ffmpeg
is choosing profile High, level 5.1.[*] It is a choice implied by the
"veryslow" preset, but you can override it specifically by adding
  "-profile high -level 4.1"
(or whatever your hardware player at max supports) to your ffmpeg
command line, while keeping the preset.

This is my best guess... Something worth trying.

[*] Technical jibber: Most notably, the number of reference frames (4
vs. 16) and the number of B-frames (5 vs. 8) is different. Those things
matter to a HW decoder, IIUC.

Cheers,
Moritz

> [libx264 @ 0x12cdca0] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:-1:-1 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.15 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> Output #0, matroska, to 'test_fails.mkv':
>   Metadata:
>     encoder         : Lavf57.56.101
>     Chapter #0:0: start 0.000000, end 123.540000
>     Metadata:
>       title           : 00:00:00.000
>     Chapter #0:1: start 123.540000, end 264.139000
>     Metadata:
>       title           : 00:02:03.540
>     Chapter #0:2: start 264.139000, end 437.312000
>     Metadata:
>       title           : 00:04:24.139
>     Chapter #0:3: start 437.312000, end 650.984000
>     Metadata:
>       title           : 00:07:17.312
>     Chapter #0:4: start 650.984000, end 814.397000
>     Metadata:
>       title           : 00:10:50.984
>     Chapter #0:5: start 814.397000, end 952.827000
>     Metadata:
>       title           : 00:13:34.397
>     Chapter #0:6: start 952.827000, end 1144.894000
>     Metadata:
>       title           : 00:15:52.827
>     Chapter #0:7: start 1144.894000, end 1362.611000
>     Metadata:
>       title           : 00:19:04.894
>     Chapter #0:8: start 1362.611000, end 1484.191000
>     Metadata:
>       title           : 00:22:42.611
>     Chapter #0:9: start 1484.191000, end 1604.394000
>     Metadata:
>       title           : 00:24:44.191
>     Chapter #0:10: start 1604.394000, end 1764.513000
>     Metadata:
>       title           : 00:26:44.394
>     Chapter #0:11: start 1764.513000, end 1983.773000
>     Metadata:
>       title           : 00:29:24.513
>     Chapter #0:12: start 1983.773000, end 2098.346000
>     Metadata:
>       title           : 00:33:03.773
>     Chapter #0:13: start 2098.346000, end 2196.444000
>     Metadata:
>       title           : 00:34:58.346
>     Chapter #0:14: start 2196.444000, end 2463.336000
>     Metadata:
>       title           : 00:36:36.444
>     Chapter #0:15: start 2463.336000, end 2755.044000
>     Metadata:
>       title           : 00:41:03.336
>     Chapter #0:16: start 2755.044000, end 2993.199000
>     Metadata:
>       title           : 00:45:55.044
>     Chapter #0:17: start 2993.199000, end 3222.344000
>     Metadata:
>       title           : 00:49:53.199
>     Chapter #0:18: start 3222.344000, end 3549.004000
>     Metadata:
>       title           : 00:53:42.344
>     Chapter #0:19: start 3549.004000, end 3662.993000
>     Metadata:
>       title           : 00:59:09.004
>     Chapter #0:20: start 3662.993000, end 3879.876000
>     Metadata:
>       title           : 01:01:02.993
>     Chapter #0:21: start 3879.876000, end 4014.761000
>     Metadata:
>       title           : 01:04:39.876
>     Chapter #0:22: start 4014.761000, end 4344.632000
>     Metadata:
>       title           : 01:06:54.761
>     Chapter #0:23: start 4344.632000, end 4572.902000
>     Metadata:
>       title           : 01:12:24.632
>     Chapter #0:24: start 4572.902000, end 4740.235000
>     Metadata:
>       title           : 01:16:12.902
>     Chapter #0:25: start 4740.235000, end 4884.213000
>     Metadata:
>       title           : 01:19:00.235
>     Chapter #0:26: start 4884.213000, end 5019.765000
>     Metadata:
>       title           : 01:21:24.213
>     Chapter #0:27: start 5019.765000, end 5387.691000
>     Metadata:
>       title           : 01:23:39.765
>     Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1920x1044 [SAR 1:1 DAR 160:87], q=-1--1, 23.98 fps, 1k tbn, 23.98 tbc
>     Metadata:
>       DURATION        : 00:00:15.186000000
>       encoder         : Lavc57.64.101 libx264
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
>     Stream #0:1(ger): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 448 kb/s (default)
>     Metadata:
>       title           : german dts
>       ENCODER         : Lavc57.64.101 ac3
>       DURATION        : 00:00:15.004000000
>     Stream #0:2(ger): Subtitle: subrip (default)
>     Metadata:
>       title           : german forced
>       DURATION        : 00:00:00.000000000
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
>   Stream #0:1 -> #0:1 (copy)
>   Stream #0:2 -> #0:2 (copy)
> Press [q] to stop, [?] for help
> frame=  362 fps=5.5 q=-1.0 Lsize=    9089kB time=00:00:14.97 bitrate=4972.7kbits/s speed=0.229x    
> video:8260kB audio:821kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.097370%
> [libx264 @ 0x12cdca0] frame I:2     Avg QP:12.62  size:130658
> [libx264 @ 0x12cdca0] frame P:100   Avg QP:19.30  size: 49601
> [libx264 @ 0x12cdca0] frame B:260   Avg QP:22.38  size: 12446
> [libx264 @ 0x12cdca0] consecutive B-frames:  5.0%  8.8% 25.7%  9.9%  2.8% 33.1%  0.0%  2.2% 12.4%
> [libx264 @ 0x12cdca0] mb I  I16..4: 56.5% 28.0% 15.5%
> [libx264 @ 0x12cdca0] mb P  I16..4:  7.5% 18.6%  1.7%  P16..4: 37.7% 12.7%  6.7%  0.4%  0.1%    skip:14.6%
> [libx264 @ 0x12cdca0] mb B  I16..4:  0.9%  1.2%  0.1%  B16..8: 39.1%  4.6%  1.0%  direct: 2.4%  skip:50.6%  L0:39.2% L1:51.0% BI: 9.8%
> [libx264 @ 0x12cdca0] 8x8 transform intra:62.6% inter:54.7%
> [libx264 @ 0x12cdca0] direct mvs  spatial:96.9% temporal:3.1%
> [libx264 @ 0x12cdca0] coded y,uvDC,uvAC intra: 33.5% 56.2% 25.1% inter: 8.7% 14.5% 2.0%
> [libx264 @ 0x12cdca0] i16 v,h,dc,p: 27% 16% 10% 47%
> [libx264 @ 0x12cdca0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 10% 28%  7%  7%  5%  8%  6%  9%
> [libx264 @ 0x12cdca0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 17% 13%  9% 10%  7% 10%  7% 12%
> [libx264 @ 0x12cdca0] i8c dc,h,v,p: 50% 29% 14%  7%
> [libx264 @ 0x12cdca0] Weighted P-Frames: Y:2.0% UV:2.0%
> [libx264 @ 0x12cdca0] ref P L0: 62.3% 16.9% 11.0%  3.4%  1.9%  1.3%  1.0%  0.5%  0.4%  0.3%  0.2%  0.2%  0.2%  0.2%  0.2%  0.1%
> [libx264 @ 0x12cdca0] ref B L0: 88.0%  7.8%  1.9%  0.7%  0.4%  0.3%  0.2%  0.2%  0.1%  0.1%  0.1%  0.1%  0.1%  0.1%  0.0%
> [libx264 @ 0x12cdca0] ref B L1: 98.3%  1.7%
> [libx264 @ 0x12cdca0] kb/s:4432.25
> 
> 
> 
> -- 
> Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
> Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
> LMU, Amalienstr. 17           Phone: +49 89 2180-4049
> 80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
> * Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list