Created
October 4, 2016 16:30
-
-
Save jmrr/19a8a9da7d6177b2b305fd8ff0ab883a to your computer and use it in GitHub Desktop.
Raw audio extractor using ffmpeg inspired by @terdon from stackexchange
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 | |
# Specify destination folder | |
mkdir -p output | |
# Select extensions. Videos must be in the current dir | |
extension=flv | |
for vid in *.$extension; do | |
codec="$(ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -print_format csv=p=0 "$vid")" | |
case "$codec" in | |
mp3 ) filetype=mp3 ;; | |
vorbis ) filetype=ogg ;; | |
* ) filetype= ;; | |
esac | |
if [ "$filetype" ]; then | |
ffmpeg -i "$vid" -vn -acodec copy output/"${vid%.*}"."$filetype" | |
else | |
ffmpeg -i "$vid" -vn -acodec libvorbis output/"${vid%.*}".ogg | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment