Created
August 6, 2016 01:38
-
-
Save nicolas42/0784733cc7f47e107e202a9500474388 to your computer and use it in GitHub Desktop.
Concatenate Media Files with FFMPEG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| === Ffmpeg Concat demuxer | |
| To concatenate media files with ffmpeg (specifically the Concat demuxer) | |
| 1. Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored): | |
| # this is a comment | |
| file '/path/to/file1' | |
| file '/path/to/file2' | |
| file '/path/to/file3' | |
| Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files: | |
| 2. Run the following command in the terminal, making sure that the output file's extension is the same as the input file's. | |
| ffmpeg -f concat -i mylist.txt -c copy output | |
| source: from https://trac.ffmpeg.org/wiki/Concatenate | |
| Example: | |
| # this is a comment | |
| file '/path/to/file1.flac' | |
| file '/path/to/file2.flac' | |
| file '/path/to/file3.flac' | |
| ffmpeg -f concat -i mylist.txt -c copy output.flac | |
| Rebol can be used to generate the file list | |
| foreach file read dir [ print rejoin [ {file '} dir file {'} ] ] | |
| Just change dir and you're good to go. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| file 'TestFiles/File1.mp3' | |
| file 'TestFiles/File2.mp3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Change current directory to directory of script to from finder | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| cd $DIR | |
| echo $DIR | |
| # Actual command | |
| ffmpeg -f concat -i mylist.txt -c copy output.mp3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment