Friday, April 03, 2009

Extracting audio from all CFA video files in one command.

Really impressed with myself today.
I have the CFA schwsere CDs with me and these CDs have vidoes in them, but I am not interested in looking at a person talking, I am more interested in listening to the lecture. In short I would like to extract the audio channel for all these videos.
1. Find a tool that extracts audio from the vidoe file - ffmpeg, this tool was able to extract the audio as an mp3 file.
2. Automate the process to go over all the vidoe files and convert them to mp3.

Since all the video files have the same name, and I want the audio file to have diffent names based off the Study Session and Reading, here is what I did
- Find all wmv files
- for each file extract the folder name ( this contains the following format L2_SS18_P7)
- extract the video into an audio file based off the above file name.

find . -name *.wmv -exec sh -c 'ffmpeg -i {} `ls {} | cut -d '/' -f 3`.mp3' \;

Whoo hooo

I found that CD10 and CD11 are the same, so I have to mount and extract them again.


Intermediate commands to test
find . -iname *.flac -exec flac2vorbis {} \; -exec rm -v {} \;


find . -iname *.flac -exec sh -c "flac2vorbis {} && rm {}" \;


find . -name *.wmv -exec sh -c "ls {} | cut -d '/' -f 3" \;


ffmpeg -i ./CD16/L2_SS18_P7/L2_SS18_P7_files/0MM0.wmv `ls ./CD16/L2_SS18_P7/L2_SS18_P7_files/0MM0.wmv | cut -d '/' -f 3`.mp3

No comments: