Hi, I’m a transcoding hobbyist who is trying to use mpdecimate to remove a few sporadic duplicate frames.
At "https://kodintent.wordpress.com/2020/04/19/ffmpeg-mpdecimate-parameters/ <https://kodintent.wordpress.com/2020/04/19/ffmpeg-mpdecimate-parameters/>“ I discovered that the default parameters for the video filter “mpdecimate" are hi = 64*12 (768), lo=64*5 (320), frac=0.33 with no limit on the number of consecutive duplicates that will be matched ("mpdecimate=max=0”). I’m transcoding an .mp4 file for the purpose of removing the one or the other of a pair of duplicate frames. My example file consists of 48 frames (2 seconds of 24 fps video), of which frames 38 and 39 have visibly imperceptible differences. If I alternate "-vf mpdecimate” with “-vf mpdecimate=hi=64*12:lo=64*5:frac=0.33” (which appears to me to be the logical equivalent using editable values), only the first instance of the command will match and remove the duplicate frame. Why? Has something changed since the webpage was published, is the information simply incorrect, or am I doing something else wrong? Should I be using an altogether different method of eliminating duplicates? My first instance of the transcoding command, including its results: ffmpeg -i input.mp4 -vf mpdecimate -q:v 1 -copytb 1 -vsync vfr -c:a copy output.mp4 ffmpeg version N-102754-g604924a069 Copyright (c) 2000-2021 the FFmpeg developers built with Apple clang version 12.0.5 (clang-1205.0.22.9) configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-604924a_1 --enable-shared --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libaom --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-demuxer=dash --disable-libjack --disable-indev=jack --enable-opencl --enable-videotoolbox --disable-htmlpages libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 1.101 / 59. 1.101 libavformat 59. 3.100 / 59. 3.100 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.102 / 8. 0.102 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 ‘input.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.3.100 Duration: 00:00:02.04, start: 0.008000, bitrate: 3333 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x800 [SAR 1:1 DAR 12:5], 2748 kb/s, 24 fps, 24 tbr, 12288 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 640 kb/s (default) Metadata: handler_name : SoundHandler vendor_id : [0][0][0][0] Side data: audio service type: main Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [libx264 @ 0x7fa428418b80] -qscale is ignored, -crf is recommended. [libx264 @ 0x7fa428418b80] using SAR=1/1 [libx264 @ 0x7fa428418b80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x7fa428418b80] profile High, level 4.0, 4:2:0, 8-bit [libx264 @ 0x7fa428418b80] 264 - core 163 r3060 5db6aa6 - 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=18 lookahead_threads=3 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=24 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 [mp4 @ 0x7fa428417bc0] track 1: codec frame size is not set Output #0, mp4, to ‘output.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.3.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x800 [SAR 1:1 DAR 12:5], q=2-31, 24 fps, 12288 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc59.1.101 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 640 kb/s (default) Metadata: handler_name : SoundHandler vendor_id : [0][0][0][0] Side data: audio service type: main frame= 47 fps=0.0 q=-1.0 Lsize= 618kB time=00:00:02.01 bitrate=2509.6kbits/s speed=2.66x video:458kB audio:158kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.422533% [libx264 @ 0x7fa428418b80] frame I:1 Avg QP:20.53 size: 48412 [libx264 @ 0x7fa428418b80] frame P:22 Avg QP:20.70 size: 14583 [libx264 @ 0x7fa428418b80] frame B:24 Avg QP:23.27 size: 4107 [libx264 @ 0x7fa428418b80] consecutive B-frames: 6.4% 72.3% 12.8% 8.5% [libx264 @ 0x7fa428418b80] mb I I16..4: 17.6% 76.3% 6.1% [libx264 @ 0x7fa428418b80] mb P I16..4: 6.6% 11.3% 0.1% P16..4: 41.8% 6.9% 2.9% 0.0% 0.0% skip:30.4% [libx264 @ 0x7fa428418b80] mb B I16..4: 0.4% 0.6% 0.0% B16..8: 31.3% 1.0% 0.1% direct: 1.1% skip:65.5% L0:45.0% L1:53.9% BI: 1.1% [libx264 @ 0x7fa428418b80] 8x8 transform intra:65.3% inter:90.9% [libx264 @ 0x7fa428418b80] coded y,uvDC,uvAC intra: 23.3% 43.0% 6.1% inter: 8.1% 11.8% 0.2% [libx264 @ 0x7fa428418b80] i16 v,h,dc,p: 40% 25% 26% 9% [libx264 @ 0x7fa428418b80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 48% 2% 2% 2% 2% 2% 2% [libx264 @ 0x7fa428418b80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 25% 15% 6% 6% 4% 5% 5% 5% [libx264 @ 0x7fa428418b80] i8c dc,h,v,p: 66% 15% 17% 3% [libx264 @ 0x7fa428418b80] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x7fa428418b80] ref P L0: 76.5% 14.1% 7.1% 2.3% [libx264 @ 0x7fa428418b80] ref B L0: 94.6% 4.4% 1.0% [libx264 @ 0x7fa428418b80] ref B L1: 99.4% 0.6% [libx264 @ 0x7fa428418b80] kb/s:1871.22 My second instance of the command, including results: ffmpeg -i input.mp4 -vf mpdecimate=hi=64*12:lo=64*5:frac=0.33 -q:v 1 -copytb 1 -vsync vfr -c:a copy output.mp4 zsh: no matches found: mpdecimate=hi=64*12:lo=64*5:frac=0.33 Thanks. Laine Lee _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".