Skip to content

Instantly share code, notes, and snippets.

@nothub
Last active September 21, 2020 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nothub/c8dd5d0a3af559ed4131abd9d2b67da7 to your computer and use it in GitHub Desktop.
Save nothub/c8dd5d0a3af559ed4131abd9d2b67da7 to your computer and use it in GitHub Desktop.
ffmpeg
#!/bin/bash
set -e
EXAMPLE_USAGE="$(basename $0) video.mp4 audio.mp3 merged.mp4"
if [ -z "$1" ]; then
echo "please specify input video file"
echo "$EXAMPLE_USAGE"
exit 1
fi
if [ -z "$2" ]; then
echo "please specify input audio file"
echo "$EXAMPLE_USAGE"
exit 1
fi
if [ -z "$3" ]; then
echo "please specify output file"
echo "$EXAMPLE_USAGE"
exit 1
fi
ffmpeg -i "$1" -i "$2" -map 0:v -map 1:a -c:v copy -shortest "$3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment