I have a long video with different scenes in it. I want to extract and concatenate 2 scenes from the video (that do not start on an I-frame) using ffmpeg 2.1.4.
For argument, say I want 5 seconds from 01:00 and 02:00.
I can do this:
ffmpeg -ss 01:00 -i in.mkv -ss 02:00 -i in.mkv -filter_complex "
[0:v]select='lt(t,5)'[v0];
[0:a]aselect='lt(t,5)'[a0];
[v0][a0][1:v][1:a]concat=n=2:v=1:a=1
" -c:a libvorbis -t 10 out.mkv
That gives me the movie I want, but select actually forces ffmpeg to decode the entire rest of the movie. So, how do I tell it to truncate the first movie instead of decoding it?
I would prefer to do this with an ffmpeg complex filter, if possible. I know that I can just use -t
to recode separate movies first, but the extra encoding step is very slow in my case and also loses a fair amount of quality for this video.
I can't seem to find a filter that truncates the length of a steam. Are there filter nodes that correspond to the -t
or -ss
parameters?