Tuesday, November 25, 2008

Converting AVI to FLV on UbuntuLinux

At NCTE, the ISTE NETS-A session went on for quite awhile...and I recorded it using the FLIP video camera. Since I'm using UbuntuLinux right now, I thought I'd convert the AVI video file that FLIP recorded to using some esoteric linux tool.

Here's what I found out that worked:

Slightly pixellated but passable for Web video...at the command line, type (or paste)
ffmpeg -i original.avi -ar 44100 -ab 32 -f flv original.flv
Change original.avi to reflect the name of the AVI file. I'm not sure how to improve the quality so that will mean doing some reading but...it's nice to know how to do the file conversion on UbuntuLinux!

BTW, to go the other way:
  • The open source mencoder is one possibility. See this how-to for a simple usage example.
  • Another common solution is to use ffmpeg. Here’s an example :
    ffmpeg -i myvideo.flv -f avi -vcodec mpeg4 myvideo.avi
    Or, if you prefer the MPG format :
    ffmpeg -i myvideo.flv myvideo.mpg
You can also convert AVI to MP3 audio file:
ffmpeg -i original.avi -vn original.mp3
Nifty! Other neat ffmpeg commands are available online here at CatsWhoCode.

Some of my favorites:
  • Turn X images to a video sequence
    ffmpeg -f image2 -i image%d.jpg video.mpg
  • Turn video to X images
    ffmpeg -i video.mpg image%d.jpg
  • Extract Audio from AVI video
    ffmpeg -i source_video.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3
  • Convert AVI to Animated GIF
    ffmpeg -i video_origine.avi gif_anime.gif
  • Mix a video with a sound file
    ffmpeg -i son.wav -i video_origine.avi video_finale.mpg


Subscribe to Around the Corner-MGuhlin.net

2 comments:

Alexander said...

add -r 30 to increase your quality somewhere in the middle of your code. ffmpeg -i original.avi -ar 44100 -ab 32 -r 30 -f flv original.flv

Miguel Guhlin said...

@Alexander thanks for the tip!

Subscribe via email

Enter your email address:

Delivered by FeedBurner

Disclaimer

Disclaimer

Everything posted on Miguel Guhlin's blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure