Last active 4 months ago

Basic bash script to convert video files to m4a with ffmpeg.

kelson8 revised this gist 4 months ago. Go to revision

1 file changed, 24 insertions

conv-video-to-audio.sh(file created)

@@ -0,0 +1,24 @@
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"
Newer Older