Up-to-date ffmpeg on Ubuntu Hardy
The Ubuntu repositories will give you a crippled, antiquated version of ffmpeg. Here’s the latest in my occasional series of explanations of how to get a newer, better, more full-featured version.
First, make sure that your system is up-to-date:
sudo apt-get update sudo apt-get upgrade
Next, get your dependencies:
sudo apt-get build-dep ffmpeg sudo apt-get install liblame-dev libfaad-dev \ libfaac-dev libxvidcore4-dev liba52-0.7.4 \ liba52-0.7.4-dev libx264-dev libdts-dev \ libgsm1-dev \ checkinstall build-essential subversion
Grab the ffmpeg source:
svn co -r 14946 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
Patch ffmpeg to work with Hardy’s slightly older x264 library (i.e. remove TESA support):
cd ffmpeg wget http://po-ru.com/files/ffmpeg-14946-hardy.patch patch -p0 < ffmpeg-14946-hardy.patch
Configure and build:
./configure --enable-gpl --enable-postproc \ --enable-libvorbis --enable-liba52 --enable-libdc1394 \ --enable-libgsm --disable-debug --enable-libmp3lame \ --enable-libfaad --enable-libfaac --enable-libxvid \ --enable-pthreads --enable-libx264 make
And install (I set the version to 3:1.svn14946):
sudo checkinstall
It works for me, but if I’ve missed a step or a dependency, shout in the comments.
2008-08-24 17:11 UTC. Comments: 22.
Dana
Wrote at 2008-08-30 01:52 UTC using Firefox 2.0.0.14 on Linux:
When I run ./configure, I get the error:ERROR: libgsm not found
transzoo
Wrote at 2008-08-30 11:58 UTC using Firefox 3.0.1 on Mac OS X:
@Dana: When you run in to problems like that do a Google search for the package and add words like ubuntu and package. I had several missing and found what packages I had to install with that method. Most them had a -dev at the end. For libgsm it was quite literalley libgsm-dev. Hope that helps!Paul Battley
Wrote at 2008-08-31 14:27 UTC using Firefox 3.0.1 on Linux:
I had missedlibgsm1-dev. I’ve added it to the list of prerequisites.kAos
Wrote at 2008-09-03 14:11 UTC using Firefox 3.0 on Linux:
It compiled and installed for me okay, but when I run it:/usr/local/bin/nuvexport—infile /var/lib/mythtv/recordings/1001_20080902223500.mpg—noconfirm into: /home/Tmp/Mythtv
... it bails out saying:
ffmpeg had critical errors:
av_interleaved_write_frame(): Error while opening file
... before it manages to process the first frame. Google didn’t bring up anything on this error. Has anyone seen/solved this one?
Thanks.
GC
Wrote at 2008-09-07 18:59 UTC using Firefox 3.0.1 on Linux:
Works Great!!!Thank you
CK Rock
Wrote at 2008-09-14 03:29 UTC using Firefox 3.0.1 on Linux:
I use this series every time I reinstall (k)ubuntu. You’re awesome! Thanks for providing this service!mdkaneda55
Wrote at 2008-09-14 10:49 UTC using Firefox 3.0.1 on Linux:
Awesome! i’m glad i stumbled onto ur guide, i hate trying to figure out dependencies when compiling. =) this makes it a breeze! This is definitely going into my bookmarks! hehe. thanx a ton!!Paul Battley
Wrote at 2008-09-14 12:24 UTC using Firefox 3.0.1 on Linux:
I’m glad you’re finding it useful.If you have any problems during compilation, or afterwards, when using it, please come back and add a comment here.
Allan Morris
Wrote at 2008-09-20 10:40 UTC using Firefox 3.0.1 on Linux:
Downloaded and compiled fine. Guide great help, thanks. Now testing to get good quality at reasonable bitrate / size.Dan
Wrote at 2008-09-21 09:28 UTC using Firefox 3.0 on Unknown OS:
You can add ’- -enable-libtheora’ to the configure line, and ’- -cpu=core2’ for further optimisations, if you have a core2duo processor.Also, the package ‘libmp3lame-dev’ deprecates ‘liblame-dev’ in Intrepid (maybe Hardy too).
Thanks! Dan
Keith Hughitt
Wrote at 2008-09-22 20:01 UTC using Firefox 3.0.1 on Linux:
Hey Paul,Thanks for the guide! The above worked great for me on 8.10. I was wondering if you have any experience with watermarking videos? So far I haven’t been able to get vhook to work on Ubuntu.
Any ideas?
Jeffrey H
Wrote at 2008-09-22 20:51 UTC using Firefox 3.0.1 on Linux:
Worked great for me! I’ve tried so many things to get it working and this did it. Thanks for this straightforward guide.Mimzy
Wrote at 2008-09-25 21:49 UTC using Firefox 3.0.2 on Linux:
I get stuck on the “checkinstall build-essential subversion” part…I get a message that says “The package documentation directory ./doc-pak does not exist.”It then offers to make a “default set of docs”, but I’m pretty new to linux and have no idea what this means. Could someone please help?
Theo Bunge
Wrote at 2008-10-12 14:02 UTC using Firefox 3.0.3 on Linux:
Thanks for the help compiling ffmpeg for Ubuntu Hardy, and also all the trouble to run a service like this. Everything works fine.Greetings
Theo from South Africa
DallasP
Wrote at 2008-10-16 03:24 UTC using Safari 525.20.1 on Mac OS X:
I had to drop—enable-libvorbis—enable-libdc1394 to get the configure. The output showed these were turned off as a result.Freddy
Wrote at 2008-10-19 20:39 UTC using Firefox 3.0.3 on Linux:
Hi Paul,thanks for the guide. Trying to compile, but got this error:
-c -o libavformat/tcp.o libavformat/tcp.c
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. -I”/home/freddy/Desktop/ffmpeg” -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -fasm -std=c99 -fomit-frame-pointer -pthread -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -O3 -fno-math-errno -fno-signed-zeros -c -o libavformat/udp.o libavformat/udp.c
libavformat/udp.c: In function ‘udp_join_multicast_group’:
libavformat/udp.c:83: error: storage size of ‘mreq’ isn’t known
libavformat/udp.c:83: warning: unused variable ‘mreq’
libavformat/udp.c: In function ‘udp_leave_multicast_group’:
libavformat/udp.c:111: error: storage size of ‘mreq’ isn’t known
libavformat/udp.c:111: warning: unused variable ‘mreq’
Running intrepid.
Thank you
scalpel4hire
Wrote at 2008-10-23 13:27 UTC using Firefox 3.0.3 on Linux:
Get the same hitch as mimzy – stuck at “checkinstall build-essential subversion”& not sure how to proceed with the “default set of docs” preparation (seems to expect some parameters, of which I have no idea.)
Did you figure this out, mimzy?
TehSnarf
Wrote at 2008-10-23 17:26 UTC using Firefox 3.0.3 on Windows Vista:
Yeah, just got the same error as Freddy… could also use some help on that.JoeLinux
Wrote at 2008-10-26 16:56 UTC using Firefox 3.0.3 on Linux:
I got it working in Intrepid. You have to download the latest revision from svn:svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
Once that downloads, follow the same steps above (even the hardy patch still works). Before you run the configure statement, you must install the latest x264 version first (this revision asks for a version of x264 >= 0.65, while Ubuntu only offers at most version 0.59). To do this, grab the latest version from http://www.videolan.org. You can install either via tarball or git repository (I used git).
Then, once you’ve completed installation of x264 and finally get to the “configure” portion, use this configure statement:
./configure—enable-gpl—enable-postproc—enable-libvorbis—enable-libdc1394—enable-libgsm—disable-debug—enable-libmp3lame—enable-libfaad—enable-libfaac—enable-libxvid—enable-pthreads—enable-libx264
Before you type “make” there are a few other things that it looks for. I had to install both libpostproc-dev and libavdevice-dev, and also do the following:
sudo ln -s /usr/include/postproc/ /usr/local/include/libpostproc
sudo ln -s /usr/include/ffmpeg/ /usr/local/include/libavdevice
sudo ln -s /usr/include/ffmpeg/ /usr/local/include/libavformat
sudo ln -s /usr/include/ffmpeg /usr/local/include/libavcodec
sudo ln -s /usr/include/ffmpeg /usr/local/include/libavutil
sudo ln -s /usr/lib/vhook /usr/local/lib/vhook
There must be a cleaner way of doing that (maybe PREFIX=/usr somewhere?). Anyway, it works. Then run “make” and “sudo checkinstall”. That’s it!
Oliver
Wrote at 2008-11-08 04:52 UTC using Firefox 3.0.3 on Linux:
I’ve been trying to transcode the ac3 audio from an AVCHD file to mp2, and I getUnsupported codec (id=86020) for input stream #1.0
Am I missing a dependency, or should I change the configuration before building?
jani
Wrote at 2008-11-08 14:45 UTC using Firefox 3.0.3 on Linux:
Thanks,Short and sweet: This guide gave me couple of extra hours to play with the kids and the dog.
My MythTV was running out of disk space and and now I can transcode movies eith H.264.
Cheers,
Jani
jim
Wrote at 2008-11-14 04:57 UTC using Firefox 3.0.3 on Linux:
Just tried this on 8.10 when I discovered that ffmpeg has been disabled to prevent any transcoding to DivX.Perhaps unsurprisingly it doesn’t work on “Intrepid”. First problem was that the liblame library has been renamed to libmp3lame, and the dev library correspondingly.
When I do the make, I get the following error, which I have to confess I don’t really know enough to solve.
libavformat/udp.c: In function ‘udp_join_multicast_group’:
libavformat/udp.c:83: error: storage size of ‘mreq’ isn’t known
libavformat/udp.c:83: warning: unused variable ‘mreq’
libavformat/udp.c: In function ‘udp_leave_multicast_group’:
libavformat/udp.c:111: error: storage size of ‘mreq’ isn’t known
libavformat/udp.c:111: warning: unused variable ‘mreq’
make: *** [libavformat/udp.o] Error 1
Hopefully this will help someone, or at least save someone some time. Shame it doesn’t work as there are a lot of good things happening with 8.10.