[FFmpeg-user] Assembling files from several input files

Werner Robitza werner.robitza at gmail.com
Wed Apr 9 09:32:14 CEST 2014


On Tue, Apr 8, 2014 at 8:48 PM, Lou <lou at lrcd.com> wrote:
> Maybe not simple, but this can be done with the (a)trim, (a)setpts, and
> concat filters:
>
> ffmpeg -i v1.mp4 -i v2.mp4 -i a1.m4a -i a2.m4a -filter_complex \
> "[0:v]trim=0:20,setpts=PTS-STARTPTS[v0]; \
>  [1:v]trim=20:30,setpts=PTS-STARTPTS[v1]; \
>  [2:a]atrim=0:10,asetpts=PTS-STARTPTS[a0]; \
>  [3:a]atrim=10:30,asetpts=PTS-STARTPTS[a1]; \
>  [v0][v1]concat=n=2:v=1:a=0[vcat]; \
>  [a0][a1]concat=n=2:v=0:a=1[acat]" \
> -map "[vcat]" -map "[acat]" output.mp4

Thank you, Lou. Perhaps I can come up with a way to generate such an
expression procedurally.
If anyone has suggestions on other tools that allow such a form of
concatenation more easily, I'd be happy to hear about that.

> You may need to add other filters like aformat if the inputs are
> too dissimilar.

Yeah, I was planning on decoding everything into raw formats before.


More information about the ffmpeg-user mailing list