Last active
February 23, 2019 07:49
-
-
Save mikedawson/1d66a1d35bd1538b2a9950246ef061a2 to your computer and use it in GitHub Desktop.
Script to generate a variety of samples of different codec2 files
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 | |
C2_HOME=/home/mike/src/codec2-svn/build_linux/src | |
VERSIONARGS=("--rate 2400" | |
"--rate 2400 --lpc 10 --lpcpf" | |
"--rate 3200") | |
INDIR=$1 | |
OUTDIR=$2 | |
FILES=$(ls $INDIR/*.mp4) | |
HTMLFILE=$OUTDIR/index.html | |
echo "<html><body>" > $HTMLFILE | |
echo "<table><tr><td>Input</td><td>Original</td>" >> $HTMLFILE | |
for ((i = 0; i < ${#VERSIONARGS[@]}; i++)); do | |
echo "<td>Version $i ${VERSIONARGS[$i]}</td>" >> $HTMLFILE | |
done | |
echo "</tr>" >> $HTMLFiLE | |
for file in $FILES | |
do | |
echo "<tr>" >> $HTMLFILE | |
RAWFILE=$OUTDIR/$(basename $file .mp4).raw | |
ffmpeg -i $file -vn -c:a pcm_s16le -ar 8000 -ac 1 -f s16le $RAWFILE | |
sox -r 8000 -e signed -b 16 $RAWFILE $OUTDIR/$(basename $file .mp4).wav | |
echo "<td>$(basename $file)</td>" >> $HTMLFILE | |
echo "<td><audio controls=\"controls\" src=\"$(basename $file .mp4).wav\"></audio></td>" >> $HTMLFILE | |
for ((i = 0; i < ${#VERSIONARGS[@]}; i++)); do | |
CODEC2_BASEPATH=$OUTDIR/$(basename $file .mp4)-codec2-version$i | |
$C2_HOME/c2sim $RAWFILE ${VERSIONARGS[$i]} -o $CODEC2_BASEPATH.raw | |
sox -r 8000 -e signed -b 16 $CODEC2_BASEPATH.raw $CODEC2_BASEPATH.wav | |
echo "<td><audio controls=\"controls\" src=\"$(basename $file .mp4)-codec2-version$i.wav\"></audio></td>" >> $HTMLFILE | |
done | |
echo "</tr>" >> $HTMLFILE | |
done | |
echo "</table></body></html>" >> $HTMLFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment