Last active 4 months ago

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

Revision c6fbe7b074019ea6eca9ee448f181b5a6dd030b2

conv-video-to-audio.sh Raw
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
6INPUT=$1
7OUTPUT=$2
8
9if ! 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
12fi
13
14if [[ -z $INPUT ]] || [[ -z $OUTPUT ]]; then
15 echo "Video to audio converter usage: input.webm output.m4a"
16 exit 1
17fi
18
19if [ ! -f $INPUT ]; then
20 echo "File $INPUT doesn't exist!"
21 exit 1
22fi
23
24ffmpeg -i "$INPUT" -vn -acodec aac "$OUTPUT"