Created
January 26, 2016 11:40
-
-
Save smartest/8a9cd4040b761c9aff1c to your computer and use it in GitHub Desktop.
Audio extract from Video with intended interval (avconv)
This file contains hidden or 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 | |
#read -r filename < $1 | |
exec < $1 | |
read filename | |
#echo "$filename" | |
while read s e | |
do | |
echo "${s} - ${e}" | |
# echo "${s:(-2)} - ${e}" | |
# echo "${s%${s:(-2)}}:${s:(-2)} - ${e%${e:(-2)}}:${e:(-2)}" | |
# echo "${s:2} - ${e}" | |
s1=`printf %02d $(( 10#${s%${s:(-2)}} ))` | |
e1=`printf %02d $(( 10#${e%${e:(-2)}} ))` | |
# s1=${s%${s:(-2)}} | |
# e1=${e%${e:(-2)}} | |
let ss=10#${s1}*60+10#${s:(-2)} | |
let ee=10#${e1}*60+10#${e:(-2)} | |
let du=ee-ss | |
echo "${s1}:${s:(-2)} - ${e1}:${e:(-2)} --> ${ss} sec to ${ee} sec for ${du} secs." | |
echo "" | |
avconv -i "${filename}" -ss ${ss} -t ${du} -metadata artist="er" -metadata title="${s1}${s:(-2)}-${e1}${e:(-2)}" -metadata album="$1" -vn -acodec aac -strict experimental -y "audio/$1.${s1}${s:(-2)}-${e1}${e:(-2)}.m4a" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment