Created
November 9, 2019 21:59
-
-
Save tolpp/e41763811c37dca58a7d05d00fb23e48 to your computer and use it in GitHub Desktop.
ffmpeg script for merging multiple files into one mp4 file
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
#!/bin/bash | |
input_file_find_pattern="'\./$1.*'" | |
find_command="find . -regex $input_file_find_pattern" | |
input_files=() | |
while IFS= read -r line; do | |
input_files+=( "$line" ) | |
done < <( eval $find_command ) | |
ffmpeg_merge_command='ffmpeg -loglevel error' | |
for (( i = 0; i < ${#input_files[@]}; i++ )); do | |
ffmpeg_merge_command+=" -i '${input_files[$i]}'" | |
done | |
ffmpeg_merge_command+=" -strict -2 -codec copy '$1.mp4'" | |
echo "Running ffmpeg command:" | |
echo $ffmpeg_merge_command | |
eval $ffmpeg_merge_command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment