Skip to content

Commit

Permalink
add script
Browse files Browse the repository at this point in the history
  • Loading branch information
samirfor committed Sep 10, 2016
1 parent fcd81dc commit 525eec1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions eac3toac3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -euo pipefail

[ $# -eq 0 ] && echo "Parameter missing. Usage: $0 filename.mkv" && exit -1

MKV_INPUT="$1"
IFILE=$(basename "$MKV_INPUT")
# extension="${FILE##*.}"
IFILE="${IFILE%.*}"

# get E-AC3 audio track ID from MKV container
LINE=$(mkvinfo ${MKV_INPUT} | grep "Track type" | grep -n "audio" | cut -d":" -f1)
AUDIO_ID=$(( $LINE - 1 ))

# extract E-AC3 audio track from MKV container
mkvextract tracks "$MKV_INPUT" ${AUDIO_ID}:"${IFILE}.eac3"

# convert E-AC3 audio file to a standart AC3 file
avconv -i "${IFILE}.eac3" -c:a ac3 "${IFILE}.ac3" -b 600k

0 comments on commit 525eec1

Please sign in to comment.