Created
June 20, 2014 19:26
Convert AC3 to MP3 in a MKV file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# script: convert AC3 to MP3 in MKV container | |
# author: bert2002 <s.wirth@itbert.de> | |
FILE=$1 | |
FILENAME=$(basename $FILE mkv) | |
AC3AUDIO=$(mkvmerge --identify $FILE |grep "AC3" | awk -F':' '{print $1}' | awk '{print $3}') | |
mkvextract tracks $FILE $AC3AUDIO:${FILENAME}ac3 | |
ffmpeg -i ${FILENAME}ac3 -acodec libmp3lame -ab 160k -ac 2 ${FILENAME}mp3 | |
mkvmerge -o ${FILENAME}NEW.mkv $FILE ${FILENAME}mp3 | |
MP3AUDIO=$(mkvmerge --identify ${FILENAME}NEW.mkv |grep MP3 | awk -F':' '{print $1}' | awk '{print $3}') | |
mkvmerge -o ${FILENAME}NEW.mkv.tmp -a $MP3AUDIO ${FILENAME}NEW.mkv && mv ${FILENAME}NEW.mkv.tmp ${FILENAME}NEW.mkv | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment