Geek Stuff
| FFmpeg and BASH: A way to impress the ladies and be the envy of your friends! |
|
|
|
| Written by Frank Emmons |
| Tuesday, 04 August 2009 22:15 |
|
He had the option of using WinFF. But after playing with it for a while he realized it could not make thumbnails for him. So he called me to help. First I showed him how to generate a thumbnail for each video file, then create flash versions of each of the videos using for loops and ffmpeg.
cd <directory where all of the videos are stored>
for f in *.wmv; do ffmpeg -y -i "$f" -f image2 -ss 10 -vframes 1 -an "${f%.wmv}.jpg"; done
for f in *.wmv; do ffmpeg -i "$f" "${f%.wmv}.flv"; done
for f in *.wmv;
do ffmpeg -y -i "$f" -f image2 -ss 10 -vframes 1 -an "${f%.wmv}.jpg";
done We are telling the shell we are done when it runs out of files that match the pattern in the 'for' portion of the statement. This was something I threw together in less than five minutes. But the first time I attempted to get a for loop to work in bash, it took about an hour to get it right.
Disclaimer: the commands within this posting may not impress hot babes or make your friends green with envy. You will more than likely have to be content with that soft and quiet swell of pride knowing that there is one more productive thing you can do without the aid of a mouse. |
| Last Updated on Tuesday, 04 August 2009 22:50 |