« | Home | »

Converting AVI to flv in Ubuntu 8.10/9.04

By cbarrett | November 22, 2008

I routinely upload flv videos into Gallery2 to post videos of my family. Flash Video is smaller and easier to stream than the AVI files my camera makes. So I thought I’d share my process with others who may be looking to do the same. For this, I use ffmpeg to do the conversion.

Here is the command I typically use:

ffmpeg -i file.AVI -ar 22050 -ab 32 -f flv -s 640×480 file.flv

You can tweak the settings to your liking, these just happen to work for what I do.

This can be a bit tedious when you have a lot to convert, so I wrote a simple script to do batch processing. Copy and paste this one line into a file (I call mine convertFLV.sh) and make it executable (chmod 755 convertFLV.sh).

for i in `ls -l`; do ffmpeg -i “$i” -ar 22050 -ab 32 -f flv -s 640×480 “$i.flv”; done

Maybe this will help someone else out there save some effort with conversion as it has me.

UPDATE:

I’m now using Ubuntu 9.04. I’ve switched my script to use qscale now. It seems to give much better results.

for i in `ls -l`; do ffmpeg -i “$i” -ar 22050 -qscale 13 -ab 32 -f flv -s 640×480 “$i.flv”; done

I use a qscale of 9 for my personal site, but I would recommend nothing below 13 if you care about quality. I went for loading time over high quality.

Topics: convertFLV | No Comments »

Comments