Skip to content

Instantly share code, notes, and snippets.

@jmsaavedra
Last active October 18, 2019 04:28
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jmsaavedra/11160372 to your computer and use it in GitHub Desktop.
Save jmsaavedra/11160372 to your computer and use it in GitHub Desktop.
FFmpeg Concat Strategies

###FFmpeg Concatenation Strategies

These examples based on FFmpeg wiki page: How to concatenate (join, merge) media files

brew install ffmpeg
brew upgrade ffmpeg

EXAMPLE: single line concat with standard concat protocol

This example only works for files that are the same type AND that are MPG and MPEG transport streams:

ffmpeg -i "concat:input1.mpg|input2.mpg|input3.mpg" -c copy output.mpg

EXAMPLE: single line concat with concat demuxer

This example for files that are of the same type but is much more flexible as far as what filetype that is:

ffmpeg -f concat -i <(for f in ~/Documents/ffmpegTests/src/*.mov; do echo "file '$f'"; done) -c copy output.mov

EXAMPLE: Demuxer: list.txt with concat demuxer

  • Demuxer pointing to a list of files.
  • Create file named 'mylist.txt'
  • All files to be concatenated:

file 'input1.mov'

file 'input2.mov'

file 'input3.mov'

note: can be relative path or absolute paths.

then run:

ffmpeg -f concat -i mylist.txt -c copy output

notes on concatenation in general

  • you cannot concatenate a file built from concatenation (with standard settings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment