conv-video-to-audio.sh
· 550 B · Bash
Raw
#!/bin/bash
# Basic bash script to use ffmpeg to convert videos to m4a.
# Script usage: ./conv-video-to-audio.sh input.mp4 output.m4a
INPUT=$1
OUTPUT=$2
if ! command -v ffmpeg -version > /dev/null 2>&1; then
echo "Ffmpeg is not available! You will need to install it to use this script."
exit 1
fi
if [[ -z $INPUT ]] || [[ -z $OUTPUT ]]; then
echo "Video to audio converter usage: input.webm output.m4a"
exit 1
fi
if [ ! -f $INPUT ]; then
echo "File $INPUT doesn't exist!"
exit 1
fi
ffmpeg -i "$INPUT" -vn -acodec aac "$OUTPUT"
| 1 | #!/bin/bash |
| 2 | |
| 3 | # Basic bash script to use ffmpeg to convert videos to m4a. |
| 4 | # Script usage: ./conv-video-to-audio.sh input.mp4 output.m4a |
| 5 | |
| 6 | INPUT=$1 |
| 7 | OUTPUT=$2 |
| 8 | |
| 9 | if ! command -v ffmpeg -version > /dev/null 2>&1; then |
| 10 | echo "Ffmpeg is not available! You will need to install it to use this script." |
| 11 | exit 1 |
| 12 | fi |
| 13 | |
| 14 | if [[ -z $INPUT ]] || [[ -z $OUTPUT ]]; then |
| 15 | echo "Video to audio converter usage: input.webm output.m4a" |
| 16 | exit 1 |
| 17 | fi |
| 18 | |
| 19 | if [ ! -f $INPUT ]; then |
| 20 | echo "File $INPUT doesn't exist!" |
| 21 | exit 1 |
| 22 | fi |
| 23 | |
| 24 | ffmpeg -i "$INPUT" -vn -acodec aac "$OUTPUT" |