I'm concatenating silent and audible video fragment in the interleaved way:
file silent1.mp4 file audible1.mp4 file silent2.mp4 file audible2.mp4 ...
The silent files are artificially generated with ffmpeg from an image by adding the text, looping for 1 sec and adding a silent audio stream. Audible files are the original videos. Each silent fragment presents some description for the next original one.
The silent video is generated this way:
ffmpeg -loop 1 -i input.jpg -f lavfi -i anullsrc=stereo:sample_rate=48000 -t 1 -y silent.mp4
The concatenationList.txt includes:
file audible1.mp4 file silent.mp4 file audible2.mp4 file silent.mp4 ...
The concatenation command:
ffmpeg -f concat -safe 0 -i concatenationList.txt concatenation.mp4
I experience audio and video stream getting out of sync. Audio stream of the next audible fragment starts earlier than its video signal. Along the time it starts earlier and earlier. Eventually, the concatenated file "runs out" of audio and keeps playing the video silently.
Any idea how to keep them in sync as they come in the original different video fragments?
The silent files have these parameters:
Duration: 00:00:01.02, start: 0.000000, bitrate: 1897 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2560x1440 [SAR 1080:1271 DAR 1920:1271], 1919 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) Metadata: handler_name : SoundHandler
The video files are of this kind:
Duration: 00:00:03.88, start: 0.000000, bitrate: 1058 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1092x616 [SAR 1:1 DAR 39:22], 914 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default) Metadata: handler_name : Core Media Video Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : Core Media Audio
May these difference cause the audio-video getting out of sync when interleaving many of them?