Video Convert via the command line

Published by

Posted on August 27, 2008

Ubuntu Howto

Lame mp3 Library

then compile and install:

$ ./configure
$ make
$ make install
Place program in a folder in the classpath, or create symbolic link in usr/bin (or else in classpath) to point to the installation of lame. You can type the following to test install was succesful:

$ lame –help


1) The CVS server has been retired, ffmpeg now require you to install subversion (“apt-get install subversion” on debian) and use that:

$ svn checkout svn:// ffmpeg
2) configure, compile and install:

$ ./configure –enable-libmp3lame –enable-gpl –enable-shared –enable-libfaad
$ make
$ make install
The –enable-libfaad option requires that libfaad has already been installed. This is a library for decoding mpeg4 audio (mp4a). If you don’t mind not having the ability to upload mpeg 4 audio then you won’t need it, but if you do want to be able to upload videos with mp4a encoding you’ll have to struggle to get the faad libraries installed.

NB: Some (older?) versions of ffmpeg used “–enable-faad” rather than “–enable-libfaad”, so if it doesn’t work, try the other option.

At the time of writing, I still can’t figure how how to do that on either Debian or OS X.

Options with configure should work fine. You won’t need ffserver, so can add –disable-ffserver.

if you have problems and need to install again, try

$ make clean
then repeat step (2)

[edit]ffmpeg: error while loading shared libraries: cannot open shared object file: No such file or directory
If the is installed in /usr/local/lib you may need to update /etc/ add the line /usr/local/lib then type

$ ldconfig
You can also try a complete rebuild with:

$ ./configure options –prefix=/usr
This should place the ffmpeg executable where it can find the .so file, which is in /usr/local/lib

The second technique may be less invasive.

Note: also the lame library might give the same problem, but the ‘–prefix’ method might not fix, so update that file.

[edit]Running ffmpeg
Gemin-i Plus uses the following script to convert to .FLV flash video format. Try from the command line to see if it works. is a .mov file on your server, outputfile.flv is the name you’re giving to the converted file.

$ ffmpeg -i -f flv -r 30 -y outputfile.flv
The above command produced slow movies on two installs. Try:

$ ffmpeg -i -ar 22050 -b 200 -r 12 -f flv -s 640×480 destination.flv
This will resize to 640×480.

For thumbnails, try:

$ ffmpeg -i source.avi -an -ss 00:00:03 -an -r 1 -s 300×200 -vframes 1 -y -pix_fmt rgb24 destination%d.jpg
You will get a file called destination1.jpg, which will show a scene three seconds into the movie you have to remove the 1 yourself, or write a script. There’s a theoretical possibility of getting more than one destination file, numbered 2 upwards.

The output filename MUST include %d or you will get the error below. The %d will turn into a number 1 once processed. unable for find a suitable output format for destination1.jpg

/usr/include/linux/videodev.h:56: error: syntax error before “ulong”
/usr/include/linux/videodev.h:72: error: syntax error before ‘}’ token
libavdevice/v4l.c: In function `grab_read_header’:

you will need to update the linux-headers or disable the demuxer –disable-demuxer=v4l during the ./configure process
unable to install ffplay

make ffplay fails due to missing xorg-x11 headers andf libs and SDL

yum install SDL or *

Yum install xorg-x11






Video convert Examples

dv/mov to mp4/mov using avconv
vconv -i -b 1000k -b:a 192k -r 65535/2733 -strict experimental outfile.mp4

From mp4 to webm(html5)
avconv -i Eric_Marners_The_Soul_of_Love_EPK.mp4 -f webm Eric_Marners_The_Soul_of_Love_EPK.webm

avi to webm using ffmpeg
ffmpeg -i film001.avi webm out.webm
mencoder dv to avi
mencoder infile.dv -mf fps=25 -o outfile.avi -ovc lavc -lavcopts vcodec=mpeg4 -oac mp3lame

mp3 to ogg
ffmpeg -i Bmore-Swagger.mp3 libvorbis -ab 6400 Bmore-Swagger.ogg
-b 3900k > good quality

ffmpeg -i film001.avi -c:v libvpx -f webm -b 3900k out.webm