If you're using a Linux computer, Bash Scripts can be a powerful tool to help you complete useful tasks. A great script I have used is one that converts MP4 video files into MP3 audio files "on-the-fly". For me, this is a great way of converting online videos into audio files that I can listen to at any time.
The script below is a fairly simple script that finds all .mp4 files in a directory and creates a new .mp3 file - of the same name, in the same directory:
#!/bin/sh
for f in *.mp4
do
name=`echo "$f" | sed -e "s/.mp4$//g"`
ffmpeg -i "$f" -f mp3 -ab 320000 -vn "$name.mp3"
done
Copy this script and save it as the following: convert.sh in the directory with the MP4 files. Then you can run it from the terminal by navigating to that directory and typing ./convert.sh
In order to run this script, you will need to install ffmpeg. To do so, open the terminal with Ctrl + Alt + T and type the following:
sudo apt-get install ffmpeg
I hope that this script comes in handy!
Share your comments or improvements to this script in the comment section below.
I design & develop software that runs on the Internet. As a qualified analyst, accountant and real estate agent, I can deploy systems that improve performance.
Follow me: @andrewsirianni
Copyright ©2012 Andrew Sirianni, All Rights Reserved LinkedIn Profile