Saturday, November 15, 2008

youtube converter

#!/bin/sh
# This script downloads YouTube videos and converts them
# You will end up with an MPG video and MP3 audio of each YouTube movie
# You need to install the following two programs:
# youtube_dl and ffmpg

# Use this script at your own risk!
# Make sure that you understand how it works before you use it!

# USAGE:
# Make a file called videos.txt with the URL of 1 YouTube video on each line.
# Don't leave any blank lines in the file
# Put the videos.txt file in an empty folder along with this script
# run this script with the following commands:
# $ ./youtube_downloader.sh
# It will take a long time to run, depending on how many videos you have in your videos.txt file.

# while read inputline
#do
# youtube_url="$(echo $inputline)"
# youtube-dl $youtube_url
# done < videos.txt

# Convert the flv files to mpg and mp3 files
for i in *.flv
do
# ffmpeg -i $i $i.mpg
# ffmpeg -i $i -ab 128 -ar 44100 $i.mp3
mplayer -dumpaudio $i -dumpfile $i.mp3
# rm $i
done

Convert pictures to 640x480 with bash

Just put this into your /usr/local/bin

sudo touch /usr/local/bin/cv640.sh
gedit /usr/local/bin/cv640.sh

#!/bin/bash

for img in `ls *.jpg`
#the img r-$img makes the filename have a r- at the front of the name
do convert -resize 640x480 $img r-$img
# do convert -sample 50%x50% $img resized-$img
#converts your file from whatever it is to 640x480
done

echo done converting
cv640.sh (END)