[FFmpeg-user] yadif mode 1 duplicates first two frames and hence causes lip-sync error
Bruce Roberts
roberb04 at gmail.com
Mon May 11 14:34:56 EEST 2020
Thank you in advance for your help with this problem.
I have been experimenting with the various deinterlacing options and have
found that mcdeint produces excellent results.
As the ffmpeg filters documentation explains, mcdeint "needs one field per
frame as input and must thus be used together with yadif=1/3 or
equivalent". My complex filter therefore includes
"yadif=1:0:0,mcdeint=0:0:10".
What I've noticed though (by playing the output in Telestream Switch and
analysing/comparing using Interra Vega), is that when I use yadif mode 1,
the first two video frames are duplicated in the output (the first 2 frames
in the input become 4 frames in the output and the output file is thus 2
frames longer than the required duration). Since the audio stream does not
by default have a two-frame offset, an AV sync error is introduced. This
does not occur with yadif mode 0.
I'm guessing that I can compensate using the adelay filter or similar but I
would like to understand why the two frames are duplicated and, if
possible, to prevent that from happening whilst retaining my chosen
deinterlacing settings.
Strangely, the lip-sync error is less noticeable in VLC Player compared to
Switch and this is another reason why I'm reluctant to force an audio delay.
Here is my command and the console output:
ffmpeg \
> -ss 00:00:06.800 -t 00:01:00.000 -i /media/input/input.mxf \
> -filter_complex "[0:v:0][0:a:0]concat=n=1:v=1:a=1[vconcat][aconcat0]; \
> [vconcat]format=pix_fmts=yuv420p[vconcat420]; \
> [vconcat420]yadif=1:0:0,mcdeint=0:0:10[vconcat420deint]" \
> -map [vconcat420deint] -map [aconcat0] -codec:v libx264 -r 25 -preset
veryslow -tune psnr -s:v 1920x1080 -profile:v main -aspect 16:9 \
> -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 \
> /media/output/output_yadifMode1.mp4
ffmpeg started on 2020-05-11 at 10:41:29
Report written to "ffmpeg8.log"
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration:
--prefix=/var/lib/jenkins/jobs/FFMPEG/workspace/ffmpeg_build_8
--extra-cflags=-I/var/lib/jenkins/jobs/FFMPEG/workspace/ffmpeg_build_8/include
--extra-ldflags='-L/var/lib/jenkins/jobs/FFMPEG/workspace/ffmpeg_build_8/lib
-ldl' --bindir=/var/lib/jenkins/jobs/FFMPEG/workspace/ffmpeg_build_8/bin
--pkg-config-flags=--static --extra-ldexeflags=-Bstatic --enable-static
--disable-shared --enable-gpl --enable-nonfree --enable-libfdk_aac
--enable-libfreetype --enable-libopus --enable-libx264 --enable-libx265
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[mxf @ 0x3288b60] invalid KAGSize 0 - guessing 1
[mxf @ 0x3288b60] invalid KAGSize 0 - guessing 1
[mxf @ 0x3288b60] invalid KAGSize 0 - guessing 1
[mxf @ 0x3288b60] invalid KAGSize 0 - guessing 1
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mxf, from '/media/input/input.mxf':
Metadata:
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.000000Z
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
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Metadata:
file_package_umid:
0x060A2B340101010501010D231300E12F6E66681F7433EA11B6CBB081A1B76E83
[libx264 @ 0x3307500] VBV maxrate unspecified, assuming CBR
[libx264 @ 0x3307500] using SAR=1/1
[libx264 @ 0x3307500] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x3307500] profile Main, level 4.0
[libx264 @ 0x3307500] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft
2003-2016 - 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=12 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=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 '/media/output/output_yadifMode1.mp4':
Metadata:
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.000000Z
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 : Lavf57.56.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 15000 kb/s, 25 fps, 12800 tbn, 25
tbc (default)
Metadata:
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/15000000 buffer size: 15000000
vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz,
stereo, fltp, 256 kb/s (default)
Metadata:
encoder : Lavc57.64.101 aac
Stream mapping:
Stream #0:0 (mpeg2video) -> concat:in0:v0
Stream #0:1 (pcm_s16le) -> concat:in0:a0
mcdeint -> Stream #0:0 (libx264)
concat:out:a0 -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
frame= 1502 fps=2.9 q=-1.0 Lsize= 112331kB time=00:01:00.01
bitrate=15334.2kbits/s dup=0 drop=1498 speed=0.115x
video:110384kB audio:1899kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.042390%
[libx264 @ 0x3307500] frame I:7 Avg QP:21.60 size:165580
[libx264 @ 0x3307500] frame P:402 Avg QP:22.68 size:103180
[libx264 @ 0x3307500] frame B:1093 Avg QP:24.22 size: 64405
[libx264 @ 0x3307500] consecutive B-frames: 0.8% 0.1% 19.2% 79.9%
[libx264 @ 0x3307500] mb I I16..4: 53.0% 0.0% 47.0%
[libx264 @ 0x3307500] mb P I16..4: 23.5% 0.0% 11.1% P16..4: 41.7% 17.0%
4.4% 0.2% 0.0% skip: 2.0%
[libx264 @ 0x3307500] mb B I16..4: 4.0% 0.0% 1.9% B16..8: 34.6% 10.8%
1.6% direct:31.5% skip:15.6% L0:42.6% L1:38.4% BI:19.0%
[libx264 @ 0x3307500] direct mvs spatial:99.5% temporal:0.5%
[libx264 @ 0x3307500] coded y,uvDC,uvAC intra: 77.1% 72.3% 25.9% inter:
58.0% 53.3% 2.1%
[libx264 @ 0x3307500] i16 v,h,dc,p: 22% 12% 38% 28%
[libx264 @ 0x3307500] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 14% 21% 5% 7%
8% 7% 7% 8%
[libx264 @ 0x3307500] i8c dc,h,v,p: 27% 27% 25% 21%
[libx264 @ 0x3307500] Weighted P-Frames: Y:1.0% UV:0.7%
[libx264 @ 0x3307500] ref P L0: 37.9% 11.8% 36.6% 13.6% 0.2%
[libx264 @ 0x3307500] ref B L0: 73.2% 21.8% 5.0%
[libx264 @ 0x3307500] ref B L1: 92.0% 8.0%
[libx264 @ 0x3307500] kb/s:15050.90
[aac @ 0x330d8c0] Qavg: 904.717
Best wishes and many thanks once again,
Bruce.
More information about the ffmpeg-user
mailing list