Created
January 1, 2019 08:14
-
-
Save krisives/126a9d390a6b2f0dbb753f5d1160285a to your computer and use it in GitHub Desktop.
Helper script for joining (concatenating) multiple media files together using ffmpeg without using an intermediate text 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
#!/usr/bin/env bash | |
if [ $# -lt 2 ]; then | |
echo "Usage: ffjoin <joined> <file>..." | |
exit 1 | |
fi | |
output=$1 | |
shift | |
if [ -f "$output" ]; then | |
echo "Output file '$output' already exists" | |
exit 1 | |
fi | |
for path in "$@"; do | |
if [ ! -f "$path" ]; then | |
echo "Cannot find file '$path'" | |
exit 1 | |
fi | |
done | |
( | |
for path in "$@"; do | |
echo "file '$path'" | |
done | |
) | ffmpeg -f concat -protocol_whitelist 'file,pipe' -i - -c copy "$output" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment