[FFmpeg-user] get in-time for clips after filter_complex concat

Erik Blankinship erikb at mediamods.com
Wed Nov 30 00:46:09 EET 2016


I've concatenated some videos (with audio tracks) together using ffmpeg's
filter_complex. Between each video is a blank video (black with silent
audio).

#the blank video
ffmpeg -f lavfi -i color=c=black:s={w}x{h}:d={duration} -f lavfi -i
aevalsrc=0:c=2:d={duration} {target_file}
#concat the videos
ffmpeg -i b.mp4 -i clip0.mp4 -i clip1.mp4 -i clip2.mp4 -i clip3.mp4
-filter_complex '[1:0] [1:1] [0:0] [0:1] [2:0] [2:1] [0:0] [0:1] [3:0]
[3:1] [0:0] [0:1] [4:0] [4:1] concat=n=7:v=1:a=1 [v] [a]' -map '[v]'
-map '[a]' argh.mp4 -report

Once created, the resultant video looks great and sounds great!

Now I need to know the exact time or frame the videos are inserted into the
output file.

My attempts to sum up the durations of the clips which were used to make
the output movie often leaves me off by one frame.

I got the durations for the clips using ffprobe and have tried using the
audio durations, video durations, and the "format" durations. However,
whichever of the clip durations I sum to determine the inpoint of the clip
in the concatenated video is off by ~1 frame for some of the last clips :-/

What is the right way to solve this problem? Is there a better way to
construct my video so that I can accurately find the inpoints in the
concatenated video?

(If it is helpful I can post the videos somewhere).


More information about the ffmpeg-user mailing list