[FFmpeg-user] yadif mode 1 duplicates first two frames and hence causes lip-sync error

Bruce Roberts roberb04 at gmail.com
Tue May 12 14:33:53 EEST 2020


Hello again Carl,

First of all, apologies for top-posting. I had read about it and *thought* I'd
avoided it last time but clearly I hadn't. Hopefully what I've done this
time will have done the trick.

I have now simplified my command and tried it with the current ffmpeg git
head. More importantly, your advice has helped me to overcome my original
issue which I believe stemmed from a misunderstanding of mcdeint and use of
the -r filter. Simply removing the "-r 25" resolved the duplicated
frame/lip-sync issue but produced 50fps output which is not what I wanted
but I guess is what is expected. I had previously thought that mcdeint
generates a single output frame from alternate input fields but my tests
indicate that mcdeint duplicates every output frame preserving the input
field rate - is that correct?

In order to preserve the high quality mcdeint deinterlacing whilst
outputting 25fps, I added an fps filter into my chain which seems to have
had the desired effect without introducing the two duplicated frames at the
start and the consequent lip-sync error.

Here for the benefit of anyone else who may have experienced the same
problem as me and with the hope that you will kindly point out any other
errors or misunderstandings on my part, is my new command and console
output:

ffmpeg -ss 00:00:06.800 -t 00:01:00.000 -i ~/ffmpeg_media/input/input.mxf
-filter_complex "[0:v:0]format=pix_fmts=yuv420p[v420];
[v420]yadif=1:0:0,mcdeint=0:0:10[v420deint];
[v420deint]fps=fps=25[v420deint25fps]" -map "[v420deint25fps]" -map 0:a:0
-codec:v libx264 -preset veryslow -tune psnr -profile:v main -x264opts
bitrate=15000:vbv-bufsize=15000:nal-hrd=cbr:me=hex:merange=16:rc-lookahead=40:ipratio=1.0:keyint=250:min-keyint=250:scenecut=-1:bframes=3:ref=3
-channel_layout stereo -codec:a aac -b:a 256k
~/ffmpeg_media/output/output_yadifMode1_25fps.mp4
ffmpeg version git-2020-05-12-ffae62d Copyright (c) 2000-2020 the FFmpeg
developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.59)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-ffae62d_3
--enable-shared --enable-pthreads --enable-version3 --enable-avresample
--cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay
--enable-gnutls --enable-gpl --enable-libaom --enable-libbluray
--enable-libmp3lame --enable-libopus --enable-librubberband
--enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora
--enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma
--enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox
--disable-libjack --disable-indev=jack
  libavutil      56. 45.100 / 56. 45.100
  libavcodec     58. 84.100 / 58. 84.100
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 80.100 /  7. 80.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[mxf @ 0x7ffc72012400] invalid KAGSize 0 - guessing 1
[mxf @ 0x7ffc72012400] invalid KAGSize 0 - guessing 1
[mxf @ 0x7ffc72012400] invalid KAGSize 0 - guessing 1
[mxf @ 0x7ffc72012400] invalid KAGSize 0 - guessing 1
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mxf, from '~/ffmpeg_media/input/input.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    uid             : 6166681f-7433-ea11-aae3-b081a1b76e83
    generation_uid  : 6266681f-7433-ea11-901d-b081a1b76e83
    company_name    : Omneon Inc.
    product_name    : Omneon Media Subsystem
    modification_date: 2020-01-10T06:40:42.436000Z
    product_version : Omneon OmMedia.dll 6.3.0.2 06-22-2016
09:50:28,ex={0,-1},rng={0,-1,0},trimAu,exPre
    application_platform: Omneon Media Api (windows)
    product_uid     : 00000000-0000-0010-8000-050e0b010603
    material_package_umid:
0x060A2B340101010501010D231300144E6C66681F7433EA1186C9B081A1B76E83
    timecode        : 00:00:00:00
  Duration: 00:21:08.88, start: 0.000000, bitrate: 51553 kb/s
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first),
1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      file_package_umid:
0x060A2B340101010501010D231300E12F6E66681F7433EA11B6CBB081A1B76E83
    Side data:
      cpb: bitrate max/min/avg: 50000000/0/0 buffer size: 9781248
vbv_delay: N/A
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      file_package_umid:
0x060A2B340101010501010D231300E12F6E66681F7433EA11B6CBB081A1B76E83
Stream mapping:
  Stream #0:0 (mpeg2video) -> format (graph 0)
  fps (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7ffc7284d600] VBV maxrate unspecified, assuming CBR
[libx264 @ 0x7ffc7284d600] using SAR=1/1
[libx264 @ 0x7ffc7284d600] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7ffc7284d600] profile Main, level 4.0
[libx264 @ 0x7ffc7284d600] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x131 me=hex subme=10 psy=0
mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=0 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=0 threads=24 lookahead_threads=2
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=126 scenecut=0
intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=15000 ratetol=1.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=15000 vbv_bufsize=15000
nal_hrd=cbr filler=1 ip_ratio=1.00 aq=1:0.00
Output #0, mp4, to '~/ffmpeg_media/output/output_yadifMode1_25fps.mp4':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    uid             : 6166681f-7433-ea11-aae3-b081a1b76e83
    generation_uid  : 6266681f-7433-ea11-901d-b081a1b76e83
    company_name    : Omneon Inc.
    product_name    : Omneon Media Subsystem
    modification_date: 2020-01-10T06:40:42.436000Z
    product_version : Omneon OmMedia.dll 6.3.0.2 06-22-2016
09:50:28,ex={0,-1},rng={0,-1,0},trimAu,exPre
    application_platform: Omneon Media Api (windows)
    product_uid     : 00000000-0000-0010-8000-050e0b010603
    material_package_umid:
0x060A2B340101010501010D231300144E6C66681F7433EA1186C9B081A1B76E83
    timecode        : 00:00:00:00
    encoder         : Lavf58.43.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 15000 kb/s, 0.04 fps, 12800 tbn, 25
tbc
    Metadata:
      encoder         : Lavc58.84.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/15000000 buffer size: 15000000
vbv_delay: N/A
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 256 kb/s
    Metadata:
      file_package_umid:
0x060A2B340101010501010D231300E12F6E66681F7433EA11B6CBB081A1B76E83
      encoder         : Lavc58.84.100 aac
frame= 1500 fps=7.7 q=-1.0 Lsize=  111911kB time=00:01:00.01
bitrate=15276.8kbits/s speed=0.309x
video:109980kB audio:1883kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.042916%
[libx264 @ 0x7ffc7284d600] frame I:6     Avg QP:19.27  size:216256
[libx264 @ 0x7ffc7284d600] frame P:399   Avg QP:21.05  size:115948
[libx264 @ 0x7ffc7284d600] frame B:1095  Avg QP:23.10  size: 59413
[libx264 @ 0x7ffc7284d600] consecutive B-frames:  0.9%  0.8% 13.8% 84.5%
[libx264 @ 0x7ffc7284d600] mb I  I16..4: 48.6%  0.0% 51.4%
[libx264 @ 0x7ffc7284d600] mb P  I16..4: 19.6%  0.0% 12.2%  P16..4: 41.9%
17.9%  5.3%  0.4%  0.0%    skip: 2.7%
[libx264 @ 0x7ffc7284d600] mb B  I16..4:  2.5%  0.0%  1.7%  B16..8: 29.7%
 8.0%  1.1%  direct:27.7%  skip:29.3%  L0:39.7% L1:31.8% BI:28.5%
[libx264 @ 0x7ffc7284d600] direct mvs  spatial:99.1% temporal:0.9%
[libx264 @ 0x7ffc7284d600] coded y,uvDC,uvAC intra: 73.5% 72.9% 28.7%
inter: 45.6% 42.9% 2.5%
[libx264 @ 0x7ffc7284d600] i16 v,h,dc,p: 27% 12% 32% 29%
[libx264 @ 0x7ffc7284d600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 13% 20%  5%
 7%  8%  7%  7%  8%
[libx264 @ 0x7ffc7284d600] i8c dc,h,v,p: 26% 25% 26% 23%
[libx264 @ 0x7ffc7284d600] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7ffc7284d600] ref P L0: 36.8% 11.5% 40.8% 10.8%
[libx264 @ 0x7ffc7284d600] ref B L0: 81.5% 15.4%  3.1%
[libx264 @ 0x7ffc7284d600] ref B L1: 97.4%  2.6%
[libx264 @ 0x7ffc7284d600] kb/s:15015.79
[aac @ 0x7ffc7284ee00] Qavg: 173.310


Many thanks and best regards,
Bruce.


More information about the ffmpeg-user mailing list