Is it possible to concat without temp files using ffmpeg? eg;

# nice ffmpeg -v error -f concat \
  -ss "52.519" -copyts -to "53.153" -i in.mkv \
  -ss "53.186" -copyts -to "390.690" -i in.mkv \
  -ss "464.264" -copyts -to "2831.331" -i in.mkv \
  -c copy out.mkv < /dev/null
Invalid duration specification for ss: "52.519"

if so, what is ffmpeg version 4.2.4 complaining about? the "duration specification" is valid when using temp files followed by concat.

mkvtoolnix is able to do this btw.

1 Answer 1


If I understand the question correctly: yes! You can create a file that is a concatenation of different parts of the input video.

The script you're looking for is something like:

ffmpeg \
-i "$INPUT_FILE" \
-filter_complex \
"[0:v]trim=start=5:duration=10,setpts=PTS-STARTPTS[v0]; \
 [0:a]atrim=start=5:duration=10,asetpts=PTS-STARTPTS[a0]; \
 [0:a]atrim=start=20:duration=10,asetpts=PTS-STARTPTS[a1]; \
 [v0][a0][v1][a1]concat=n=2:v=1:a=1[final]" \
-map "[final]" concat-video.mp4

You can read a little bit more about this on this blog post

(Disclaimer: I'm one of the co-founder of https://mediamachine.io)

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.