User:Nik Doof/AutoAudio
Jump to navigation
Jump to search
autoaudio.sh
AutoAudio
In the UK we're provided with numerous DVB radio channels and each of these has EIT data to enable scheduled recording. MythTV records the audio and the blank video frames so the output is in MPEG2 format. As I wanted these shows to be "piped out" into my existing audio system (Amarok) I created the following script to run as a userjob.
The script extracts the MP3 audio and dumps it to a file, and uses the program title and date/time tag/name it.
#!/bin/bash ########### # # Suggested execution format: # # autoaudio.sh %FILE% %STARTTIMEISO% %TITLE% # ########### OUTPUTDIR="/mnt/vault/music/Radio/" INFILE=$1 STARTDATE=$2 PROGTITLE=$3 # Split ########### OUTFILE="$3 - $2.mp3" ffmpeg -v 0 -i "$INFILE" -vn -acodec copy -f mp3 "$OUTFILE" # Tag ########## YEAR=`date +%Y -d "$STARTDATE"` id3tag --artist="$PROGTITLE" --song="$STARTDATE" --comment="Recorded at $STARTDATE" -gRadio -y$YEAR -t1 -T1 "$OUTFILE" # Move ########## if [ ! -d "$OUTPUTDIR" ]; then mkdir "$OUTPUTDIR" fi if [ ! -d "$OUTPUTDIR/$PROGTITLE" ]; then mkdir "$OUTPUTDIR/$PROGTITLE" fi mv "$OUTFILE" "$OUTPUTDIR/$PROGTITLE/$OUTFILE"