Hi guys, I'm having problems to process a set of video files encoded like the sample here:
https://cdn5.wyscout.com/get/testShort.mp4 (7MB) ... that can be reproduced and encoded, but NOT filtered. This can be reproduced using the latest master ffmpeg as of today (just pulled and built before writing), but also with ffmpeg 4.3.x and 4.2.x. Looking inside the sources it seems that for some reason ffmpeg is not able to correctly initialize the filter timebase (ffmpeg.c / adjust_frame_pts_to_encoder_tb ) and for that reason it "refuses" to encode all the frames. I think the culprit is the value of TBN that ffmpeg (and ffprobe) report for this video. Since I'm not the one producing those videos, there is a way to force the filter time base from the command line so that I can process them? The only way I found to handle those files is to do an additional encoding step at an high bitrate without filtering and then apply my filters to the output of the previous step, but that doubles the processing time... Here is the full uncut log of a working encoding and the one (with yadif) that does not work. WITHOUT FILTERING (everything works): iMac-2 $ ./ffmpeg -i ~/Desktop/testShort.mp4 out.mp4 ffmpeg version N-102394-g4fda451c9f Copyright (c) 2000-2021 the FFmpeg developers built with Apple clang version 12.0.0 (clang-1200.0.32.29) configuration: --disable-lzma --prefix=/usr/local/sdk/darwin-x64 --enable-libx264 --enable-libfdk-aac --enable-nonfree --enable-gpl --enable-libopus --enable-libvpx --enable-libvorbis --enable-pic --disable-sdl2 libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 0.100 / 59. 0.100 libavformat 59. 0.101 / 59. 0.101 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.101 / 8. 0.101 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/gabry/Desktop/testShort.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.29.100 Duration: 00:00:10.00, start: 0.000000, bitrate: 6098 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 6095 kb/s, 25 fps, 25 tbr, 1951391039.00 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Press [q] to stop, [?] for help [libx264 @ 0x7fcb0b40db40] using SAR=1/1 [libx264 @ 0x7fcb0b40db40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x7fcb0b40db40] profile High, level 4.0, 4:2:0, 8-bit [libx264 @ 0x7fcb0b40db40] 264 - core 161 r3046 fa26446 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 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=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'out.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.0.101 Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 12800 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc59.0.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A frame= 250 fps= 38 q=-1.0 Lsize= 5566kB time=00:00:09.88 bitrate=4614.9kbits/s speed=1.49x video:5562kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.061817% [libx264 @ 0x7fcb0b40db40] frame I:1 Avg QP:20.09 size:274772 [libx264 @ 0x7fcb0b40db40] frame P:122 Avg QP:21.47 size: 38300 [libx264 @ 0x7fcb0b40db40] frame B:127 Avg QP:27.71 size: 5888 [libx264 @ 0x7fcb0b40db40] consecutive B-frames: 27.2% 12.0% 9.6% 51.2% [libx264 @ 0x7fcb0b40db40] mb I I16..4: 6.8% 41.2% 52.1% [libx264 @ 0x7fcb0b40db40] mb P I16..4: 0.2% 1.6% 0.5% P16..4: 37.3% 7.5% 6.9% 0.0% 0.0% skip:45.9% [libx264 @ 0x7fcb0b40db40] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 37.1% 1.8% 0.5% direct: 0.5% skip:60.0% L0:42.3% L1:49.8% BI: 7.9% [libx264 @ 0x7fcb0b40db40] 8x8 transform intra:61.7% inter:44.9% [libx264 @ 0x7fcb0b40db40] coded y,uvDC,uvAC intra: 90.7% 77.6% 23.5% inter: 14.2% 10.4% 0.8% [libx264 @ 0x7fcb0b40db40] i16 v,h,dc,p: 3% 34% 16% 47% [libx264 @ 0x7fcb0b40db40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 27% 26% 5% 5% 4% 9% 4% 10% [libx264 @ 0x7fcb0b40db40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 31% 17% 5% 6% 5% 8% 5% 8% [libx264 @ 0x7fcb0b40db40] i8c dc,h,v,p: 52% 28% 16% 4% [libx264 @ 0x7fcb0b40db40] Weighted P-Frames: Y:1.6% UV:0.0% [libx264 @ 0x7fcb0b40db40] ref P L0: 80.2% 8.2% 8.9% 2.8% 0.0% [libx264 @ 0x7fcb0b40db40] ref B L0: 94.9% 4.4% 0.7% [libx264 @ 0x7fcb0b40db40] ref B L1: 97.5% 2.5% [libx264 @ 0x7fcb0b40db40] kb/s:4556.15 WITH FILTERING (all frames are dropped): ./ffmpeg -y -i ~/Desktop/testShort.mp4 -vf yadif out.mp4 ffmpeg version N-102394-g4fda451c9f Copyright (c) 2000-2021 the FFmpeg developers built with Apple clang version 12.0.0 (clang-1200.0.32.29) configuration: --disable-lzma --prefix=/usr/local/sdk/darwin-x64 --enable-libx264 --enable-libfdk-aac --enable-nonfree --enable-gpl --enable-libopus --enable-libvpx --enable-libvorbis --enable-pic --disable-sdl2 libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 0.100 / 59. 0.100 libavformat 59. 0.101 / 59. 0.101 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.101 / 8. 0.101 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/gabry/Desktop/testShort.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.29.100 Duration: 00:00:10.00, start: 0.000000, bitrate: 6098 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 6095 kb/s, 25 fps, 25 tbr, 1951391039.00 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Press [q] to stop, [?] for help [libx264 @ 0x7f9a0f505d40] using SAR=1/1 [libx264 @ 0x7f9a0f505d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x7f9a0f505d40] profile High, level 4.0, 4:2:0, 8-bit [libx264 @ 0x7f9a0f505d40] 264 - core 161 r3046 fa26446 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 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=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'out.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.0.101 Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 12800 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc59.0.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=250 speed= 0x video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown _______________________________________________ ffmpeg-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
