[FFmpeg-user] Double decimate and frame rate conversion questions
Laine
llee040 at sbcglobal.net
Sat Jun 1 22:39:58 EEST 2024
I'm trying to convert 30 fps videos to 24 fps. I've been playing with a lot of methods for removing what I think may be known as lag spikes, spurious duplicate frames which fall outside the usual pattern of 4 unique frames and 1 duplicate of the 4th. I tried the following command and find that it eliminates the spurious dups, but it also eliminates many dups in succession, virtually cutting out all passages where there is a black screen or any group of consecutive frames having precisely the same content. I've already tried many variations of this command line. Is there a way to alter the command so that no more than 1 consecutive dup will be eliminated?
I have one more related question.
If I omit "mpdecimate,setpts=N/24/TB" from the filter chain on a video of a duration greater than a few minutes, the results are very good except that the audio sync deteriorates gradually, apparently because the audio is being encoded with a shorter duration than video at the specified frame rate. Is there a way I can alter the command so that the audio will remain synced? (I've also tried copying the audio with no encoding, which has similar results.)
Thanks.
Here's my command line and output:
ffmpeg -i 30_fps.ts -map 0:0 -vf decimate=cycle=5,mpdecimate,setpts=N/24/TB,crop=1920:800:0:140 -c:v h264_videotoolbox -b:v 3600k -color_primaries:v bt709 -color_trc:v bt709 -colorspace:v bt709 -metadata:s:v "title=" -disposition:v default -map 0:1 -c:a:0 ac3 -b:a 640k -metadata:s:a:0 "title=" -disposition:a:0 default -metadata:g "title=" -r 24 -movflags disable_chpl 30_fps_to_24.mp4
ffmpeg -i 30_fps.ts -map 0:0 -vf decimate=cycle=5,mpdecimate,setpts=N/24/TB,crop=1920:800:0:140 -c:v h264_videotoolbox -b:v 3600k -color_primaries:v bt709 -color_trc:v bt709 -colorspace:v bt709 -metadata:s:v "title=" -disposition:v default -map 0:1 -c:a:0 ac3 -b:a 640k -metadata:s:a:0 "title=" -disposition:a:0 default -metadata:g "title=" -r 24 -movflags disable_chpl 30_fps_to_24.mp4
ffmpeg version 7.0.1 Copyright (c) 2000-2024 the FFmpeg developers
built with Apple clang version 15.0.0 (clang-1500.3.9.4)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
libavutil 59. 8.100 / 59. 8.100
libavcodec 61. 3.100 / 61. 3.100
libavformat 61. 1.100 / 61. 1.100
libavdevice 61. 1.100 / 61. 1.100
libavfilter 10. 1.100 / 10. 1.100
libswscale 8. 1.100 / 8. 1.100
libswresample 5. 1.100 / 5. 1.100
libpostproc 58. 1.100 / 58. 1.100
Input #0, mpegts, from '30_fps.ts':
Duration: 00:01:00.15, start: 1.400000, bitrate: 15068 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn
Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 640 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_videotoolbox))
Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to '30_fps_to_24.mp4':
Metadata:
encoder : Lavf61.1.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x800 [SAR 1:1 DAR 12:5], q=2-31, 3600 kb/s, 24 fps, 12288 tbn (default)
Metadata:
encoder : Lavc61.3.100 h264_videotoolbox
Stream #0:1: Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
Metadata:
encoder : Lavc61.3.100 ac3
[out#0/mp4 @ 0x6000006bc000] video:19462KiB audio:4688KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.069524%
frame= 808 fps=107 q=-0.0 Lsize= 24167KiB time=00:00:33.62 bitrate=5887.7kbits/s speed=4.46x
Thanks again!
L. Lee
More information about the ffmpeg-user
mailing list