I have 239 small MKV video files with identical characteristics (they were cut from the original video with the same command but different -ss -t
parameters).
I concatenate them all back into one long video and this video gets longer duration than the sum of durations of the small files.
All small files have 29.95 fps
but the concatenated video has 29.75 fps
and I do the -c copy
, why does it change?
How can I concatenate the files and get the expected duration without frame rate change?
I counted frames of all input files and frames of the resulting video and the number of frames is the same, so the problem is in fps.
Also I tried to re-encode instead of copy and get proper 29.95 fps but the duration is still longer than the original, number of frames also increased...
I'm lost here, please advise.
Here is my original concat
command:
ffmpeg -f concat -safe 0 -i lst -c copy -y concat.mp4
List file 'lst' contains:
file test_000.mkv
file test_001.mkv
file test_002.mkv
....
ffprobe for the first two files, they all differ by duration only:
ffprobe version 4.0-static https://johnvansickle.com/ffmpeg/
Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-libxml2 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, matroska,webm, from 'test_000.mkv':
Metadata:
ENCODER : Lavf58.10.100
Duration: 00:00:19.07, start: 0.064000, bitrate: 12639 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 29.95 fps, 29.95 tbr, 1k tbn, 59.90 tbc (default)
Metadata:
ENCODER : Lavc58.14.100 libx264
DURATION : 00:00:19.065000000
Stream #0:1: Audio: vorbis, 48000 Hz, mono, fltp
Metadata:
ENCODER : Lavc58.14.100 libvorbis
DURATION : 00:00:19.068000000
Second file:
ffprobe version 4.0-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-libxml2 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, matroska,webm, from 'test_001.mkv':
Metadata:
ENCODER : Lavf58.10.100
Duration: 00:00:12.07, start: 0.064000, bitrate: 10773 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 29.95 fps, 29.95 tbr, 1k tbn, 59.90 tbc (default)
Metadata:
ENCODER : Lavc58.14.100 libx264
DURATION : 00:00:12.053000000
Stream #0:1: Audio: vorbis, 48000 Hz, mono, fltp
Metadata:
ENCODER : Lavc58.14.100 libvorbis
DURATION : 00:00:12.067000000
Resulting video:
ffprobe version 4.0-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-libxml2 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'concat.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.10.100
Duration: 00:41:23.73, start: 0.000000, bitrate: 9392 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 9313 kb/s, 29.75 fps, 29.97 tbr, 16k tbn, 59.90 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: vorbis (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 66 kb/s (default)
Metadata:
handler_name : SoundHandler
-an
and check.