[FFmpeg-user] Keeping A/V sync during telecine
Carl Zwanzig
cpz at tuunq.com
Fri Dec 29 23:03:52 EET 2017
Hello,
In order to support a legacy analog NTSC system, I need to convert a pile of
programs from 24p to 60i with a 3:2 pulldown. I've been successful with the
video, however sometimes the audio comes out early. In some test cases, it's
noticeably off even a couple of minutes into program; can't really tell if
it drifts further since it's not in sync to start. (And, of course, some
programs convert just fine.)
Example:
cpz at video-proc-0:/mnt/videofiles % ffmpeg -r ntsc-film -i INPUT.vob -vf
telecine -dc 9 -target ntsc-dvd -flags +ilme+ildct -alternate_scan 1 -top 0
OUTPUT.mpg
ffmpeg version 3.3.5 Copyright (c) 2000-2017 the FFmpeg developers
built with FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347)
(based on LLVM 4.0.0)
configuration: --prefix=/usr/local --mandir=/usr/local/man
--datadir=/usr/local/share/ffmpeg
--pkgconfigdir=/usr/local/libdata/pkgconfig --enable-shared --enable-pic
--enable-gpl --enable-postproc --enable-avfilter --enable-avresample
--enable-pthreads --cc=cc --disable-indev=alsa --disable-outdev=alsa
--disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libass
--disable-libbs2b --disable-libcaca --disable-libcdio --disable-libcelt
--disable-chromaprint --disable-libdc1394 --disable-debug --enable-htmlpages
--disable-libfdk-aac --enable-ffserver --disable-libflite
--enable-fontconfig --enable-libfreetype --enable-frei0r
--disable-libfribidi --disable-libgme --disable-libgsm --enable-iconv
--disable-libilbc --disable-indev=jack --disable-libkvazaar --disable-ladspa
--disable-libmp3lame --disable-libbluray --enable-mmx --disable-libmodplug
--disable-netcdf --disable-openal --disable-indev=openal --disable-opencl
--enable-libopencv --disable-opengl --disable-libopenh264
--disable-libopenjpeg --enable-optimizations --disable-libopus
--disable-libpulse --disable-indev=pulse --disable-outdev=pulse
--enable-runtime-cpudetect --disable-librubberband --enable-libschroedinger
--disable-ffplay --disable-outdev=sdl --disable-sdl2 --disable-libsmbclient
--disable-libsnappy --disable-indev=sndio --disable-outdev=sndio
--disable-libsoxr --disable-libspeex --enable-sse --disable-libssh
--disable-libtesseract --enable-libtheora --disable-libtwolame
--enable-libv4l2 --enable-vaapi --enable-vdpau --disable-libvidstab
--enable-libvorbis --disable-libvo-amrwbenc --enable-libvpx
--disable-libwavpack --disable-libwebp --enable-libx264 --enable-libx265
--disable-libxcb --enable-libxvid --disable-outdev=xv --disable-libzimg
--disable-libzmq --disable-libzvbi --disable-gcrypt --enable-gmp
--disable-librtmp --enable-gnutls --disable-openssl --enable-version3
--disable-nonfree
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, mpeg, from 'INPUT.vob':
Duration: 01:55:53.25, start: 0.084000, bitrate: 5061 kb/s
Stream #0:0[0x1bf]: Data: dvd_nav_packet
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg, top
first), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
Stream mapping:
Stream #0:1 -> #0:0 (mpeg2video (native) -> mpeg2video (native))
Stream #0:2 -> #0:1 (ac3 (native) -> ac3 (native))
Press [q] to stop, [?] for help
[Parsed_telecine_0 @ 0x80c23e920] Telecine pattern 23 yields up to 2 frames
per frame, pts advance factor: 4/5
Output #0, dvd, to 'OUTPUT.mpg':
Metadata:
encoder : Lavf57.71.100
Stream #0:0: Video: mpeg2video (Main), yuv420p(progressive), 720x480
[SAR 8:9 DAR 4:3], q=2-31, 6000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
Metadata:
encoder : Lavc57.89.100 mpeg2video
Side data:
cpb: bitrate max/min/avg: 9000000/0/6000000 buffer size: 1835008
vbv_delay: -1
Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 448 kb/s
Metadata:
encoder : Lavc57.89.100 ac3
frame=208813 fps=437 q=2.0 Lsize= 4942192kB time=01:56:07.32
bitrate=5810.9kbits/s speed=14.6x
video:4470286kB audio:380256kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 1.889482%
cpz at video-proc-0:/mnt/videofiles/ %
Adding the filter "-af aresample=async=1000" did not seem to change the
behavior, nor did "-async 1".
Many of the originals I've been given have some sort of silent title/intro,
so I wonder whether actual audio packets don't start immediately and that
something isn't matching or adjusting timestamps. (Sync issues are seen with
multiple players and original is fine with vlc.)
I need some ideas :).
Manually adjusting an audio delay isn't a great option as I have 50-60
individual items to convert, and I'd rather set a batch running and leave
it. Also, I'm not overly concerned with artifacts, either visual or aural,
or against encoding into h264 as part of the process. Whatever will work.
Many thanks,
z!
More information about the ffmpeg-user
mailing list