PDA

View Full Version : HOWTO: Install and use the latest FFmpeg and x264



Pages : 1 [2] 3 4 5 6 7 8 9 10

cloggie
November 24th, 2008, 06:51 AM
YEEEEEEEEEEEEEEEEEEEEEEEEES.

I found my problem!!!!!!!!!!!!!!!!1

What I tried to do was converting a mov file to a mp4 file, as you can see.
The reason for this was that my Sony Walkman could only play mp4 files.
Because of the suggestions you gave me, I found out that it of course had nothing todo with the input file format.

I just fussed around and around with your first suggestion, saw what the "-vn" stood for (stripping the video part of the movie) and went from there. Then my player wouldn't play it still but then I thought, maybe this has something todo with the size of the frame. The output was always 352x288 and my player could only handle 320x240. So I forced this by adding "-s 320x240" to your line and voila, it worked!. My player is happy now, and I am happy.

Thanks for your support again, hope to be able to return the favor one day.

Will.

cloggie
November 24th, 2008, 07:09 AM
Damn, I was too quick. Tried the whole thing with a new .mov file, and again get into trouble.
Ah well, it's time to hit the sack, my cows are waiting for me tomorrow again, hahaha.
Will try later this week.

FakeOutdoorsman
November 24th, 2008, 07:55 AM
...
Again, from mpg to mp4 it works without a hitch, but when I try a .mov, it fails on me.

Are you using the 264encode.sh script from the first page of this guide? It doesn't specify an audio rate because I assumed libfaac (the aac audio encoder) could figure most things out on it's own, but apparently it can't always. Your mov file has an audio rate that isn't compatible with libfaac, so you have to specify it. So, the second line (Pass 2) needs "-ar 44100", which should be a safe number for playback on most portable players:

# Pass 2
ffmpeg -y -i $1 -pass 2 -b 512k -bt 512k -vcodec libx264 -acodec libfaac -ar 44100 etc...


First like to say I sincerely appreciate the quick responses..and im going to go down this list and try them out see if one works..

BTW Im using Intrepid ubuntu 8.10
Are you also trying 264encode.sh? libfaac should be able to work with no issues for your input file, but I'm not sure what the deal is. Looks like you will have to tell it the audio rate and the number of channels for it to work. One the "# Pass 2" line, I recommend adding "-ar 48000" (or 44100), and "-ac 2" for stereo or "-ac 5.1" for surround sound like the original file. What are you converting this file for? If you use 264encode.sh then it will take a while to convert the video, but you may not need to convert it at all since it is already h264 video. It all depends on what it is being converted for.

DilfATX
November 24th, 2008, 08:05 AM
Are you using the 264encode.sh script from the first page of this guide? It doesn't specify an audio rate because I assumed libfaac (the aac audio encoder) could figure most things out on it's own, but apparently it can't always. Your mov file has an audio rate that isn't compatible with libfaac, so you have to specify it. So, the second line (Pass 2) needs "-ar 44100", which should be a safe number for playback on most portable players:

# Pass 2
ffmpeg -y -i $1 -pass 2 -b 512k -bt 512k -vcodec libx264 -acodec libfaac -ar 44100 etc...


Are you also trying 264encode.sh? libfaac should be able to work with no issues for your input file, but I'm not sure what the deal is. Looks like you will have to tell it the audio rate and the number of channels for it to work. One the "# Pass 2" line, I recommend adding "-ar 48000" (or 44100), and "-ac 2" for stereo or "-ac 5.1" for surround sound like the original file. What are you converting this file for? If you use 264encode.sh then it will take a while to convert the video, but you may not need to convert it at all since it is already h264 video. It all depends on what it is being converted for.

I am converting this for home videos on DVD.. and yes i followed your commands all the way.. i am trying the 254encode.sh ... would it be much trouble if somebody can make a quick youtube type video on how to on your guide..i did a search on youtube and somebody did it with another guide for mts files.. this one though seems like a better bet..

FakeOutdoorsman
November 24th, 2008, 11:13 PM
I am converting this for home videos on DVD.. and yes i followed your commands all the way.. i am trying the 254encode.sh ... would it be much trouble if somebody can make a quick youtube type video on how to on your guide..i did a search on youtube and somebody did it with another guide for mts files.. this one though seems like a better bet..
Are you trying to make archive quality videos to put in a DVD as data files, or are you trying to make a video DVD that would work in a standard DVD player?

dude1981
November 25th, 2008, 10:13 PM
Hello,

first of all thanks to this great tutorial.
Unfortunately I receive an error when I try to convert a mkv-Movie:


ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init

I try to convert with the following command:

ffmpeg -i $1 -threads 1 -vcodec libx264 -sameq -b 5000k -acodec copy -r 24 output.avi

Does anybody have an idea how I can fix that error?

FakeOutdoorsman
November 26th, 2008, 08:46 AM
Does anybody have an idea how I can fix that error?

I'm going to be out of town until Saturday, but I can take a look at this when I get back. Do you get this same error when you use the example script from the first page of the guide? It could also be a problem with the particular ffmpeg revision since this is bleeding-edge and problems do show up once in a while.

dude1981
November 27th, 2008, 09:34 PM
I made an update of my installation like described at the first page and receive still the same error. When I run it like the example on the first page, I receive the same error...

Would be great if you can have a look on it. I'll be back on Sunday or Tuesday night...

FakeOutdoorsman
November 30th, 2008, 02:45 AM
I made an update of my installation like described at the first page and receive still the same error. When I run it like the example on the first page, I receive the same error...

Would be great if you can have a look on it. I'll be back on Sunday or Tuesday night...
Show your command and the full output of ffmpeg. Also show the output of:

dpkg -S $(readlink -f /usr/local/lib/libavcodec.so.52)

andrew.46
December 1st, 2008, 08:57 AM
Hi,

Hope you don't mind but I have duplicated your naming scheme for x264 on my svn MPlayer guide (http://ubuntuforums.org/showthread.php?t=558538). Works nicely and escapes all the repository overwriting problems. I have printed an acknowledgement and a link to your ffmpeg page.

All the very best,

Andrew

FakeOutdoorsman
December 1st, 2008, 08:44 PM
Thanks, Andrew, although I borrowed the date structure from your guide and the idea came from Ng some posts ago.

dude1981
December 2nd, 2008, 08:54 AM
Show your command and the full output of ffmpeg. Also show the output of:

dpkg -S $(readlink -f /usr/local/lib/libavcodec.so.52)


dpkg -S $(readlink -f /usr/local/lib/libavcodec.so.52)
dpkg: /usr/local/lib/libavcodec.so.52.3.0 not found.



ffmpeg -y -i input.mkv -pass 1 -b 512k -bt 512k -vcodec libx264 -an -threads 0 -coder 1 -flags +loop -cmp +chroma -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -me_method dia -subq 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -refs 1 -directpred 1 -bidir_refine 0 -trellis 0 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -f mp4 /dev/null
ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init

Thanks

ercdvs
December 3rd, 2008, 07:57 PM
dpkg -S $(readlink -f /usr/local/lib/libavcodec.so.52)
dpkg: /usr/local/lib/libavcodec.so.52.3.0 not found.



ffmpeg -y -i input.mkv -pass 1 -b 512k -bt 512k -vcodec libx264 -an -threads 0 -coder 1 -flags +loop -cmp +chroma -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -me_method dia -subq 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -refs 1 -directpred 1 -bidir_refine 0 -trellis 0 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -f mp4 /dev/null
ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init

Thanks

Call me stupid, but why are you recoding the h264 video again? mp4 containers should be able to take that video as is. I tried your command line and it seemed to work fine on my build:

FFmpeg version SVN-r15970, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --prefix=/usr --enable-gpl --enable-postproc --enable-swscale --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libxvid --enable-zlib --enable-libx264 --enable-libvorbis --enable-libtheora --enable-pthreads
libavutil 49.12. 0 / 49.12. 0
libavcodec 52. 5. 0 / 52. 5. 0
libavformat 52.23. 1 / 52.23. 1
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Dec 1 2008 10:08:55, gcc: 4.3.2

looking back, if you are running it with this command :
ffmpeg -i $1 -threads 1 -vcodec libx264 -sameq -b 5000k -acodec copy -r 24 output.avi

you might be crashing out for a few reasons.

What is the audio and video in the MKV? .avi might not support the audio you are trying to put in there. Especially since this command shows an .avi file output, and a format of mp4 in the last you posted.

The 2 most common audio formats in MKV are DTS and AC3 .. ac3 is not supported in an MP4 container (but it is in avi) .. FFMpeg is currently unable to transcode ac3 (or dts) to the proper AAC needed for mp4. Also the presence of b frames *really* screw up ffmpeg encoding. This, plus the fact that the channel mapping is usually wrong, caused me to 100% give up on FFMPEG for any mkv transcoding whatsoever.

akm3
December 7th, 2008, 12:29 AM
Hello,

Thanks for the great tutorial.

I have a very trivial question.
I hope that somebody can help me.

I want to compile, output_example.c in ffmpeg folder to test it and create a .mpg file.
How can I do it?
I've tried using "make" or "gcc", here is my results:



alireza@ubuntu:~/ffmpeg$ make output_example.c
make: Nothing to be done for `output_example.c'.




alireza@ubuntu:~/ffmpeg$ gcc -o output output_example.c
/tmp/ccqaXNi3.o: In function `add_audio_stream':
output_example.c:(.text+0x15): undefined reference to `av_new_stream'
/tmp/ccqaXNi3.o: In function `open_audio':
output_example.c:(.text+0xb4): undefined reference to `avcodec_find_encoder'
output_example.c:(.text+0x100): undefined reference to `avcodec_open'
output_example.c:(.text+0x1aa): undefined reference to `av_malloc'
output_example.c:(.text+0x221): undefined reference to `av_malloc'
/tmp/ccqaXNi3.o: In function `get_audio_frame':
output_example.c:(.text+0x24b): undefined reference to `sin'
/tmp/ccqaXNi3.o: In function `write_audio_frame':
output_example.c:(.text+0x2d9): undefined reference to `av_init_packet'
output_example.c:(.text+0x32c): undefined reference to `avcodec_encode_audio'
output_example.c:(.text+0x389): undefined reference to `av_rescale_q'
output_example.c:(.text+0x3ba): undefined reference to `av_write_frame'
/tmp/ccqaXNi3.o: In function `close_audio':
output_example.c:(.text+0x409): undefined reference to `avcodec_close'
output_example.c:(.text+0x416): undefined reference to `av_free'
output_example.c:(.text+0x423): undefined reference to `av_free'
/tmp/ccqaXNi3.o: In function `add_video_stream':
output_example.c:(.text+0x43e): undefined reference to `av_new_stream'
/tmp/ccqaXNi3.o: In function `alloc_picture':
output_example.c:(.text+0x58b): undefined reference to `avcodec_alloc_frame'
output_example.c:(.text+0x5b6): undefined reference to `avpicture_get_size'
output_example.c:(.text+0x5c4): undefined reference to `av_malloc'
output_example.c:(.text+0x5d8): undefined reference to `av_free'
output_example.c:(.text+0x608): undefined reference to `avpicture_fill'
/tmp/ccqaXNi3.o: In function `open_video':
output_example.c:(.text+0x633): undefined reference to `avcodec_find_encoder'
output_example.c:(.text+0x67f): undefined reference to `avcodec_open'
output_example.c:(.text+0x6e5): undefined reference to `av_malloc'
/tmp/ccqaXNi3.o: In function `write_video_frame':
output_example.c:(.text+0x95b): undefined reference to `sws_getContext'
output_example.c:(.text+0xa12): undefined reference to `sws_scale'
output_example.c:(.text+0xa5b): undefined reference to `av_init_packet'
output_example.c:(.text+0xa8d): undefined reference to `av_write_frame'
output_example.c:(.text+0xabd): undefined reference to `avcodec_encode_video'
output_example.c:(.text+0xad5): undefined reference to `av_init_packet'
output_example.c:(.text+0xb2f): undefined reference to `av_rescale_q'
output_example.c:(.text+0xb76): undefined reference to `av_write_frame'
/tmp/ccqaXNi3.o: In function `close_video':
output_example.c:(.text+0xbe2): undefined reference to `avcodec_close'
output_example.c:(.text+0xbf1): undefined reference to `av_free'
output_example.c:(.text+0xbfe): undefined reference to `av_free'
output_example.c:(.text+0xc16): undefined reference to `av_free'
output_example.c:(.text+0xc23): undefined reference to `av_free'
output_example.c:(.text+0xc30): undefined reference to `av_free'
/tmp/ccqaXNi3.o: In function `main':
output_example.c:(.text+0xc4b): undefined reference to `av_register_all'
output_example.c:(.text+0xca0): undefined reference to `guess_format'
output_example.c:(.text+0xcd1): undefined reference to `guess_format'
output_example.c:(.text+0xd10): undefined reference to `av_alloc_format_context'
output_example.c:(.text+0xddd): undefined reference to `av_set_parameters'
output_example.c:(.text+0xe34): undefined reference to `dump_format'
output_example.c:(.text+0xe8e): undefined reference to `url_fopen'
output_example.c:(.text+0xec6): undefined reference to `av_write_header'
output_example.c:(.text+0x1002): undefined reference to `av_write_trailer'
output_example.c:(.text+0x1023): undefined reference to `av_freep'
output_example.c:(.text+0x103a): undefined reference to `av_freep'
output_example.c:(.text+0x1066): undefined reference to `url_fclose'
output_example.c:(.text+0x1071): undefined reference to `av_free'
collect2: ld returned 1 exit status


Can anybody help me compile this in linux?
(I am using Ubuntu 8.1)

Thanks.

PS: I have installed all of the ffmpeg material according to the instructions in page 1 successfully

FakeOutdoorsman
December 7th, 2008, 02:25 AM
Hello,

Thanks for the great tutorial.

I have a very trivial question.
I hope that somebody can help me.

I want to compile, output_example.c in ffmpeg folder to test it and create a .mpg file.
How can I do it?


I got it to compile with:

cd ~/ffmpeg
make output_example
It then created "output_example" in the ffmpeg directory. I don't know how to actually use output_example though.

akm3
December 7th, 2008, 02:32 AM
I got it to compile with:

cd ~/ffmpeg
make output_example
It then created "output_example" in the ffmpeg directory. I don't know how to actually use output_example though.

Thanks,
It got compiled.
I think you should use it like this:


alireza@ubuntu:~/ffmpeg$ ./output_example test.mpg


it simply creates a file called "test.mpg"(or Whatever name and format you specify).I don't know if any other capabilities it has.

psychok9
December 11th, 2008, 06:07 AM
Thank you for your guide! Very nice!

ymark
December 14th, 2008, 06:40 PM
Hi all,

Please help me..i have an error after installing ffmpeg.

When i run ffmpeg i got ehis error :

"ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init"

and with : readlink -f /usr/local/lib/libavcodec.so.52
i got : /usr/local/lib/libavcodec.so.52.6.1

i checked and the "libavcodec.so.52.6.1" and "libavcodec.so.52" are there.

:-?


Thanks,
ymark

FakeOutdoorsman
December 15th, 2008, 06:12 AM
Hi all,

Please help me..i have an error after installing ffmpeg.

When i run ffmpeg i got ehis error :

"ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init"

and with : readlink -f /usr/local/lib/libavcodec.so.52
i got : /usr/local/lib/libavcodec.so.52.6.1

i checked and the "libavcodec.so.52.6.1" and "libavcodec.so.52" are there.

:-?


Thanks,
ymark
There is a conflict with a package, but I'm not totally sure which one it is (probably one of the libavcodecs). Give the output of:

dpkg --get-selections | grep libav

ymark
December 15th, 2008, 07:54 PM
I found the problem. Before compiling ffmpeg i installed mencoder.
i've compiled the latest mencoder.

I've installed a new virtual machine with ubuntu and installed first ffmpeg and after mencoder and both work! with h264 and win32dll enabled.



step 0: change repositoris to main server
step 1: sudo apt-get install subversion
---------------------instaling x264 for ffmpeg
step 2: sudo apt-get install git
step 3: sudo apt-get install git-core
step 4: git clone git://git.videolan.org/x264.git
step 5: sudo sh configure --enable-shared --disable-asm
step 6: sudo make install
---------------------installing FFMPEG from subversion
step 7: svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
step 8: sudo sh configure --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-shared --enable-libfaac --enable-libfaad --enable-gpl --enable-libtheora --enable-libx264
step 9: cd /etc/ld.so.conf.d
step 10: sudo pico custom-libs.conf
step 11: write "/usr/local/lib" in the file
step 12: sudo ldconfig
---------------------Instaling MENCODER from subversion
step 13: svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
step 14: sudo apt-get install libpng12-dev libjpeg62-dev
step 15: sudo sh configure --enable-win32dll
step 16: sudo make install
step 17: wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2
step 18: tar xjvf all-20061022.tar.bz2
step 19: sudo mkdir /usr/local/lib/codecs/
step 20: sudo cp /home/linux/mplayer/all-20061022/*.* /usr/local/lib/codecs/

and it works :D

andrew.46
December 15th, 2008, 08:28 PM
Hi ymark,



step 17: wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2

There is a newer codec pack available here:

http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2

Andrew

seenxu
December 18th, 2008, 01:11 PM
thx for the detailed tutorial.

andrew.46
December 21st, 2008, 12:21 PM
Hi fakeoutdoorsman,

A quick note to say thanks again for this great guide which I have used again in my re-installation o Intrepid Ibex!

As well a small suggestion that may or not have a place in your guide, but probably a more definite use in your own compiling and recompiling of ffmpeg. When I compile ffmpeg or MPlayer I make use of the -jobs feature of make to speed up the compiling process substantially. So instead of running:


./configure
make
sudo checkinstall

I run:


./configure
make --jobs=5
sudo checkinstall

This works well with ffmpeg and saves a huge amount of compiling time, although I have not set a stopwatch to it. I note that Patrick Volkerding of Slackware (my other distro) sets his compile scripts a little like this:


./configure
make --jobs=5 || make
sudo checkinstall

which is very safe as obviously if the --jobs=5 syntax fails for any reason a standard 'make' will occur. (a Boolean OR that executes the command on the right if the command on the left fails.)

Just a thought, feel free to ignore it :-).

Andrew

psychok9
December 21st, 2008, 05:18 PM
Can I improve ffmpeg/x264 efficiency for using my quadcore processor? On the 2nd pass I see 54% usage of cpu.

FakeOutdoorsman
December 21st, 2008, 10:08 PM
Hi fakeoutdoorsman,

A quick note to say thanks again for this great guide which I have used again in my re-installation o Intrepid Ibex!

As well a small suggestion that may or not have a place in your guide, but probably a more definite use in your own compiling and recompiling of ffmpeg. When I compile ffmpeg or MPlayer I make use of the -jobs feature of make to speed up the compiling process substantially. So instead of running:


./configure
make
sudo checkinstall

I run:


./configure
make --jobs=5
sudo checkinstall

This works well with ffmpeg and saves a huge amount of compiling time, although I have not set a stopwatch to it. I note that Patrick Volkerding of Slackware (my other distro) sets his compile scripts a little like this:


./configure
make --jobs=5 || make
sudo checkinstall

which is very safe as obviously if the --jobs=5 syntax fails for any reason a standard 'make' will occur. (a Boolean OR that executes the command on the right if the command on the left fails.)

Just a thought, feel free to ignore it :-).

Andrew
Thanks for the input, Andrew, and I'm glad you like the guide. I personally use "make -j2" for my P4 3GHz, but I never added it to the guide for the sake of simplicity, but it may be worth adding it to the guide especially for multi-core machines that can benefit better than my jalopy. It's just hard to choose a proper jobs=n for general use: for example j5 on my machine is slower than j2. Here are some unscientific tests I ran using the configuration options from the guide (with make distclean before each):

x264

time make
real 0m47.933s
user 0m46.304s
sys 0m1.340s

time make -j
real 0m43.182s
user 1m20.598s
sys 0m1.873s

time make -j2
real 0m43.113s
user 1m20.078s
sys 0m1.677s

time make -j4
real 0m43.868s
user 1m21.185s
sys 0m1.640s
ffmpeg

time make
real 6m32.515s
user 6m9.733s
sys 0m20.419s

time make -j 2
real 5m45.750s
user 10m16.073s
sys 0m25.642s

time make --jobs=5
real 6m6.996s
user 10m26.462s
sys 0m25.365s


Can I improve ffmpeg/x264 efficiency for using my quadcore processor? On the 2nd pass I see 54% usage of cpu.
Are you using "-threads 0" in your ffmpeg command? This tells ffmpeg to automatically choose the proper number of threads.

psychok9
December 22nd, 2008, 04:11 AM
Are you using "-threads 0" in your ffmpeg command? This tells ffmpeg to automatically choose the proper number of threads.

Yes.
I've tried -threads 0 and -threads 8.

FakeOutdoorsman
December 22nd, 2008, 05:16 AM
Yes.
I've tried -threads 0 and -threads 8.
My job here is done. Actually, this is beyond my experience because I have never used a quadcore CPU. You may want to join #ffmpeg or #x264 on IRC or ask this on the ffmpeg-user (http://ffmpeg.mplayerhq.hu/mailinglists.html) mailing list.

Dark Shikari
December 22nd, 2008, 07:37 AM
Can I improve ffmpeg/x264 efficiency for using my quadcore processor? On the 2nd pass I see 54% usage of cpu.What settings are you using?

It's possible to be bottlenecked by your decode speed if you're using very fast x264 settings. Also note that extremely fast x264 settings do limit the number of threads you can get away with, though probably not enough to justify your problem.

psychok9
December 22nd, 2008, 11:57 PM
What settings are you using?

It's possible to be bottlenecked by your decode speed if you're using very fast x264 settings. Also note that extremely fast x264 settings do limit the number of threads you can get away with, though probably not enough to justify your problem.

1st page settings:

#!/bin/bash
# Two-Pass x264 Encoding Script
# Usage: ./264encode.sh input output.mp4

# Pass 1
ffmpeg -y -i $1 -pass 1 -b 400k -bt 552k -vcodec libx264 -an -threads 0 -coder 1 -flags +loop -cmp +chroma -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -me_method dia -subq 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -refs 1 -directpred 1 -bidir_refine 0 -trellis 0 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -f mp4 /dev/null

# Pass 2
ffmpeg -y -i $1 -pass 2 -b 400k -bt 552k -vcodec libx264 -acodec libfaac -ab 128k -ac 2 -threads 0 -coder 1 -flags +loop -cmp +chroma -partitions +parti8x8+parti4x4+partp8x8+partb8x8 -me_method umh -subq 8 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -refs 4 -directpred 3 -trellis 1 -flags2 +bpyramid+wpred+mixed_refs+dct8x8+fastpskip -f mp4 $2

Ng Oon-Ee
December 26th, 2008, 06:48 AM
Hey, I recently tried to install OpenCV, specifically libcv-dev, libcvaux-dev, and libhighgui-dev. They depend on libavcodec-dev, libavformat-dev, libavutil-dev, which clashes with ffmpeg as I've compiled following this guide.

So, I get these errors:-

E: /var/cache/apt/archives/libavutil-dev_3%3a0.svn20080206-12ubuntu3_amd64.deb: trying to overwrite `/usr/lib/pkgconfig/libavutil.pc', which is also in package ffmpeg
E: /var/cache/apt/archives/libavcodec-dev_3%3a0.svn20080206-12ubuntu3_amd64.deb: trying to overwrite `/usr/lib/pkgconfig/libavcodec.pc', which is also in package ffmpeg
E: /var/cache/apt/archives/libavformat-dev_3%3a0.svn20080206-12ubuntu3_amd64.deb: trying to overwrite `/usr/lib/pkgconfig/libavformat.pc', which is also in package ffmpeg

Any way I can tell the package to simply reuse what's available? Or do I need to recompile OpenCV itself from source?

Ng Oon-Ee
December 27th, 2008, 02:01 AM
Hey, I recently tried to install OpenCV, specifically libcv-dev, libcvaux-dev, and libhighgui-dev. They depend on libavcodec-dev, libavformat-dev, libavutil-dev, which clashes with ffmpeg as I've compiled following this guide.

So, I get these errors:-

E: /var/cache/apt/archives/libavutil-dev_3%3a0.svn20080206-12ubuntu3_amd64.deb: trying to overwrite `/usr/lib/pkgconfig/libavutil.pc', which is also in package ffmpeg
E: /var/cache/apt/archives/libavcodec-dev_3%3a0.svn20080206-12ubuntu3_amd64.deb: trying to overwrite `/usr/lib/pkgconfig/libavcodec.pc', which is also in package ffmpeg
E: /var/cache/apt/archives/libavformat-dev_3%3a0.svn20080206-12ubuntu3_amd64.deb: trying to overwrite `/usr/lib/pkgconfig/libavformat.pc', which is also in package ffmpeg

Any way I can tell the package to simply reuse what's available? Or do I need to recompile OpenCV itself from source?
In answer to my own question, I discovered that the ffmpeg executable that's built within ~/ffmpeg in this guide is fully useable even without being installed. That saves me a lot of headache dealing with the packaging system and all, only difference being I have to call the ffmpeg executable directly (I could also symlink into /usr/bin I guess).

philc
January 10th, 2009, 02:54 PM
Using ffmpeg and x264
The easiest method for high quality video encoding is by using the ffmpeg presets that are included with the source code. First copy the presets to your home folder. This will create a folder that may be hidden in your file manager because it is preceded with a period. Use "ls -al" in the terminal or "ctrl + h" in Nautilus to view the folder if it is hidden.

mkdir ~/.ffmpeg
Now copy the presets to the folder you just created:

cp ~/ffmpeg/ffpresets/* ~/.ffmpeg
Now you can use the presets. This example uses the fastfirstpass and hq presets for a two-pass encode:

ffmpeg -y -i input.avi -pass 1 -vcodec libx264 -vpre fastfirstpass -s 640x480 -b 512k -bt 512k -threads 0 -bf 16 -f mp4 -an /dev/null && ffmpeg -i input.avi -pass 2 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -s 640x480 -b 512k -bt 512k -threads 0 -f mp4 output.mp4
You will have to add -bf 16 to your first-pass command or bf=16 to ~/.ffmpeg/libx264-fastfirstpass.ffpreset when used with the normal, max, and hq presets.


I also had to add -bf 16 to my second pass command when using the presets, or FFMpeg exists with an error that the second pass is using a different number of B Frames - 4 vs 16 in the the first pass.

FakeOutdoorsman
January 10th, 2009, 09:38 PM
I also had to add -bf 16 to my second pass command when using the presets, or FFMpeg exists with an error that the second pass is using a different number of B Frames - 4 vs 16 in the the first pass.
Thanks for the update. The presets were modified (http://svn.mplayerhq.hu/ffmpeg/trunk/ffpresets/libx264-hq.ffpreset?view=log) three days ago to:

Be consistent and use b-frames throughout the presets to avoid confusion about whether they have to be specified in the first pass as well.
All of the non-lossless presets, including fastfirstpass, now use -bf 4. I have updated the guide. In addition, new lossless presets have been added, but I haven't used these yet. Has anyone tried lossless x264 encoding yet?

Kinetic^
January 11th, 2009, 11:35 AM
"ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init"

I'm also getting this error. :confused:

The output of


dpkg --get-selections | grep libavis


libavahi-client3 install
libavahi-common-data install
libavahi-common3 install
libavahi-compat-libdnssd1 install
libavahi-core5 install
libavahi-glib1 install
libavahi-gobject0 install
libavahi-ui0 install
libavc1394-0 install
libavcodec-unstripped-51 install
libavcodec51 deinstall
libavdevice-unstripped-52 install
libavformat-unstripped-52 install
libavformat52 deinstall
libavutil-unstripped-49 install
libavutil49 deinstall

Any help would be appreciated. Thanks.

tsh
January 11th, 2009, 02:24 PM
Following this guide on 8.10, I don't seem to get a .so file for libx264. I have /usr/lib/libx264.a but that's all.

FakeOutdoorsman
January 12th, 2009, 03:30 AM
I'm also getting this error. :confused:

...

Any help would be appreciated. Thanks.

You have one or several packages that are conflicting with the compiled ffmpeg. Try removing them:

sudo apt-get purge libavcodec-unstripped-51 libavdevice-unstripped-52 libavformat-unstripped-52 libavutil-unstripped-49

Following this guide on 8.10, I don't seem to get a .so file for libx264. I have /usr/lib/libx264.a but that's all.
Did you use ./configure --enable-shared for x264? It should install as:

/usr/local/lib/libx264.so.65

FakeOutdoorsman
January 17th, 2009, 09:15 PM
Install FFmpeg and x264 on Ubuntu Dapper Drake 6.06 LTS.

Dapper is unsupported and this guide will not be updated.

1. Make sure the Ubuntu universe and multiverse repositories are enabled. For help doing this, refer to Adding the Universe and Multiverse Repositories (https://help.ubuntu.com/community/Repositories/Ubuntu#head-5bbef89639d9a7d93fe38f6356dc17847d373096) on the Ubuntu Wiki.

2. Uninstall x264-bin, libx264-dev, and ffmpeg if they are already installed. Open a terminal and run the following:

sudo apt-get remove ffmpeg x264-bin libx264-dev

3. Next, get all of the packages you will need to install ffmpeg and x264:

sudo apt-get update
sudo apt-get install build-essential subversion git-core checkinstall texi2html libfaac-dev libsdl1.2-dev libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev


4. Install yasm:

cd
wget http://www.tortall.net/projects/yasm/releases/yasm-1.1.0.tar.gz
tar xzvf yasm-1.1.0.tar.gz
cd yasm-1.1.0
./configure
make
sudo checkinstall --pkgname=yasm --pkgversion "1.1.0" --backup=no --default

5. Install x264:

cd
git clone git://git.videolan.org/x264.git
cd ~/x264
./configure
make
sudo checkinstall --pkgversion "1:0.cvs`date +%Y%m%d`-0.0ubuntu1" --default

6. Install libopencore-amr. This will allow you to decode and encode AMR audio:

cd
wget http://transact.dl.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz
tar xvf opencore-amr-0.1.2.tar.gz
cd opencore-amr-0.1.2
./configure -disable-shared
make
sudo checkinstall --pkgname="libopencore-amr" --pkgversion="0.1.2" --backup=no --default

7. Install libtheora to encode to Theora, the video type usually found in OGG files. The repository libtheora is too old, so it must be compiled. Alternatively, you could skip this step and omit --enable-libtheora in step 8 if you don't plan on encoding to Theora video:

sudo apt-get install libogg-dev
cd
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --disable-shared
make
sudo checkinstall --pkgname=libtheora --pkgversion "1.1.1" --backup=no --default

8. Install ffmpeg:


cd
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ~/ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
make
sudo checkinstall --pkgversion "3:0.cvs`date +%Y%m%d`-5ubuntu1.2" --default
hash x264 ffmpeg
That's it! Now head back to the FFmpeg guide (http://ubuntuforums.org/showthread.php?t=786095) for usage instructions and more.

To Revert Changes Made by This Guide

sudo apt-get remove build-essential subversion git-core checkinstall texi2html libfaac-dev libopencore-amr libsdl1.2-dev libtheora libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev x264 ffmpeg

WinterWeaver
January 18th, 2009, 11:30 PM
I followed your guide to get ffmpeg. Everything is working as it should, except that I dont have PNG codec anymore. I used to use ffmpeg to create a thumbnail of a movie, and save it as mpeg, but now I get a error.


ffmpeg -y -i /home/andre/Projects/ask/ask/ask.media/videos/IT_Pro.wmv -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320x240 /home/andre/Projects/ask/ask/ask.media/videos/flv/test.pngFfmpeg resulting output:

FFmpeg version SVN-r16661, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
libavutil 49.13. 0 / 49.13. 0
libavcodec 52.11. 0 / 52.11. 0
libavformat 52.24. 1 / 52.24. 1
libavdevice 52. 1. 0 / 52. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
built on Jan 17 2009 23:46:11, gcc: 4.3.2
[wmv3 @ 0xa476130]Extra data: 8 bits left, value: 0

Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 15.00 (15/1)
Input #0, asf, from '/home/andre/Projects/ask/ask/ask.media/videos/IT_Pro.wmv':
Duration: 00:02:35.84, start: 5.000000, bitrate: 154 kb/s
Stream #0.0: Audio: wmav2, 16000 Hz, mono, s16, 16 kb/s
Stream #0.1: Video: wmv3, yuv420p, 320x240, 134 kb/s, 15.00 tb(r)
Unknown encoder 'png'I tried to see if maybe the name chaned with the new version and did:

$ ffmpeg -formats | grep png
FFmpeg version SVN-r16661, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
libavutil 49.13. 0 / 49.13. 0
libavcodec 52.11. 0 / 52.11. 0
libavformat 52.24. 1 / 52.24. 1
libavdevice 52. 1. 0 / 52. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
built on Jan 17 2009 23:46:11, gcc: 4.3.2.... as you can see with no result

Manually digging through the -formats output, and I didn't find anything related to png.

Do you perhaps know what the issue is here?

EDIT: sorry forgot to say, I'm running 8.10 32-bit on Macbook 4,1

Thanks,
WW

FakeOutdoorsman
January 20th, 2009, 02:13 AM
Do you perhaps know what the issue is here?
You need to install the zlib1g-dev package then reinstall ffmpeg:

sudo apt-get purge ffmpeg
cd ~/ffmpeg
make distclean
svn up
./configure --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
make
sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3"
This will enable the following encoders/decoders: camtasia, dxa, flashsv, png, zlib, zmbv. I will add this to the guide.

WinterWeaver
January 20th, 2009, 04:16 AM
GREAT! That works :)

Thank a million!

Too bad the thanks feature is not working on the forum atm :(

andrew.46
January 21st, 2009, 12:11 AM
Hi,

Just a quick question out of my own ignorance concerning aac playback with the ffmpeg / ffplay. I don't compile ffmpeg against libfaad-dev, as suggested in your guide, simply because MPLayer uses its own internal faad and it complicates things by having libfaad-dev on my system. (MPlayer has an 'opt-out' system rather than ffmpeg's 'opt-in'.) I do compile against libfaac-dev however and I have no trouble with either playback from or encoding to aac. Formats shows:


andrew@skamandros:~$ ffmpeg -formats | grep -i aac
FFmpeg version SVN-r16683, Copyright (c) 2000-2009 Fabrice Bellard, et al.

configuration: --disable-debug --enable-shared --disable-static
--enable-postproc --enable-avfilter --enable-pthreads --enable-libtheora
--enable-libvorbis --enable-swscale --enable-x11grab --enable-libmp3lame
--enable-libxvid --enable-libx264 --enable-libschroedinger
--enable-libfaac --enable-libamr-wb --enable-libamr-nb --enable-libspeex
--enable-libgsm --enable-nonfree --enable-gpl
libavutil 49.14. 0 / 49.14. 0
libavcodec 52.11. 0 / 52.11. 0
libavformat 52.24. 1 / 52.24. 1
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 2. 0 / 0. 2. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Jan 19 2009 12:03:54, gcc: 4.3.2
D aac ADTS AAC
E adts ADTS AAC
D A aac Advanced Audio Coding
EA libfaac libfaac AAC (Advanced Audio Codec)


I assume that these represent the aac decoder of ffmpeg which I believe was added in August 2008? So I guess my question, which may not have an easy answer, is 'am I short-changing myself by not compiling against libfaad-dev, or is it actually not necessary now with ffmpeg's implementation?'. Every compiling guide for ffmpeg around still shows compilation against faad... I could very well be missing something basic here, if so my apologies.

Andrew

FakeOutdoorsman
January 21st, 2009, 01:49 AM
I assume that these represent the aac decoder of ffmpeg which I believe was added in August 2008? So I guess my question, which may not have an easy answer, is 'am I short-changing myself by not compiling against libfaad-dev, or is it actually not necessary now with ffmpeg's implementation?'. Every compiling guide for ffmpeg around still shows compilation against faad... I could very well be missing something basic here, if so my apologies.

Andrew
You are correct that ffmpeg now has an internal aac decoder, and for most purposes this makes libfaad unnecessary. So you're not missing much unless you need to decode AAC-HE. You'll need libfaad for that. When or if ffmpeg can decode AAC-HE natively, support for libfaad will probably be dropped.

andrew.46
January 21st, 2009, 07:15 AM
Hi FakeOutdoorsman,


You are correct that ffmpeg now has an internal aac decoder, and for most purposes this makes libfaad unnecessary. So you're not missing much unless you need to decode AAC-HE. You'll need libfaad for that. When or if ffmpeg can decode AAC-HE natively, support for libfaad will probably be dropped.

Thank you very much for clarifying that.

Andrew

andrew.46
January 21st, 2009, 10:12 PM
Hi FakeOutdoorsman,

I owe you a special thanks! Your guide here on the Ubuntu forums woke me to the value of ffmpeg and the x264 presets in particular. I have subsequently successfully submitted an update to the Slackbuilds.org ffmpeg installation script (http://slackbuilds.org/repository/12.2/multimedia/ffmpeg/) so the presets will now be incorporated in a Slackware install:

http://slackbuilds.org/slackbuilds/12.2/multimedia/ffmpeg/ffmpeg.SlackBuild

Very nice to have my name under 2 of Slackware's heavyweights :-). Thanks for the steer towards ffmpeg and the amazing presets!

Andrew (Strong)

FakeOutdoorsman
January 22nd, 2009, 02:52 AM
Glad to hear that this has helped other distros too. I actually do most of my work in Arch Linux and use something similar to the SlackBuilds. I use VirtualBox for Ubuntu testing.

HalNineThousand
January 22nd, 2009, 05:07 PM
In the past few days I've read through all 30 pages of this thread, hoping that I would not be duplicating any questions. It hasn't been easy! Actually, after going through all that, I'm confused on a few points so I need clarification on a lot of questions. I hope everyone will bear with me and help me follow all this.

1) Missing codecs: There's been discussion about Medibuntu and the possibilities of an uncrippled FFmpeg in there, but that there is not one available for Intrepid (although there is one for Hardy). From what I gather from the bug in launchpad (https://bugs.launchpad.net/medibuntu/+bug/291011), supposedly once you install the unstripped libraries, all the codecs are there, just with different names (what this accomplishes, other than to fsck up a lot of programs and settings, I have yet to find out). I partially verified this when I created an MP2 mpg file with MP3 audio using the libmp3lame codec. (This was the first time I created an MP2 file with any sound at all!) So it appears the codecs are there, but renamed or replaced with (supposedly) compatible ones in some cases. Is this correct? (I left a comment on that bug report that replacing the codecs with others breaks many programs that use FFmpeg and even some parts of FFmpeg itself, such as the "-target DVD" option that seems to need the mp3 codec that's been replaced with libmp3lame.)

2) I'm using a quad-core 64 bit system. From comments earlier, if I try to follow the instructions here to compile FFmpeg and x264, I'm wondering if I might run into problems due to the 64 bit architecture. Is that true?

3) I saw that Mocha was talking about replacing files or creating alternate files, which would eliminate the need for removing the existing packages on your system. I'm not clear on the current standing. Is it possible, in some way, to create a "shadow" install by compiling so we have the new features but don't have to worry about apt's upgrades?

4) I'm worried about packages dependent on FFmpeg and I'm still not clear how that is handled. I know if I remove FFmpeg and x264, that other packages will be removed by apt as well. Then if I compile my own FFmpeg and x264, do I reinstall all those packages? I'm not clear if the compile and make process creates .deb files that are then installed or if it just places the files in the appropriate directory. This leads to a couple concerns that have been brought up, but which I'm not clear about: A) Are the repository packages replaced by ones we create?, and B) If we use apt and not aptitude, is there any way to keep FFmpeg out of the upgrade cycle so it's not replaced along the way and we don't keep getting notices of it needing an upgrade?

5) Has anyone considered creating an independent repository with FFmpeg and x264 packaged for Intrepid (or/also for Hardy and possibly others)? If so, is there a way to specify which repository we get a particular package from? That would provide packaged versions that could be upgraded as needed and would eliminate issues with upgrading packages. If someone has an idea of how much that would cost to create such an archive, I'd be interesting in discussing contributing towards what it would take to host such a repository.

6) The man page on FFmpeg is quite short on 2 pass encoding. Just what are the benefits of this? It looks like, from the man page, it just breaks up the task in 2 parts. How does it improve quality?

Thanks for your patience with all these questions! I know some of this has been discussed, but it's hard to keep straight what is settled and what isn't after 30 pages of details!

FakeOutdoorsman
January 22nd, 2009, 10:35 PM
I'm supposed to be working on some videos for a film festival that starts tonight, so I'll just answer a few of these and then get back to you after the weekend:



1) Missing codecs
The difference in codec names have caused a number of issues. The developers of ffmpeg made the name changes. Older ffmpeg revisions use simpler names such as aac and mp3, and newer revisions use libfaac and libmp3lame. My guess is that this was done to differentiate between ffmpegs de/en-coders and external ones like libmp3lame.

The option "-target DVD" doesn't work for me, but "-target dvd" does. This option should use mpeg2video and ac3 audio by default.


2) I'm using a quad-core 64 bit system. From comments earlier, if I try to follow the instructions here to compile FFmpeg and x264, I'm wondering if I might run into problems due to the 64 bit architecture. Is that true?
I can't test this, but I've been told that this guide worked on a few 64-bit systems without issues. I'm not much help here.


3) I saw that Mocha was talking about replacing files or creating alternate files, which would eliminate the need for removing the existing packages on your system. I'm not clear on the current standing. Is it possible, in some way, to create a "shadow" install by compiling so we have the new features but don't have to worry about apt's upgrades?
You shouldn't worry about your package manager upgrading your self-compiled ffmpeg and x264 anymore because the guide now loosely follows the Ubuntu package naming conventions. In an earlier version of this guide you would have to lock your packages or give them a different name to prevent "upgrades", but that introduced other problems.


4) I'm worried about packages dependent on FFmpeg and I'm still not clear how that is handled. I know if I remove FFmpeg and x264, that other packages will be removed by apt as well. Then if I compile my own FFmpeg and x264, do I reinstall all those packages? I'm not clear if the compile and make process creates .deb files that are then installed or if it just places the files in the appropriate directory.
This guide uses checkinstall to create a .deb file and the appropriate entry in your package manager which leads to a cleaner and safer (un/in)stallation process.

This leads to a couple concerns that have been brought up, but which I'm not clear about: A) Are the repository packages replaced by ones we create?
It is advised to remove the repository ffmpeg, x264, and libx264-dev packages before installing your own to prevent conflicts. Your version is effectively replacing the repository versions, but it can be removed in the same way as regular repository package. There are ways to install both the repository package and a self-compiled package, but I haven't tried that.


6) The man page on FFmpeg is quite short on 2 pass encoding. Just what are the benefits of this? It looks like, from the man page, it just breaks up the task in 2 parts. How does it improve quality?
The first pass creates a stats file about the input video that the second pass reads from so the encoder has a better idea of what to expect. It is advised to either use two-pass or one-pass CRF when encoding with libx264. In my opinion they both look good but have different purposes. Use two pass if you want to specify a bitrate, and thus a specific file size for your output video. Use one-pass CRF if you want to specify a quality level and don't really care about what the final size is. One-pass is faster, but that doesn't mean two-pass is twice as slow, especially if you use the fastfirstpass preset for your first pass.

HalNineThousand
January 23rd, 2009, 06:56 AM
Well, I had a carefully written reply that responded to every point and I have no idea where it went, but it didn't post. So, in short:

- I used "-target dvd", with lower case, but wasn't getting sound. I realized the mistake was mine: I was using VLC. I have no idea what VLC's problem is, but when I play .mts files, I get video and no audio. It should have occurred to me that I could have the same issue with .mpg files: VLC is making a mistake. So I used "-target dvd" again and this time played it in another viewer. Yes. Video and audio. Problem solved -- and user made irate! If this issue weren't an issue in VLC, then I would have been happy with what I was getting 2 days ago! I seriously think Ubuntu has really messed up a lot of things with the way they've set up FFmpeg and the codecs.

- Thanks for clarifying the package and upgrade info. I was foggy on that, but now realize I had read your tutorial and THEN read the thread, so I was reading about problems that had already been solved!

And if I haven't said it, THANK YOU for all your time in not only creating the tutorial, but for keeping it up to date and for all your help with all of us who have been asking all these questions!

kevdog
January 23rd, 2009, 07:50 AM
Sure would be nice to provide an automation script for updating the packages (an unattended uninstall/install script) :)

FakeOutdoorsman
January 23rd, 2009, 08:18 AM
And if I haven't said it, THANK YOU for all your time in not only creating the tutorial, but for keeping it up to date and for all your help with all of us who have been asking all these questions!
Ok, I'm back from the festival and I only have to fix two videos. I'm happy the guide has been useful. I started it as notes to myself because I was tired of not knowing how to encode properly (you can thank Adobe Premiere for being such a horrible encoding tool). I'm still learning as you probably noticed from reading those 30 pages. If you really want to learn a particular program or procedure then I recommend writing a howto guide on these forums.

Sure would be nice to provide an automation script for updating the packages (an unattended uninstall/install script) :)
I did use something like this for testing this guide on Dapper recently and it would be nice for a zealous recompiler like me. Basically the "Updating Your Installation" section in script form, but it requires user input for checkinstall. I didn't spend much time in figuring out how to pass on the data to checkinstall, such as the package description. I also think it's good to observe the upgrade process as this is the bleeding-edge and can have occasional issues.

andrew.46
January 23rd, 2009, 10:38 AM
Hi,


Basically the "Updating Your Installation" section in script form, but it requires user input for checkinstall. I didn't spend much time in figuring out how to pass on the data to checkinstall, such as the package description. I also think it's good to observe the upgrade process as this is the bleeding-edge and can have occasional issues.

Can I echo the thanks of several others here? Maintaining an ffmpeg guide under Ubuntu is a great ask, not the least because of the different versions of ffmpeg available to Ubuntu users and the Ubuntu policy of stripping out some functionality.

I use an installation script myself for updating but it is highly idiosyncratic and covers x264, ffmpeg and the svn MPlayer. In case somebody can use aspects of it I include it here. Particularly idiosyncratic is:


I run the script with sudo and alter permissions after the installation
I add the documentation for ffmpeg and MPlayer to my Desktop
I run checkinstall unattended by using --default
I clean out the checkinstall mess from the svn tree and also delete the backups




#!/bin/sh

################################################## ####################
# Updater script for x264, ffmpeg and MPlayer #
################################################## ####################

set -e

# ------------------------------------------------------------------ #
# Update the x264 Libraries #
# git clone git://git.videolan.org/x264.git #
# ------------------------------------------------------------------ #

cd $HOME/x264
git pull
./configure --prefix=/usr --enable-shared
make
sudo checkinstall -D --pkgname=x264 --fstrans=no --pakdir "$HOME/Desktop" \
--maintainer "$USER" --pkgversion "1:0.svn`date +%Y%m%d`-0.0ubuntu1" --backup=no \
--deldoc=yes --deldesc=yes --delspec=yes --default
make clean

#----> Adjust permissions of the svn tree:
chown -R andrew:users $HOME/x264

# ------------------------------------------------------------------ #
# Update the ffmpeg Libraries #
# svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg #
# ------------------------------------------------------------------ #

cd $HOME/ffmpeg
svn update
./configure \
--disable-debug \
--enable-shared \
--disable-static \
--enable-postproc \
--enable-avfilter \
--enable-pthreads \
--enable-libtheora \
--enable-libvorbis \
--enable-swscale \
--enable-x11grab \
--enable-libmp3lame \
--enable-libxvid \
--enable-libx264 \
--enable-libschroedinger \
--enable-libfaac \
--enable-libfaad \
--enable-libamr-wb \
--enable-libamr-nb \
--enable-libspeex \
--enable-libgsm \
--enable-zlib \
--enable-nonfree \
--enable-gpl
make
sudo checkinstall -D --pkgname=ffmpeg --fstrans=no --pakdir "$HOME/Desktop" \
--maintainer "$USER" --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3" --backup=no \
--deldoc=yes --deldesc=yes --delspec=yes --default
make clean

# ---> ffmpeg docs to the front:
if [ -d /home/andrew/Desktop/ffmpeg_docs ]; then
echo 'Already there numbnuts!!'
else
mkdir -pv /home/andrew/Desktop/ffmpeg_docs
fi

cp /usr/share/doc/ffmpeg/doc/*.html /home/andrew/Desktop/ffmpeg_docs/
chown -R andrew:users /home/andrew/Desktop/ffmpeg_docs

#----> Adjust svn tree permissions
chown -R andrew:users $HOME/ffmpeg

# ------------------------------------------------------------------ #
# Update the svn MPlayer and Docs #
# svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer #
# ------------------------------------------------------------------ #

cd $HOME/mplayer
if [ -e version.h ]; then
rm version.h
fi

svn update
./configure
#--> Build the html docs <--#
cd DOCS/xml
./configure
make html-single-en
cd ../../
#--> Return to MPlayer <--#
make
sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/Desktop" \
--maintainer "$USER" --pkgname mplayer --pkgversion "3:1.0~svn" \
--backup=no --deldoc=yes --deldesc=yes --delspec=yes --gzman --default
make clean

# ---> MPlayer docs to the front:

if [ -d /home/andrew/Desktop/mplayer_docs ]; then
echo 'Already there numbnuts!!'
else
mkdir -pv /home/andrew/Desktop/mplayer_docs
fi

cd $HOME/mplayer/DOCS/
cp -v HTML-single/en/MPlayer.html HTML-single/en/default.css tech/*.txt \
$HOME/Desktop/mplayer_docs/
chown -R andrew:users /home/andrew/Desktop/mplayer_docs/

# -------> Adjust permissions for the svn MPlayer tree:
chown -R andrew:users $HOME/mplayer

# ------------------------ Clean Up ------------------------------- #

cd $HOME/Desktop
rm mplayer_3:1.0~svn-1_i386.deb x264_1:0.svn`date +%Y%m%d`-0.0ubuntu1-1_i386.deb \
ffmpeg_3:0.svn`date +%Y%m%d`-12ubuntu3-1_i386.deb

But I certainly agree that a 'manual' installation can be safest, although the 'set -e' catches errors. Of course I have chosen a few different options for x264 and ffmpeg than are given in the guide and for the svn MPlayer I have an extra section that generates the docs but the general idea is clear.

Andrew

mocha
January 23rd, 2009, 07:49 PM
3) I saw that Mocha was talking about replacing files or creating alternate files, which would eliminate the need for removing the existing packages on your system. I'm not clear on the current standing. Is it possible, in some way, to create a "shadow" install by compiling so we have the new features but don't have to worry about apt's upgrades?


I don't do things the "Debian" way, I do things the hack way to make the installation simpler for myself because I tend to install a lot of software from source to get newer or hacked versions. If you install ffmpeg from the Ubuntu repository the binary is located at /usr/bin/ffmpeg. If you then compile and install your own it goes to /usr/local/bin/ffmpeg and when you run ffmpeg it will always run the /usr/local version, binaries in /usr/local always take priority over /usr. So what I do is rename /usr/bin/ffmpeg to something else like /usr/bin/ffmpeg.old, then I symlink /usr/local/bin/ffmpeg to /usr/bin/ffmpeg, just in case any ffmpeg frontends are pointing to /usr/bin/ffmpeg.

andrew.46
January 29th, 2009, 06:26 AM
Hi,

I am hoping you have some ideas on a subject I will admit that I have also posted to ffmpeg-users. I am encoding from a DVD rip, exporting the audio file and altering it. I encode the video with 2 pass h264 presets and a syntax drawn mostly from your excellent guide. The commandline I use is:

First Pass:



ffmpeg -i blues.vob -croptop 12 -cropbottom 12 -s 512x288 -pass 1 \
-vcodec libx264 -vpre fastfirstpass -aspect 16:9 -b 512k -bt 512k \
-threads 0 -f mp4 -an /dev/null


Second Pass:



ffmpeg -i blues.vob -i sound_vol.wav -map 0:0 -map 1:0 -croptop 12 -cropbottom 12 \
-s 512x288 -pass 2 -acodec libfaac -alang eng -ab 128k -ac 2 \
-vcodec libx264 -vpre hq -b 512k -bt 512k -threads 0 -f mp4 output.mp4


The final file is perfect on my computer but gives one warning and one (und)efined, which I have made bold and red below:



andrew@skamandros~/Desktop/blues$ ffmpeg -i output.mp4
FFmpeg version SVN-r16768, Copyright (c) 2000-2009 Fabrice Bellard, et al.

configuration: --prefix=/usr --mandir=/usr/man --disable-debug
--enable-shared --disable-static --enable-postproc --enable-avfilter
--enable-pthreads --enable-libtheora --enable-libvorbis --enable-swscale
--enable-x11grab --enable-libmp3lame --enable-libxvid --enable-libx264
--enable-libschroedinger --enable-libfaac --enable-libfaad
--enable-libamr-wb --enable-libamr-nb --enable-libgsm
--enable-nonfree --enable-gpl
libavutil 49.14. 0 / 49.14. 0
libavcodec 52.11. 0 / 52.11. 0
libavformat 52.25. 0 / 52.25. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 2. 0 / 0. 2. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Jan 25 2009 21:59:20, gcc: 4.2.4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8066b60]edit list not starting at 0,
a/v desync might occur, patch welcome
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
Duration: 00:05:28.20, start: 0.000000, bitrate: 646 kb/s
Stream #0.0(und): Video: h264, yuv420p, 512x288, 25.00 tb(r)
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16
At least one output file must be specified

There is no av sync problem, and as you can see I have 'defined' the audio stream with '-alang eng' but I have no idea how to 'define' the video stream or what this definition should comprise. I am more than a little curious about the a/v sync error warning as well.

Any thoughts? Please forgive me for also asking on the ffmpeg-users :-).

Andrew

FakeOutdoorsman
January 29th, 2009, 08:31 PM
Any thoughts? Please forgive me for also asking on the ffmpeg-users :-).

Andrew
Good question. I get the same message, but so far I haven't had any sync issues. Hopefully someone more knowledgeable than me will give an answer on ffmpeg-user.

Halfwalker
February 16th, 2009, 01:38 AM
A couple of issues with the debian packages under Ubuntu 8.10 x64 ...

It looks like the ffmpeg package provides the libraries for libavutil and libswscale. The problem is that those libs are normally provided by the standard packages :

libavutil49 and libswscale0

The chain gets long and ugly, especially if you want some of the other video manipulation packages. For example, if you want the mjpegtools package, you get hosed.

mjpegtools
--> libquicktime1
--> --> libavcodec51
--> --> --> libavutil49 and libswscale0

How can one build the ffmpeg package such that it "provides" libavutil49 and libswscale49, and whatever other ones it conflicts with ? Using the --provides parameter to checkinstall doesn't seem to work. It will only take one package name OK, but upon installing mjpegtools after installing ffmpeg, it will wants to install that package.

Here's the process I'm using ...

sudo apt-get -y purge ffmpeg libavcodec-dev libavutil49
cd ~/src
mkdir ffmpeg
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --prefix=/usr --disable-debug --enable-shared --disable-static --enable-postproc --enable-avfilter --enable-pthreads --enable-libtheora --enable-libvorbis --enable-swscale --enable-x11grab --enable-libmp3lame --enable-libxvid --enable-libx264 --enable-libschroedinger --enable-libfaac --enable-libfaad --enable-libamr-wb --enable-libamr-nb --enable-libspeex --enable-libgsm --enable-zlib --enable-nonfree --enable-gpl
make --jobs=5
sudo mkdir /usr/local/lib/pkgconfig
sudo mkdir /usr/include/libavdevice
sudo mkdir /usr/include/libavformat
sudo mkdir /usr/include/libavcodec
sudo mkdir /usr/include/libavutil
sudo mkdir /usr/lib/vhook
sudo mkdir /usr/include/libpostproc
sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3"
mkdir ~/.ffmpeg
cp ~/src/ffmpeg/ffpresets/* ~/.ffmpeg

D.

Edit: packagename typo and more info
Edit: Show process

FakeOutdoorsman
February 18th, 2009, 11:23 PM
I compiled svn FFmpeg and then installed mjpegtools and it's dependencies. FFmpeg seemed to work fine with libswscale0, libavutil49, and libavcodec51 from the repository, but I didn't do extensive testing. I also didn't test mjpegtools since I'm ignorant of it's usage.

Halfwalker
February 19th, 2009, 02:59 AM
I compiled svn FFmpeg and then installed mjpegtools and it's dependencies. FFmpeg seemed to work fine with libswscale0, libavutil49, and libavcodec51 from the repository, but I didn't do extensive testing. I also didn't test mjpegtools since I'm ignorant of it's usage.

Did you use the configure line I had above ? Note, it has --enable-swscale in it - that can be removed. But that still leaves us with the libavutil49 and libavcodec51 dependencies.

Here is the full sequence of command I did on a clean Ubuntu Intrepid x64 install (Virtualbox VM actually). This is after all updates have been applied, but no other packages have been installed.

Set up for building the packages

sudo apt-get update
sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libtheora-dev libxvidcore4-dev libgpac-dev libgpac0.4.4

Additional libraries and codecs

sudo apt-get install libsdl1.2-dev zlib1g-dev libfaad-dev libfaac-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore4-dev libschroedinger-dev libspeex-dev libgsm1-dev libamrnb3 libamrnb-dev libamrwb3 libamrwb-dev

Install most recent x264 from the official git repository

sudo apt-get -y purge x264 libx264-dev libx264-59
cd ~/
mkdir src
cd ~/src
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-pthread --enable-mp4-output --enable-shared --prefix=/usr
make --jobs=5
sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-0.0ubuntu1"
sudo ldconfig

Install most recent ffmpeg from official svn repository

sudo apt-get -y purge ffmpeg libavcodec-dev libavutil49
cd ~/src
mkdir ffmpeg
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --prefix=/usr --disable-debug --enable-shared --disable-static --enable-postproc --enable-avfilter --enable-pthreads --enable-libtheora --enable-libvorbis --enable-x11grab --enable-libmp3lame --enable-libxvid --enable-libx264 --enable-libschroedinger --enable-libfaac --enable-libfaad --enable-libamr-wb --enable-libamr-nb --enable-libspeex --enable-libgsm --enable-zlib --enable-nonfree --enable-gpl

make --jobs=5
sudo mkdir /usr/local/lib/pkgconfig
sudo mkdir /usr/include/libavdevice
sudo mkdir /usr/include/libavformat
sudo mkdir /usr/include/libavcodec
sudo mkdir /usr/include/libavutil
sudo mkdir /usr/lib/vhook
sudo mkdir /usr/include/libpostproc
sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3"
mkdir ~/.ffmpeg
cp ~/src/ffmpeg/ffpresets/* ~/.ffmpeg


Then try to install mjpegtools ...

sudo apt-get install mjpegtools
results in this ...

The following NEW packages will be installed:
libavcodec51 libavutil49 libmjpegtools0c2a libquicktime1 libswscale0
mjpegtools
:
Unpacking libavutil49 (from .../libavutil49_3%3a0.svn20080206-12ubuntu3_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/libavutil49_3%3a0.svn20080206-12ubuntu3_amd64.deb (--unpack):
trying to overwrite `/usr/lib/libavutil.so.49', which is also in package ffmpeg

You can see the problem with libavutil49 - the library is installed with th new ffmpeg package we built. That's something we want - that version is quite a bit newer than the stock one. libavcodec51 installed fine, so I'm not sure what the problem was earlier.

We need some way to have the ffmpeg package also provide at least the libavutil49 package as far as apt/dpkg is concerned. So when you try to install mjpegtools, it will see that libavutil49 is already installed.

D.

Halfwalker
February 19th, 2009, 03:43 AM
OK, I have a workaround ...

First we have to temporarily modify the /usr/bin/checkinstall script ...
Add the line "Replaces: libavutil49, libswscale0, libavcodec51" in the section at line 2406


cat << EOF >> $BUILD_DIR/DEBIAN/control
Package: $PKG_BASENAME
Priority: extra
Section: $PKG_GROUP
Installed-Size: `du -s $BUILD_DIR | awk '{print $1}'`
Maintainer: $MAINTAINER
Architecture: $ARCHITECTURE
Version: ${VERSION}-${RELEASE}
Depends: $REQUIRES
Provides: $PROVIDES
Replaces: libavutil49, libswscale0, libavcodec51
Description: $SUMMARY
EOF
Then do the regular sudo checkinstall command, and once done, remove the added line from the script. Now the libavutil49/libswscale0/libavcodec51 packages will install cleanly without complaining or overwriting our new library files.

D.

rkleemann
February 19th, 2009, 06:12 PM
Hi,

I followed this howto and it worked very well for me, thanks!

I do have a related question... I have the standard VLC installed, but I'm not sure if it's using the latest ffmpeg that I just built. The libavcodec libraries went into /usr/local/lib, and I do also have /usr/lib/libavcodec.so.1d.51.38.0 in my system (as well as /usr/local/lib/libavcodec.so.51.56.0).

How can I have VLC use the correct library?

Also, would it be best if I recompile VLC? Is there a similar HOWTO for that?

Ricardo

FakeOutdoorsman
February 20th, 2009, 12:06 AM
OK, I have a workaround ...

First we have to temporarily modify the /usr/bin/checkinstall script ...
Add the line "Replaces: libavutil49, libswscale0, libavcodec51" in the section at line 2406


cat << EOF >> $BUILD_DIR/DEBIAN/control
Package: $PKG_BASENAME
Priority: extra
Section: $PKG_GROUP
Installed-Size: `du -s $BUILD_DIR | awk '{print $1}'`
Maintainer: $MAINTAINER
Architecture: $ARCHITECTURE
Version: ${VERSION}-${RELEASE}
Depends: $REQUIRES
Provides: $PROVIDES
Replaces: libavutil49, libswscale0, libavcodec51
Description: $SUMMARY
EOF
Then do the regular sudo checkinstall command, and once done, remove the added line from the script. Now the libavutil49/libswscale0/libavcodec51 packages will install cleanly without complaining or overwriting our new library files.

D.
I don't mess around with Ubuntu packaging often since it's not my primary distro, so I don't really know much about checkinstall and just leech ideas from andrew.46. I'm glad you found a way around it, although it would be nice to see a "--replaces" option in checkinstall for more advanced / adventurous users.

Another option is to remove "--enable-shared" from the FFmpeg configure line. This will let mjpegtools bring in the lib-whatevers from the repo, although I assume you went through all this trouble to get the recent lib(sw|av)*s.

A second option would be to compile mjpegtools to use the svn FFmpeg provided libraries.

A third option is to use a distro like Arch or Slackware that has a customizable ports-like build system that nicely integrates into the packaging system. Very nice.

I wish I knew more about having the Ubuntu packaging system recognize what FFmpeg provides because this has come up a few times and I don't have an easy answer.

psychok9
February 20th, 2009, 10:37 PM
Andrew your work is very appreciated by me.
I'm trying to adapt your great script for auto-update x264, ffmpeg and mplayer... :)
Sorry for my OT, but with this tool (ffmpeg/x264) can we make m4a/aac audio files?
Thank you!

FakeOutdoorsman
February 21st, 2009, 12:04 AM
can we make m4a/aac audio files?
Here's a simple way to make aac audio files:

ffmpeg -i input.foo -ab 196k output.aac
or m4a:

ffmpeg -i input.foo -ab 196k -vn output.m4a
Adjust the bitrate (-ab) as necessary.

andrew.46
February 21st, 2009, 12:12 AM
Hi psychok9,


Andrew your work is very appreciated by me.
I'm trying to adapt your great script for auto-update x264, ffmpeg and mplayer... :)

Well this whole thread is the work of FakeOutdoorsman of course; he is responsible for my own introduction to FFmpeg for which I will always be grateful. That rather rough little script could definitely use some polishing and as the FakeOutdoorsman has mentioned there can be breakages in compilation with both MPlayer and FFmpeg that might tempt you to perform the whole process manually. I don't have an Ubuntu installation at the moment but on my other distro I update all three one at a time with similar scripts and this perhaps might be a better approach?


Sorry for my OT, but with this tool (ffmpeg/x264) can we make m4a/aac audio files?

This is a question of course for the FakeOutdoorsman :-).

Andrew

psychok9
February 21st, 2009, 03:59 PM
Here's a simple way to make aac audio files:

ffmpeg -i input.foo -ab 196k output.aac
or m4a:

ffmpeg -i input.foo -ab 196k -vn output.m4a
Adjust the bitrate (-ab) as necessary.

Thank you for your answer!
I found WinFF gui and with your command, I can make AAC, but is AAC-LC... not HE-AAC :( It seems ffmpeg doesn't support Aac Plus.

FakeOutdoorsman
February 21st, 2009, 08:34 PM
I think neroaacenc (http://www.nero.com/eng/technologies-aac-codec.html) may be the best choice for Linux HE-AAC encoding. Others include enhAacPlusEnc (http://dgaapenc.berlios.de/en/) and mp4tools (http://teknoraver.net/software/mp4tools/), but I never heard of these until today.

To install neroAacEnc:

wget ftp://ftp6.nero.com/tools/NeroDigitalAudio.zip
unzip NeroDigitalAudio.zip -d nero
cd nero/linux
sudo install -D -m755 neroAacEnc /usr/local/bin

Usage example:

neroAacEnc -if input.wav -of output.mp4
Usage information can be found in the included readme.txt.

psychok9
February 21st, 2009, 09:41 PM
Thanks! The quality it's a great!
You know if exist a GUI/frontend for automate the conversion of all/selected files?
I've tried -if *.mp3 -of *.mp4 but don't work on Linux (maybe need other symbol/commands for operate on multiple files?).

IT:
@andrew
I've downloaded last svn smplayer, and now work correctly with my custom mplayer svn :)
I've found an problem only on the line
cp /usr/share/doc/ffmpeg/doc/*.html /home/gianluca/Desktop/ffmpeg_docs/
And i don't know why (i've only txt files on this directory).

andrew.46
February 21st, 2009, 11:58 PM
Hi psychok9



@andrew
I've downloaded last svn smplayer, and now work correctly with my custom mplayer svn :)
I've found an problem only on the line
cp /usr/share/doc/ffmpeg/doc/*.html /home/gianluca/Desktop/ffmpeg_docs/
And i don't know why (i've only txt files on this directory).

I suspect you have missed a small part of the FakeOutdoorsman's guide which installs texi2html. FFmpeg uses this to generate the html docs. Have a look at this thread where I was banging my head against a wall with this one:

http://www.linuxquestions.org/questions/slackware-14/svn-ffmpeg-no-man-file-623007/

Different problem on this thread but same idea :-).

Andrew

akm3
February 23rd, 2009, 05:41 AM
Hi,

I am using Ubuntu 8.1
I do the instructions to have ffmpeg along with all the shared libraries mentioend, but for some strange reason I have not the executable for ffplay.
Can anybody help?

FakeOutdoorsman
February 23rd, 2009, 07:13 AM
Hi,

I am using Ubuntu 8.1
I do the instructions to have ffmpeg along with all the shared libraries mentioend, but for some strange reason I have not the executable for ffplay.
Can anybody help?
The libsdl1.2-dev package is a required dependency for FFplay. Did you install it before compiling FFmpeg? From the instructions:

libsdl1.2-dev: Required for FFplay, a simple media player using the FFmpeg libraries and the SDL library.

amtriorix
February 24th, 2009, 11:30 PM
Thank You very much for this howto.

Do You known how I can transcode AVC / AAC ( H.264 ) files with FFmpeg ?

Mediainfo gives this:

----------------------
Video

Format : AVC

Format/Info : Advanced Video Codec

Format profile : Baseline@L3.0

Format settings, CABAC : No

Format settings, ReFrames : 1 frame

Muxing mode : Container profile=Unknown@3.0

Duration : 23mn 4s

Bit rate : 288 Kbps

Width : 544 pixels

Height : 308 pixels

Display aspect ratio : 16/9

Frame rate : 25.000 fps

Resolution : 24 bits

Colorimetry : 4:2:0

Scan type : Progressive

Bits/(Pixel*Frame) : 0.069

Stream size : 47.5 MiB (80%)



Audio

Format : AAC

Format/Info : Advanced Audio Codec

Format version : Version 4

Format profile : LC

Format settings, SBR : No

Duration : 23mn 4s

Bit rate : 64.3 Kbps

Channel(s) : 2 channels

Channel positions : L R

Sampling rate : 22.05 KHz

Resolution : 16 bits

Stream size : 10.6 MiB (18%)

----------------------

It does play in Kafeinne, but Avidemux fails, VLC player, etc.



So I did this
ffmpeg -i input.flv test1.mov
ffmpeg -i input.flv test2.mp4
ffmpeg -i input.flv test2.swf

Works well, so I can edit them.

However I do see this error ?:

[aac @ 0x28b6ed0]SSR not implemented.

FakeOutdoorsman
February 24th, 2009, 11:37 PM
Thank You very much for this howto.

Do You known how I can transcode AVC / AAC ( H.264 ) files with FFmpeg ?
...
It does play in Kafeinne, but Avidemux fails, VLC player, etc.

I don't understand what you are trying to do. What errors does Avidemux and VLC give you? What FFmpeg commands are you using?

amtriorix
February 25th, 2009, 12:11 AM
I don't understand what you are trying to do. What errors does Avidemux and VLC give you? What FFmpeg commands are you using?

Yes.
I found this:
http://www.drizweb.com/content/encoding-and-transcoding-ffmpeg

So I did this:
ffmpeg -i input.flv test1.mov
ffmpeg -i input.flv test2.mp4
ffmpeg -i input.flv test2.swf

Works well, so I can edit them...

Q1) However I do see this error ?

[aac @ 0x28b6ed0]SSR not implemented ?!

Q2) It seems ffmpeg is not limited to transcoding of video but audio too.

Would this be a better option to transcode to lossless audio ?
I saw rubyripper as linux alternative for Exact Audio Copy.
http://wiki.hydrogenaudio.org/index.php?title=Rubyripper

To store Your own music, You need that cdparanoia error correcting power (what's a name)
As lossless compression in flac, ape or ... ? What's the best anyway ? aac lossless ? Wavepack ?

However if this can be done quickly by ffmpeg...

FakeOutdoorsman
February 25th, 2009, 03:54 AM
Q1) However I do see this error ?

[aac @ 0x28b6ed0]SSR not implemented ?!
Paste your FFmpeg command that give you this error and paste the complete FFmpeg output.


Q2) It seems ffmpeg is not limited to transcoding of video but audio too.

Would this be a better option to transcode to lossless audio ?
I saw rubyripper as linux alternative for Exact Audio Copy.
http://wiki.hydrogenaudio.org/index.php?title=Rubyripper

To store Your own music, You need that cdparanoia error correcting power (what's a name)
As lossless compression in flac, ape or ... ? What's the best anyway ? aac lossless ? Wavepack ?

However if this can be done quickly by ffmpeg...
Rubyripper is used to rip a CD. I have only used FLAC for lossless audio and it works fine for me. I personally use abcde to rip CDs:
abcde: Command Line Music CD Ripping for Linux (http://www.andrews-corner.org/abcde.html)

Naegling23
March 2nd, 2009, 02:00 AM
im stuck in dependency heck

Im trying to install via the first post, but Im getting a dependency error:

The following packages have unmet dependencies:
libmp3lame-dev: Depends: libmp3lame0 (= 3.98-0.0) but 3.98.2-0.0 is to be installed
libxvidcore4-dev: Depends: libxvidcore4 (= 2:1.1.2-0.1ubuntu3) but 2:1.1.3-0.5 is to be installed


any help?

FakeOutdoorsman
March 2nd, 2009, 09:44 PM
im stuck in dependency heck

Im trying to install via the first post, but Im getting a dependency error:

The following packages have unmet dependencies:
libmp3lame-dev: Depends: libmp3lame0 (= 3.98-0.0) but 3.98.2-0.0 is to be installed
libxvidcore4-dev: Depends: libxvidcore4 (= 2:1.1.2-0.1ubuntu3) but 2:1.1.3-0.5 is to be installed


any help?
I've never seen this error before. Are you using 8.10 Intrepid Ibex? How is it attempting to install more recent versions of these packages than what is in the repository? Did you add any third party repositories?

Paste the response of this command:

cat /etc/apt/sources.list

Anyone else have an idea? Ubuntu package management isn't a strong point for me.

jjalan
March 2nd, 2009, 11:24 PM
I installed the ffmpeg and x264 as mentioned without any error. To make sure, I execute ffmpeg from command line and I get the following message:

FFmpeg version SVN-r17737, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 0 / 52.20. 0
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
built on Mar 2 2009 16:18:47, gcc: 4.3.2

I am trying to compile the C code tutorial01.c located at http://www.dranger.com/ffmpeg/tutorial01.html
Before executing this code, I change the code to include the header file as:

#include <libavcodec/avcodec.h>
#include <libavformcat/avformat.h>

The command to execute is :
gcc -o tutorial01 -lavutil -lavformat -lavcodec tutorial01.c


/tmp/cc2pAZbY.o: In function `main':
tutorial01.c:(.text+0x110): undefined reference to `av_register_all'
tutorial01.c:(.text+0x142): undefined reference to `av_open_input_file'
and many more

But I keep on getting the above errors. I am trying this for quite sometime now but I am still not able to find any solution. I tried all the solution for example, wrapping the library in extern "C" etc. Any help will be very much appreciated. I understand that somehow it is not able to link the library but I dont understand whats going wrong.

FakeOutdoorsman
March 3rd, 2009, 12:45 AM
I'm not going to be much help here. The tutorial01.c code is almost two years old and is probably too outdated to use with SVN FFmepg. Development is active and there have been many changes. Did you contact the author and request an update? His email address is in the code. The only clue I can give you is that you misspelled libavformat:

#include <libavformcat/avformat.h>

jjalan
March 3rd, 2009, 01:29 AM
Thanks for pointing that out. That was a typo, I corrected it and it still give the same error. I will try contacting the author. Somehow I thought it was more of a linking problem because the code compiled just fine. It was giving the error when I was trying to link the library.

Do you have any pointer to new sample code?

mc4man
March 3rd, 2009, 04:08 AM
libmp3lame-dev: Depends: libmp3lame0 (= 3.98-0.0) but 3.98.2-0.0 is to be installed
libxvidcore4-dev: Depends: libxvidcore4 (= 2:1.1.2-0.1ubuntu3) but 2:1.1.3-0.5 is to be installed

Those are debian-multimedia (testing) packages. One revision back from current

qyot27
March 5th, 2009, 09:22 AM
Thanks for the guide, it allowed me to build x264 without a hitch. However, I prefer to have MP4 output support via GPAC in x264 itself, rather than use MP4Box after-the-fact. To compile in support for that, this worked wonders (copy and pasted from a guide I wrote up for my own purposes).


Download, compile, and install zlib. zlib is required for building GPAC, which provides the MP4 output support in x264.

wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar -zxf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
sudo make install

Download, compile, and install GPAC 0.4.5. Once again, you'll only need to do this once (although feasibly when GPAC updates it might be a good idea; the reason I don't suggest this for zlib is because, well, it hasn't been updated since 2005).

wget http://superb-east.dl.sourceforge.net/sourceforge/gpac/gpac-0.4.5.tar.gz
wget http://voxel.dl.sourceforge.net/sourceforge/gpac/gpac_extra_libs-0.4.5.tar.gz
tar -zxf gpac-0.4.5.tar.gz
tar -zxf gpac_extra_libs-0.4.5.tar.gz
cd gpac_extra_libs
cp -r * ../gpac/extra_lib
cd ../gpac
chmod +x configure
./configure --disable-opengl --use-js=no --use-ft=no --use-jpeg=no --use-png=no --use-faad=no --use-mad=no --use-xvid=no --use-ffmpeg=no --use-ogg=no --use-vorbis=no --use-theora=no --use-openjpeg=no
make lib
make apps
sudo make install-lib
sudo make install
sudo cp bin/gcc/libgpac.so /usr/lib
(The string of disables I used with the configure step is a result of my paranoia about getting GPAC to build. The only ones indicated on the help forum over at Sourceforge as needing to be disabled were opengl, jpeg, and png. However, since what I put down above worked, then I don't mind. If I get confirmation on how the others don't affect the build process, I'll amend that step. But until then, I'd just rather not take the chance)

Also, to be able to retain framerate and resolution information (which is pertinent for MP4 or MKV output - it also means not having to declare them), this is necessary:

mkfifo input.y4m
x264 input.y4m <options> | mplayer -nosound -vo yuv4mpeg:file=input.y4m inputfile
(note: I have SMplayer installed, just in case that makes a difference)

I've only tested all this on 8.10, but it works on both x86 and AMD64 versions.

A blurb about applying patches to the source would also be nice. Most current custom builds I've seen include the hrd pulldown and win_zone_parse patches, but there could be others that're relevant. Seems patch -p1 <file.diff is what's necessary to do it, per this post:
http://forum.doom9.org/showthread.php?p=1157901#post1157901

FakeOutdoorsman
March 6th, 2009, 04:16 AM
qyot27,

Thanks for the input. Did you try installing zlib1g-dev from the repository instead of compiling it? The package from the repository is up to date. I used to have gpac as a dependency for this guide, but I removed it since I didn't think it was necessary.

I may add a sentence about the patches, but I want to keep things simple.

fishyboy
March 7th, 2009, 03:44 PM
Thanks for the guide. I'm using Ubuntu 8.10 and the installation seemed to work without any problems. However, I now get an encoding error where I didn't before, and I was wondering if anyone else has seen it. I'm trying to encode a DVD vob file to an xvid avi (I haven't got around to using the x264 stuff yet!).


ffmpeg -i VTS_01_3.VOB -vcodec libxvid -f avi -vtag XVID -s 320x128 -b 300k
-acodec libmp3lame -ar 44100 -ab 16k -ac 2 -vsync 0 -async 1 out.avi

I know for sure that the above worked with the ffmpeg I had previously from the Medibuntu repos. The error I now get from ffmpeg is:


[libxvid @ 0xa340f50]error, non monotone timestamps 20 >= 20
av_interleaved_write_frame(): Error while opening file

This error occurs only for one of the vobs, but still, it didn't occur before I upgraded ffmpeg. I have found some workarounds, and it might be that my original command was wrong?

The first workaround is to use 'vsync 1' instead of 'vsync 0' (or omitting the vsync option altogether). I only used 'vsync 0' for historical reasons, i.e. I copied it from somewhere. I've yet to find an explanation of the ffmpeg vsync option that I understand:


ffmpeg -i VTS_01_3.VOB -vcodec libxvid -f avi -vtag XVID -s 320x128 -b 300k
-acodec libmp3lame -ar 44100 -ab 16k -ac 2 -vsync 1 -async 1 out.avi

Another thing that avoids the error is to skip the start of the file using '-ss 0.001', which is not ideal because I want all of it:


ffmpeg -i VTS_01_3.VOB -ss 0.001 -vcodec libxvid -f avi -vtag XVID -s 320x128 -b 300k
-acodec libmp3lame -ar 44100 -ab 16k -ac 2 -vsync 0 -async 1 out.avi

Here's some ffmpeg output for those of you that can find problems hidden within gobbledygook:


FFmpeg version SVN-r17855, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac
--enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.21. 0 / 52.21. 0
libavformat 52.31. 1 / 52.31. 1
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Mar 6 2009 19:14:35, gcc: 4.3.2

I'd usually put this down to my source file being nonsense, but in this case I know it worked before.

Has anyone got any suggestions? Is ffmpeg broken? Is vsync useful?

Thanks in advance.

pedrotuga
March 8th, 2009, 03:57 AM
I hope I don't break the discussion. Just a quick question, aren't there meta-packages for this anywhere?

FakeOutdoorsman
March 9th, 2009, 12:30 AM
The error I now get from ffmpeg is:

[libxvid @ 0xa340f50]error, non monotone timestamps 20 >= 20
av_interleaved_write_frame(): Error while opening file
I was unable to duplicate this problem. Can you make a sample of the offending VOB available? This will copy the first 10 seconds:

ffmpeg -i VTS_01_3.VOB -acodec copy -vcodec copy -t 10 test.vob
I've never used async or vsync (and I don't use libxvid anymore). From man ffmpeg:

-vsync parameter
Video sync method. Video will be stretched/squeezed to match the timestamps, it is done by duplicating and dropping frames. With -map you can select from which stream the timestamps should be taken. You can leave either video or audio unchanged and sync the remaining stream(s) to the unchanged one.

-async samples_per_second
Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, the parameter is the maximum samples per second by
which the audio is changed. -async 1 is a special case where only the start of the audio stream is corrected without any later correction.
I don't totally understand that. More info:
[Ffmpeg-user] How does -vsync work ? (http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2007-September/011421.html)
[Ffmpeg-user] problem with seek to given time position (http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2007-July/009892.html)

Has anyone got any suggestions?
1. Try a simpler command:

ffmpeg -i VTS_01_3.VOB -vcodec libxvid -f avi -s 320x128 -b 300k -acodec libmp3lame out.avi
2. Try FFmpeg's mpeg4 encoder:

ffmpeg -i VTS_01_3.VOB -vcodec mpeg4 -vtag XVID -f avi -s 320x128 -b 300k -acodec libmp3lame out.avi
3. Use the libx264 presets as mentioned in the tutorial. Example:

ffmpeg -i VTS_01_3.VOB -vcodec libx264 -s 320x128 -crf 30 -acodec libfaac -ab 96k -threads 0 -vpre hq out.mp4
4. You could try to compile the latest Xvid yourself since the version in the repo is outdated.

FakeOutdoorsman
March 9th, 2009, 12:43 AM
I hope I don't break the discussion. Just a quick question, aren't there meta-packages for this anywhere?
There are some unofficial deb files available:

Up to date FFmpeg xvid and x264 builds ppa (http://ubuntuforums.org/showthread.php?t=1084588)

Might be more convenient for some users, but you will be at the mercy of someone else configuring FFmpeg for you. They are untested by me. Use at your own risk.

andrew.46
March 10th, 2009, 06:35 AM
Hi FakeOutdoorsman,

Woooo hoooooooooo FFmpeg release is out!! Will this figure in your guide or will you stick with svn?

Andrew

FakeOutdoorsman
March 10th, 2009, 05:35 PM
Hi FakeOutdoorsman,

Woooo hoooooooooo FFmpeg release is out!! Will this figure in your guide or will you stick with svn?

Andrew
Hi Andrew,

I think the most recent development code will always be the way to go for FFmpeg, but I may add a little section mentioning FFmpeg 0.5 for those who insist on "stable" releases. I want to keep the guide as simple as I can, but I, and Linux users in general, like to have many choices.

cor2y
March 10th, 2009, 06:25 PM
With this modern stable release, do you think it will make it into the repos for intrepid etc?
Hopefully it will be jaunty but what about current earlier distros of ubuntu, do you think it will be added?

FakeOutdoorsman
March 10th, 2009, 06:35 PM
With this modern stable release, do you think it will make it into the repos for intrepid etc?
Hopefully it will be jaunty but what about current earlier distros of ubuntu, do you think it will be added?
I don't know much about how Ubuntu updates or backports earlier releases. It also may not make it into Jaunty because it would require a feature freeze exception. Here's a bug report with more info:

Bug #340303: Please sync with upstream release of ffmpeg .5 (https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/340303)

qyot27
March 10th, 2009, 07:24 PM
qyot27,

Thanks for the input. Did you try installing zlib1g-dev from the repository instead of compiling it? The package from the repository is up to date. I used to have gpac as a dependency for this guide, but I removed it since I didn't think it was necessary.

I may add a sentence about the patches, but I want to keep things simple.
My memory is rather sketchy on it, but I do seem to remember that GPAC wouldn't build against zlib1g-dev and that I had to use the package from zlib.net (basically I only make mental notes on what works rather than what doesn't, except in outstanding cases, so I could be wrong here). In general though I only include GPAC in my builds to be as holistic as possible (and because, way back - as in, two or three years - in x264's development, I remember there were problems with the MKV output, so to be able to pass correct fps and res info directly from the input file to the output, MP4 was necessary; I'm sure that it's fixed now, but old habits die hard). If there was an OS-native way to build in AVIS support on Linux I'd probably do that too. At the very least, though, piping in the video from mplayer secures that the info is retained, even with MKV. It eliminates complaints that the video isn't in sync with the audio, since MP4Box defaults to a framerate of 25fps if no value is explicitly declared.

On the patches, I'm honestly not sure what the win_zone_parse_fix patch does, but I know that the HRD/Pulldown patch is necessary for creating streams that're compliant with Blu-ray (and possibly HD-DVD, although I'm not sure). It'll be important if anyone wants to correctly author standard discs for those players.


Also, concerning checkinstall, is there a way to read the revision number from the x264 sources/binary and include that in the created package's statistics?

cor2y
March 11th, 2009, 06:19 AM
Theres a bug in the intrepid release that relates to a parsing issue.
Fixes recommended are using the cvs version of gpac or fix listed on launchpad

https://bugs.launchpad.net/ubuntu/+source/gpac/+bug/273075

talen9
March 11th, 2009, 11:59 AM
Also, concerning checkinstall, is there a way to read the revision number from the x264 sources/binary and include that in the created package's statistics?

Yep, there it is:


sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn-$(grep X264_VERSION config.h | cut -d' ' -f 4)-0.0ubuntu1" --default

This gets you a nice package file named (for the architecture of my machine and to the current date):


x264_1:0.svn-r1127-0.0ubuntu1-1_amd64.deb

It's not a very nice and readable line of code, but I think it respects the KISS principle for writing tutorials :)

bodark
March 11th, 2009, 09:41 PM
Hey all I am having a problem getting fuppes to compile the error message I get is this when I attempt the checkinstall:


gcc -shared .libs/libmetadata_libavformat_la-metadata_libavformat.o -L/usr/local/lib -lavformat -
Wl,-soname -Wl,libmetadata_libavformat.so.0 -o .libs/libmetadata_libavformat.so.0.0.0
/usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `aac_demuxer
' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavformat.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [libmetadata_libavformat.la] Error 1
make[1]: Leaving directory `/home/smiller/fuppes/src/plugins'
make: *** [install-recursive] Error 1

**** Installation failed. Aborting package creation.

Cleaning up...OK

Bye.


This is revision 634 on Hardy with AMD Phenom 2 processor. I have tried recompiling and re-installing ffmpeg andall its dependancies, since I found a post on the fuppes forum suggesting that.

Also I am curious why I am missing the mysql dependancy:


SUMMARY

audio transcoding enabled

encoder:
lame : yes
twolame : yes
wav : yes
pcm : yes
decoder:
vorbis : yes (libvorbisfile)
mpc : yes
flac : yes
faad : yes (aac/mp4/m4a)
mad : yes (mpeg Layer I, II & III)

video transcoding plugins
ffmpeg : enabled

image conversion/rescaling plugins
ImageMagick: enabled (Wand C-API)

metadata extraction plugins
taglib : enabled (mp3, ogg, flac & mpc metadata extraction)
ImageMagick : enabled (Wand C-API)
Exiv2 : enabled
libavformat : enabled
mpeg4ip/mp4v2 : enabled (mp4/m4a metadata extraction)

miscellaneous
iconv : enabled (charset conversion)
uuid : enabled
mysql : disabled

Thanks for using fuppes


even though I have sqlite3 and sqlite3-dev installed.

my configure is this:


./configure --enable-gnome-panel-applet --prefix=/usr --enable-video-transcoding

and my ffmpeg configure is this:


./configure --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --
enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-
libxvid

If there is any other information I am missing please let me know.

Thanks in advance!

Edit: Also here is my ffmpeg --version info:


smiller@MilServ:~/ffmpeg$ ffmpeg --version
FFmpeg version SVN-r17933, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
libavutil 50. 0. 0 / 50. 0. 0
libavcodec 52.21. 0 / 52.21. 0
libavformat 52.31. 1 / 52.31. 1
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Mar 11 2009 02:13:36, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
ffmpeg: missing argument for option '--version'

fishyboy
March 12th, 2009, 12:02 AM
Thanks for the reply. Unfortunately I've had to revert to the previous ffmpeg from the medibuntu repos, because this new one was seg-faulting on another file (mp4 with H.264/MPEG-4 AAC audio) and I had things I really had to finish. The seg-fault occurred while converting to a xvid/avi as before - the medibuntu ffmpeg worked fine.

If I get time I'll reinstall the latest ffmpeg again and give your suggestions a try. I can make the start of the VOB available if there's somewhere I can put it? Of course that would assume the error would still occur for the truncated version. In my original problem, the error occurred immediately, whereas my latest seg-fault problem occurred near the end of the encoding process.

Thanks again for your feedback.

FakeOutdoorsman
March 12th, 2009, 02:34 AM
Hey all I am having a problem getting fuppes to compile...
I've never used FUPPES and actually had to look up FUPPES to see what it is. Looks like you got FFmpeg to install correctly, but I can't help you with FUPPES. Perhaps this will help you:

Compiling FUPPES on Ubuntu Linux (http://fuppes.ulrich-voelkel.de/wiki/index.php?title=Compiling_on_Ubuntu_Linux)

bodark
March 12th, 2009, 06:57 AM
I've never used FUPPES and actually had to look up FUPPES to see what it is. Looks like you got FFmpeg to install correctly, but I can't help you with FUPPES. Perhaps this will help you:

Compiling FUPPES on Ubuntu Linux (http://fuppes.ulrich-voelkel.de/wiki/index.php?title=Compiling_on_Ubuntu_Linux)

I am still curious about the FFMpeg insall. The reason is due to some oddities I see during the compile and when I do sh ffmpeg --version

During the compile I see a lot of lines that look like this:


libswscale/yuv2rgb.c:639: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:640: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:641: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:673: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:674: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:675: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type


and the ffmpeg --version gives me this:


FFmpeg version SVN-r17944, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enabl
e-libtheora --enable-libx264 --enable-libxvid
libavutil 50. 0. 0 / 50. 0. 0
libavcodec 52.21. 0 / 52.21. 0
libavformat 52.31. 1 / 52.31. 1
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Mar 12 2009 00:20:24, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
ffmpeg: missing argument for option '--version'


Any idea why I am getting this?

ffmpeg: missing argument for option '--version'


How else can I verify the insallation or what else should I do to test to provide the information that would best help you , help me :)

Edit: figured out the version thing...I had an extra '-' and not sure where I picked it up but I just kept doing it.

brunods
March 12th, 2009, 07:40 AM
Hey I ran the tutorial exactly as it is and I'm getting this error:



brunods@maxwell:~/Projects/audiovideo/film_psyke$ ffmpeg -r 30 -b 4800K -s 1280x800 -i %05d.jpg -vcodec libx264 test.avi
ffmpeg: error while loading shared libraries: libx264.so.67: cannot open shared object file: No such file or directory




could anyone help me? thanks

qyot27
March 12th, 2009, 02:52 PM
Yep, there it is:


sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn-$(grep X264_VERSION config.h | cut -d' ' -f 4)-0.0ubuntu1" --default

This gets you a nice package file named (for the architecture of my machine and to the current date):


x264_1:0.svn-r1127-0.0ubuntu1-1_amd64.deb

It's not a very nice and readable line of code, but I think it respects the KISS principle for writing tutorials :)
Thanks, that worked great.

FakeOutdoorsman
March 13th, 2009, 02:17 AM
Hey I ran the tutorial exactly as it is and I'm getting this error:



brunods@maxwell:~/Projects/audiovideo/film_psyke$ ffmpeg -r 30 -b 4800K -s 1280x800 -i %05d.jpg -vcodec libx264 test.avi
ffmpeg: error while loading shared libraries: libx264.so.67: cannot open shared object file: No such file or directory




could anyone help me? thanks
You probably forgot to run "sudo ldconfig". Once you do that FFmpeg should be able to find the shared libraries for x264.

Actually, --enable-shared in x264 is not a requirement for FFmpeg and x264 to work together. You may get a very small improvement in encoding quality, and perhaps negligible faster encoding if you leave out --enable-shared, but I added it so this guide would work well with Andrew's series of HowTo: Install the very latest MPlayer under Jaunty Jackalope (http://ubuntuforums.org/showthread.php?t=1081070) and [Howto] Install the svn Mplayer under Intrepid Ibex (http://ubuntuforums.org/showthread.php?t=1024592).

FakeOutdoorsman
March 13th, 2009, 02:19 AM
During the compile I see a lot of lines that look like this:

libswscale/yuv2rgb.c:639: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:640: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:641: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:673: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:674: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:675: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type


I don't think you have to worry about any warnings as long as FFmpeg compiles, installs, and runs successfully.

piratec
March 18th, 2009, 05:10 PM
Yay! This is still up and running good :) I have a nice Ubuntu 64 installed on my new c2d machine and I will need to compile ffmpeg on it. Good work and thx!

HolyRoses
March 19th, 2009, 03:22 PM
anyone notice that like -artist and -title options are now gone from SVN? Anyone know if that is a bug or if it is supposed to be coming back?

-HR

FakeOutdoorsman
March 19th, 2009, 09:56 PM
anyone notice that like -artist and -title options are now gone from SVN? Anyone know if that is a bug or if it is supposed to be coming back?

-HR
Looks like there is a new metadata API and the old one has been depreciated:

$ ffmpeg -h | grep metadata
-metadata string=string add metadata

HolyRoses
March 20th, 2009, 02:15 AM
hmmmm, fun.

Got a list of accepted metadata? Wonder if you can do iPod tagging with it now.

FakeOutdoorsman
March 20th, 2009, 09:16 AM
hmmmm, fun.

Got a list of accepted metadata? Wonder if you can do iPod tagging with it now.
I'm not sure what is accepted with the new API. I never used the old metadata API. I use AtomicParsley to add iTunes style tags for iPod.

smiley_27
March 24th, 2009, 11:47 AM
hi @ all ...

thank' s a lot for thise fine how-to.
but i' ve a problem. i wanna install the Xine-Lib 1.2 CVS with VDPAU Patch, but i get a error in "make" ...

../../contrib/libxdg-basedir/.libs/libxdg-basedir.a -Wl,--no-whole-archive -ldl -lz -lm -lrt -lresolv -lnsl -L/usr/local/lib -lavutil -Wl,--gc-sections -pthread -pthread -Wl,-soname -Wl,libxine.so.2 -o .libs/libxine.so.2.0.0
/usr/bin/ld: /usr/local/lib/libavutil.a(base64.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavutil.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libxine.la] Fehler 1
make[2]: Verlasse Verzeichnis '/home/smiley/ffmpeg/xine-lib-1.2/src/xine-engine'
make[1]: *** [../src/xine-engine/libxine.la] Fehler 2
make[1]: Verlasse Verzeichnis '/home/smiley/ffmpeg/xine-lib-1.2/misc'
make: *** [all-recursive] Fehler 1
smiley@pc-1:~/ffmpeg/xine-lib-1.2$


"Fehler" means ERROR ;)

anyone some ideas, what i can do?

further ... before i begun to install xine-lib-1.2 i' ve installed succesfully ffmpeg.

hope somebody can help me. .... thank' s ... smiley

FakeOutdoorsman
March 25th, 2009, 12:40 AM
hi @ all ...

thank' s a lot for thise fine how-to.
but i' ve a problem. i wanna install the Xine-Lib 1.2 CVS with VDPAU Patch, but i get a error in "make" ...

../../contrib/libxdg-basedir/.libs/libxdg-basedir.a -Wl,--no-whole-archive -ldl -lz -lm -lrt -lresolv -lnsl -L/usr/local/lib -lavutil -Wl,--gc-sections -pthread -pthread -Wl,-soname -Wl,libxine.so.2 -o .libs/libxine.so.2.0.0
/usr/bin/ld: /usr/local/lib/libavutil.a(base64.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavutil.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libxine.la] Fehler 1
make[2]: Verlasse Verzeichnis '/home/smiley/ffmpeg/xine-lib-1.2/src/xine-engine'
make[1]: *** [../src/xine-engine/libxine.la] Fehler 2
make[1]: Verlasse Verzeichnis '/home/smiley/ffmpeg/xine-lib-1.2/misc'
make: *** [all-recursive] Fehler 1
smiley@pc-1:~/ffmpeg/xine-lib-1.2$


"Fehler" means ERROR ;)

anyone some ideas, what i can do?

further ... before i begun to install xine-lib-1.2 i' ve installed succesfully ffmpeg.

hope somebody can help me. .... thank' s ... smiley
I wish I could help you, but I know nothing of Xine or VDPAU. Hopefully someone with some experience in these areas will be able to help.

andrew.46
March 27th, 2009, 12:38 AM
Hi,

I have a small suggest that may have a place in your guide. I recently installed Hardy Heron again, using VirtualBox, and installed the svn MPlayer / x264 + yasm. I used checkinstall for yasm and in a step that may not be totally necessary I used:


--pkgversion "0.7.2"

which was designed to defeat the repository version of 0.5.xxxxx in Hardy. I did not test if an unlabelled yasm 0.7.2 would necessarily be overwritten by the older repository version though.

Good to see that moth-eaten heron on my desktop again though :-).

Andrew

FakeOutdoorsman
March 27th, 2009, 01:54 AM
Hi,

I have a small suggest that may have a place in your guide. I recently installed Hardy Heron again, using VirtualBox, and installed the svn MPlayer / x264 + yasm. I used checkinstall for yasm and in a step that may not be totally necessary I used:


--pkgversion "0.7.2"

which was designed to defeat the repository version of 0.5.xxxxx in Hardy. I did not test if an unlabelled yasm 0.7.2 would necessarily be overwritten by the older repository version though.

Good to see that moth-eaten heron on my desktop again though :-).

Andrew
Hi Andrew,

I don't remember the compiled yasm being replaced by repository yasm in my tests, but it's been a while now. I added "pkgversion" anyway because it's nice to see what version it is in the package manager.

I'm working on the Jaunty FFmpeg guide now. It seems as if "--fstrans=no" and "--install=yes" are no longer required in checkinstall for Jaunty. So far that seems to be the only difference between the two Ubuntu releases. I'll probably just leave these options to have one guide for both, but what do you think?

FakeOutdoorsman
March 27th, 2009, 02:05 AM
This guide has moved to the official FFmpeg wiki:

How to Compile FFmpeg and x264 on Ubuntu Hardy Heron 8.04 (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideHardy)

andrew.46
March 27th, 2009, 03:35 AM
Hi,


I'm working on the Jaunty FFmpeg guide now. It seems as if "--fstrans=no" and "--install=yes" are no longer required in checkinstall for Jaunty. So far that seems to be the only difference between the two Ubuntu releases. I'll probably just leave these options to have one guide for both, but what do you think?

I note that the fstrans problem has finally been acknowledged (http://changelogs.ubuntu.com/changelogs/pool/universe/c/checkinstall/checkinstall_1.6.1-8/changelog):



checkinstall (1.6.1-8) unstable; urgency=low

* Recommend make since it's the most used install tool. (Closes: #487964).
* Use quilt for managing patches to upstream sources.
* Allow Requires to be used in Debian. (Closes: #469639)
* Turn off system translation by default, since it is currently broken.
* Update the Vcs-* tags since we moved to Git.



The solution seems to have been in Jaunty to turn it off in checkinstall's configuration file in /etc/checkinstallrc:


# Are we going to use filesystem translation?
# Note: checkinstall, as of 1.6.1 doesn't handle the at family of syscalls.
# This means that translation doesn't work as coreutils uses them.
TRANSLATE=0

You have my sympathies in catering for so many different versions of Ubuntu each with slightly different needs :-).

All the best,

Andrew

zg_gogs
April 1st, 2009, 09:51 AM
On 8.10, I was able to sucessfully install x264 without issue. However when running


sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3"

it throws a most frustrating error...


**** Installation failed. Aborting package creation.

Cleaning up.../usr/bin/checkinstall: line 302: [: /home/goran/Workdir/new: binary operator expected
OK

I wish that I could offer something a bit more descriptive, but unfortunately that is all I've been given. Can anyone out there help me? Further, would this final command log anywhere else except to standard output and is there any way to turn on further debugging?

FakeOutdoorsman
April 2nd, 2009, 08:09 PM
I was unable to reproduce this error. Is that all of the info that checkinstall provided? There is a debug option for checkinstall, but I have no experience with it. From "man checkinstall":

-d Set debug level. Must be one of 0, 1 and 2.
From /etc/checkinstallrc:

# Debug level
# 0: No debug
# 1: Keep all temp files except the package's files
# 2: Keep the package's files too
You could also install FFmpeg without checkinstall, but the package will not be integrated with your package managers. After running "make", enter the following:

sudo make install
If you want to remove FFmpeg:

cd ~/ffmpeg
sudo make uninstall

andrew.46
April 4th, 2009, 12:24 AM
Hi,

Can I make a request, rather than a suggestion, concerning your FFmpeg guide? Across the forums it is a very common question: 'Why can't my repository FFmpeg convert mp3 / aac, demux ac3' etc. To this there is always an answer that involves either installing a Medibuntu version or installing 'unstripped' libraries of various names depending on the version of Ubuntu involved.

Would you consider publishing a single post either annexed to your guide or completely apart from your guide that would give all of these details in one place in a definitive manner? I am sure this would be of great benefit to those who are not prepared to utilise svn and of great benefit to the many Ubuntu users banging their heads into their keyboards when their Repository FFmpeg is not producing the goods.

All the very best,

Andrew

InspiredIndividual
April 4th, 2009, 01:27 AM
Hi,

Can I make a request, rather than a suggestion, concerning your FFmpeg guide?

(...)

Would you consider publishing a single post either annexed to your guide or completely apart from your guide that would give all of these details in one place in a definitive manner? I am sure this would be of great benefit to those who are not prepared to utilise svn and of great benefit to the many Ubuntu users banging their heads into their keyboards when their Repository FFmpeg is not producing the goods.



I second that wholeheartedly... after stumbling upon this thread after a couple of hours of head banging. The first time I really started to regret updating to Intrepid.

FakeOutdoorsman
April 4th, 2009, 01:38 AM
Sounds good to me. I'll probably make it a separate guide with some examples and link to it from this guide.

InspiredIndividual
April 4th, 2009, 02:01 AM
Sounds good to me. I'll probably make it a separate guide with some examples and link to it from this guide.

Brilliant! By the way, I'm ashamed to have forgotten to thank you for your instructive tutorial! I'll put it down to being grumpy from banging my head against my keyboard for so long... I just tried your instructions, and ffmpeg worked like a charm! Thanks a lot!

andrew.46
April 4th, 2009, 05:54 AM
Hi FakeOutdoorsman,


Sounds good to me. I'll probably make it a separate guide with some examples and link to it from this guide.

Wonderful! Thanks for doing this, it should lift some of the confusion that clouds the multiple variants of FFmpeg available to Ubuntu users.

BTW I note that your guide has clocked up 95,115 views. Will there be a party at 100,000?

All the best,

Andrew

FakeOutdoorsman
April 8th, 2009, 01:33 AM
Hi FakeOutdoorsman,



Wonderful! Thanks for doing this, it should lift some of the confusion that clouds the multiple variants of FFmpeg available to Ubuntu users.

BTW I note that your guide has clocked up 95,115 views. Will there be a party at 100,000?

All the best,

Andrew

Ok, it took them a few days to approve the guide (I prodded them in #ubuntuforums because I'm impatient), but it's now up. I'll make a note on the first page of this guide as well:

HOWTO: Easily enable MP3, MPEG4, AAC, and other restricted encoding in FFmpeg (http://ubuntuforums.org/showthread.php?t=1117283)

As for 100,000 views? I suppose I'll have a dram or two, and then maybe come up with some other FFmpeg or other video guide. Any other requests? x11grab seems like a good candidate, but I need to actually learn how to use it first.

mocha
April 8th, 2009, 05:39 AM
Would you consider publishing a single post either annexed to your guide or completely apart from your guide that would give all of these details in one place in a definitive manner?

Andrew, you also got me thinking about mplayer/mencoder/x264. Perhaps you should also add this type of information to your guide? I know another good reason for a compiled mplayer, VDPAU.

andrew.46
April 8th, 2009, 06:25 AM
Hi mocha,


Andrew, you also got me thinking about mplayer/mencoder/x264. Perhaps you should also add this type of information to your guide?

The Fakeoutdoorsman is more patient with the quirks of the Ubuntu package management/production system than me :-).

And BTW Fakeoutdoorsman: the new guide looks great and I am sure will be hugely popular!

All the best,

Andrew

theophile
April 14th, 2009, 07:42 AM
Following the steps in the OP exactly as stated on an AMD64 Intrepid, ffmpeg finished the build process with the following:


libswscale/swscale.c:3409: warning: assignment discards qualifiers from pointer target type
gcc -DHAVE_AV_CONFIG_H -I. -I"/home/theophile/Desktop/mlbviewer stuff/ffmpeg" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o libswscale/swscale_avoption.o libswscale/swscale_avoption.c
gcc -DHAVE_AV_CONFIG_H -I. -I"/home/theophile/Desktop/mlbviewer stuff/ffmpeg" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o libswscale/yuv2rgb.o libswscale/yuv2rgb.c
libswscale/yuv2rgb.c: In function ‘ff_yuv2rgb_c_init_tables’:
libswscale/yuv2rgb.c:670: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:671: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:672: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:706: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:707: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c:708: warning: passing argument 4 of ‘fill_table’ from incompatible pointer type
libswscale/yuv2rgb.c: At top level:
libswscale/yuv2rgb.c:298: warning: ‘yuv2rgb_c_8’ defined but not used
libswscale/yuv2rgb.c:346: warning: ‘yuv2rgb_c_4’ defined but not used
libswscale/yuv2rgb.c:403: warning: ‘yuv2rgb_c_4b’ defined but not used
gcc -DHAVE_AV_CONFIG_H -I. -I"/home/theophile/Desktop/mlbviewer stuff/ffmpeg" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o libswscale/x86/yuv2rgb_mmx.o libswscale/x86/yuv2rgb_mmx.c
rm -f libswscale/libswscale.a
ar rc libswscale/libswscale.a libswscale/rgb2rgb.o libswscale/swscale.o libswscale/swscale_avoption.o libswscale/yuv2rgb.o libswscale/x86/yuv2rgb_mmx.o
ranlib libswscale/libswscale.a
gcc -DHAVE_AV_CONFIG_H -I. -I"/home/theophile/Desktop/mlbviewer stuff/ffmpeg" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o ffmpeg.o ffmpeg.c
theophile@graven:~/Desktop/mlbviewer stuff/ffmpeg$

I don't see any errors but the binaries (ffmpeg, ffplay) are not built! 'make install' installs the libraries but no binaries and the binaries are not created in the root of the source tree. Anyone know why this would happen?

FakeOutdoorsman
April 14th, 2009, 06:20 PM
I've never seen this "error" before. Since this is the bleeding-edge, there may have been a problem with your specific revision. Show the output of:

cd ~/Desktop/mlbviewer stuff/ffmpeg
svn info | grep Revision
I haven't tested this guide on 64-bit myself as I am limited to an ancient single-core CPU (I also don't get to play around with VDPAU which would be useful for my new video camera), but other users have mentioned that it works.

I recommend trying the latest revision. Refer to the "Updating Your Installation" section of the guide. If is still doesn't work then you may want to post your question on the ffmpeg-users mailing list.

theophile
April 15th, 2009, 04:33 PM
Revision: 18504

I just reupped. We'll see if it makes a difference.

theophile
April 15th, 2009, 05:27 PM
It did not help. However, moving the source tree to a different directory that did not include a space in the path DID work. Odd.

madhi19
April 16th, 2009, 07:58 PM
amazing tutorial and it made me realize how easy it is to convert all those old flv video for my ps3 just by using ffmpeg in terminal

andrew.46
April 17th, 2009, 04:04 AM
Hi Fakeoutdoorsman,

Congrats on this guide cracking the 100,000 mark!!!!!!!!!

Andrew

FakeOutdoorsman
April 17th, 2009, 09:32 PM
Thanks Andrew! I'll have a shot of Scotch tonight. A drink to celebrate a computer forum thread? Yeah, I know I'm a nerd.

speed32219
April 19th, 2009, 11:15 PM
First and foremost I want to thank FakeOutdoorsman for an outstanding job. If only some of the other guides were so encompassing here in the forums.

I have read all 38 pages (Should have taken notes) but as soon as I get home this eveing from work I am going to follow the guide to install the intrepid release.

I have about 360 dvd's stored in ISO format, many home video's as well as a large collection of music, and my machine is physically maxed out on physical HD's. (2.8TB)

I have tested/tried Hanbrake to encode to H264/AC3/Xvid I believe, and my movie file size droped from roughly 4.15/4.3GB to 1.8GB. This was good news since I could increase the available disk space significantly. I completed 2 conversions so far.

But the only problem was the time it took for a 2 pass encoding right from the disk, although the output, except for text/credits was outstanding. No visible perception that it was encoded to a different space saving format. In addition, I was having problems coming up with a commnad line string that worked.

Is this method faster as far as encoding?

It will be easier with some scripts or just plain copy and paste command lines.

FakeOutdoorsman
April 20th, 2009, 07:47 PM
...But the only problem was the time it took for a 2 pass encoding right from the disk, although the output, except for text/credits was outstanding. No visible perception that it was encoded to a different space saving format. In addition, I was having problems coming up with a commnad line string that worked.

Is this method faster as far as encoding?

It will be easier with some scripts or just plain copy and paste command lines.

I'm glad this guide has been helpful for you. I've never used Handbrake, so I can't comment on that, but if you want something faster than two-pass VBR (Variable Bit Rate) then one-pass CRF (Constant Rate Factor) may be what you're looking for. Two-pass VBR is great when you want to control the size of the video file. One-pass CRF is faster than two-pass (it all depends on your option settings of course) and is useful when you want a certain quality and aren't too concerned about the exact file size. This doesn't mean that two-pass is 2x as slow as one-pass CRF since the first pass is usually fast. You can read more about this at the recently updated FFmpeg x264 encoding guide (http://rob.opendot.cl/index.php/useful-stuff/ffmpeg-x264-encoding-guide/).

There are many ways to do this, but I think I would mount the ISO and then try a CRF encode using the libx264 presets:

sudo modprobe loop
sudo mount video.iso /media/dvd/ -t udf -o loop
ffmpeg -i -ss 00:00:10:00 -t 00:01:00:00 /media/dvd/VIDEO_TS/VTS_01_1.VOB -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 26 -threads 0 output.mp4
sudo umount /media/dvd/
The -ss option will start the encode 10 minutes into the input video and the -t option tells FFmpeg to encode for one minute. I added those to make a quick test encode to check the quality and to make sure I got the size and other options correct. The most important option is -crf and is explained in the link above.

gaixixon
April 23rd, 2009, 11:15 AM
I try to convert an video to another format using -vcodec but got following error:

teppy@BP:~/Videos$ ffmpeg -i "hua xin.dat" -vcodec libx264 "hua xin.mpg"
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on Mar 16 2009 21:16:26, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Input #0, mpeg, from 'hua xin.dat':
Duration: 00:03:43.3, start: 0.253333, bitrate: 1422 kb/s
Stream #0.0[0x1e0]: Video: mpeg1video, yuv420p, 352x240, 1152 kb/s, 29.97 fps(r)
Stream #0.1[0x1c0]: Audio: mp2, 44100 Hz, stereo, 224 kb/s
Unknown codec 'libx264'

1/ How do I install libx264 codec?
2/ what is another codec option other than libx264?

cyper
April 23rd, 2009, 11:16 AM
Thanks for nice guide! I just got rid of "Segmentation fault" issue. Used Hardy HOW-TO on Intrepid. ;)
good luck to you

FakeOutdoorsman
April 23rd, 2009, 06:29 PM
I try to convert an video to another format using -vcodec but got following error:

1/ How do I install libx264 codec?
2/ what is another codec option other than libx264?

You are using FFmpeg from the Ubuntu repository. This does not include support for libx264 by default. Ubuntu Hardy users can:


1. Uninstall the repository FFmpeg and compile FFmpeg and x264 yourself:
HOWTO: Install and use the latest FFmpeg and x264 (http://ubuntuforums.org/showthread.php?t=786095)

or

2. Use FFmpeg from a third-party repository:
HOWTO: Easily enable MP3, MPEG4, AAC, and other restricted encoding in FFmpeg (http://ubuntuforums.org/showthread.php?t=1117283)

gaixixon
April 24th, 2009, 02:47 AM
hi FakeOutdoorsman, I still got error
Unknown codec 'libx264'

what is another video codec options that I can use?
I am now trying to convert some .dat movie files to what ever (maybe flv, mpg to play on my mobile phone).

FakeOutdoorsman
April 24th, 2009, 09:01 AM
hi FakeOutdoorsman, I still got error
what is another video codec options that I can use?
I am now trying to convert some .dat movie files to what ever (maybe flv, mpg to play on my mobile phone).

For mpg:

ffmpeg -i inputvideo.dat -b 512k output.mpg

You will need to compile FFmpeg yourself or install FFmpeg from Medibuntu (http://www.medibuntu.org/) to create flv with mp3 audio.

hz428
May 15th, 2009, 12:30 PM
hi, my installation stop at "install FFmpeg" because I accidentally closed the terminal. When restart the whole process I got this error

" svn: Working copy 'ffmpeg' locked"

soon after entered this command "svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg".

how can I fix this problem?

FakeOutdoorsman
May 15th, 2009, 06:43 PM
Rename or delete ~/ffmpeg and then run svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg again:

cd
rm -rf ffmpeg
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg

kishigo
May 20th, 2009, 11:38 PM
Hi,

This question may have been asked already, but I couldn't find it in the thread. Do I need to uninstall the unstripped ffmpeg libraries such as libavutil-unstripped49 et al before compiling ffmpeg?

Thank you,

Kevin

FakeOutdoorsman
May 20th, 2009, 11:55 PM
Hi,

This question may have been asked already, but I couldn't find it in the thread. Do I need to uninstall the unstripped ffmpeg libraries such as libavutil-unstripped49 et al before compiling ffmpeg?

Thank you,

Kevin

I doubt that you need to remove them. However, the libav*-dev packages may cause issues if my memory is correct. I usually like to test these things out before replying (instead of relying on my often faulty memory), but I'm out of town now, so I can't test it to be completely sure.

andrew.46
May 23rd, 2009, 08:00 AM
Hi hz428,




svn: Working copy 'ffmpeg' locked


The Gordian Knot approach (http://en.wikipedia.org/wiki/Gordian_Knot) is to delete and start again as FakeOutdoorsman has already suggested. An alternative is to change to your FFmpeg source tree and run:


svn cleanup .

Don't forget the '.' which of course signifies that the target of the command is the present working directory. This command recursively cleans up the working copy, removing locks, resuming unfinished operations, etc.

All the best,

Andrew

andrew.46
May 27th, 2009, 03:05 AM
Hi FakeOutDoorsman,

Apropos of my previous post I have written another guide in a 'linux basics' series that may or may not be of some use to readers of your guide:

Linux Basics: A gentle introduction to accessing 'svn' repositories
http://ubuntuforums.org/showthread.php?t=1167578

The special relevance to your FFmpeg guide is that I have used the FFmpeg svn repository as an example throughout the guide. Not sure if this is any help as you have covered the most immediate svn needs already...

All the best,

Andrew

rob4
May 28th, 2009, 04:33 PM
Hi All -

Looking for some help. Everything went well until step4 - Install FFmpeg

When performing make I get this error:
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecDecode'
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecInit2'
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecClose'
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecOpen'
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecSetConfiguration'
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecInit'
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecGetCurrentConfiguration'
/home/rob/ffmpeg/libavcodec/libavcodec.so: undefined reference to `faacDecGetErrorMessage'
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1

I have Jaunty and I'm not too sure what else you need to help - please let me know and I will post. Ultimate goal is to get Fuppes to transcode but gotta get ffmpeg working first.

Rob

FakeOutdoorsman
May 28th, 2009, 06:37 PM
I just compiled FFmpeg revision SVN-r18971 on Jaunty and encountered no errors. There may have been issues with your particular revision. I recommend trying the newest revision. Go to the Updating Your Installation secion of the guide and start at cd ~/ffmpeg. Let me know if that does not work.

rob4
May 28th, 2009, 08:53 PM
Thanks for the response! The latest was revision 18972 and now I have this error:

/home/rob/ffmpeg/libavcodec/libavcodec.a(libfaad.o): In function `faac_decode_init':
/home/rob/ffmpeg/libavcodec/libfaad.c:252: undefined reference to `faacDecOpen'
/home/rob/ffmpeg/libavcodec/libfaad.c:253: undefined reference to `faacDecClose'
/home/rob/ffmpeg/libavcodec/libfaad.c:254: undefined reference to `faacDecGetCurrentConfiguration'
/home/rob/ffmpeg/libavcodec/libfaad.c:255: undefined reference to `faacDecSetConfiguration'
/home/rob/ffmpeg/libavcodec/libfaad.c:256: undefined reference to `faacDecInit'
/home/rob/ffmpeg/libavcodec/libfaad.c:257: undefined reference to `faacDecInit2'
/home/rob/ffmpeg/libavcodec/libfaad.c:258: undefined reference to `faacDecDecode'
/home/rob/ffmpeg/libavcodec/libfaad.c:260: undefined reference to `faacDecGetErrorMessage'
/home/rob/ffmpeg/libavcodec/libfaad.c:274: undefined reference to `faacDecOpen'
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1
rob@Base:~/ffmpeg$

Do you need more information?

Rob

FakeOutdoorsman
May 28th, 2009, 09:01 PM
Did you change anything from the guide? Give the output of:

tail ~/ffmpeg/config.err

rob4
May 28th, 2009, 09:06 PM
I copy/paste. I have tried a number of tutorials before I got to this but fuppes would never transcode. I thought this tutorial may be the answer but now I cant play anything using Mplayer/ splayer/ vlc, etc.

Here is the output:

rob@Base:~/ffmpeg$ tail ~/ffmpeg/config.err
END /tmp/ffconf.qJgELLYM.c
gcc -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o /tmp/ffconf.cZhmsYxD.o /tmp/ffconf.qJgELLYM.c
check_asm asmalign_pot ".align 3"
check_as
BEGIN /tmp/ffconf.qJgELLYM.c
1 void foo(void){ __asm__ volatile(".align 3"); }
END /tmp/ffconf.qJgELLYM.c
gcc -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o /tmp/ffconf.cZhmsYxD.o /tmp/ffconf.qJgELLYM.c
/tmp/ffconf.qJgELLYM.c: Assembler messages:
/tmp/ffconf.qJgELLYM.c:1: Error: alignment not a power of 2
rob@Base:~/ffmpeg$

FakeOutdoorsman
May 28th, 2009, 09:23 PM
I'm not sure what is causing your error and I can't duplicate it. I would guess it is a conflict with an installed package; possibly from a non-Ubuntu repository. Check /etc/apt/sources.list and /etc/apt/sources.list.d/ for any non-Ubuntu repositories.

Perhaps the problem is caused by the prior tutorials you followed. Do you have links to those tutorials?

If I can't figure this out the next step is asking for help in the #ffmpeg IRC channel or at the ffmpeg-user (http://ffmpeg.org/contact.html) mailing list.

shane2peru
June 7th, 2009, 09:37 PM
Thanks for the how to. Worked like a charm. How often do those packages get updated? Does svn trunk mean it is more of a stable than the beta packages? I have understood svn to be beta stuff, but that is more just my impression than factual.

Shane

FakeOutdoorsman
June 8th, 2009, 07:00 PM
Thanks for the how to. Worked like a charm. How often do those packages get updated?
Glad it worked for you. Development is active for both FFmpeg and x264. Yesterday there were two updates to FFmpeg and Saturday had eight updates. You can see a FFmpeg changelog with:

svn log -l 6 svn://svn.mplayerhq.hu/ffmpeg/trunk
The option -l 6 will display the last six log entries. You can view the x264 changelog (http://mirror01.x264.nl/x264/changelog.txt) in your browser. Your installed FFmpeg and x264 packages can be updated as often as you would like. Refer to the "Updating Your Installation" section of the guide.


Does svn trunk mean it is more of a stable than the beta packages? I have understood svn to be beta stuff, but that is more just my impression than factual.

Shane

I'm not aware of any FFmpeg beta packages and since I've been using FFmpeg it was always recommended to use SVN. It is the bleeding-edge and I have experienced errors, but the are relatively rare and usually fixed by the next day. From ffmpeg.org/download.html:

FFmpeg has always been a very experimental and developer-driven project. It is a key component in many multimedia projects and has new features added constantly. SVN snapshots work really well 99% of the time so people are not afraid to use them.

shane2peru
June 8th, 2009, 09:20 PM
Glad it worked for you. Development is active for both FFmpeg and x264. Yesterday there were two updates to FFmpeg and Saturday had eight updates. You can see a FFmpeg changelog with:

svn log -l 6 svn://svn.mplayerhq.hu/ffmpeg/trunk
The option -l 6 will display the last six log entries. You can view the x264 changelog (http://mirror01.x264.nl/x264/changelog.txt) in your browser. Your installed FFmpeg and x264 packages can be updated as often as you would like. Refer to the "Updating Your Installation" section of the guide.



I'm not aware of any FFmpeg beta packages and since I've been using FFmpeg it was always recommended to use SVN. It is the bleeding-edge and I have experienced errors, but the are relatively rare and usually fixed by the next day. From ffmpeg.org/download.html:

FFmpeg has always been a very experimental and developer-driven project. It is a key component in many multimedia projects and has new features added constantly. SVN snapshots work really well 99% of the time so people are not afraid to use them.

Thanks for the info. Much appreciated.

Shane

conradin
June 12th, 2009, 09:20 PM
Indeed a great how to. When i get home i will try this.
Currently i have Jackalope installed and ffmpeg will export to .wav files but not .MP3 files. Anyone have some advice there?
I will try reinstalling ffmpeg soon.

FakeOutdoorsman
June 12th, 2009, 09:24 PM
Indeed a great how to. When i get home i will try this.
Currently i have Jackalope installed and ffmpeg will export to .wav files but not .MP3 files. Anyone have some advice there?
I will try reinstalling ffmpeg soon.
Jackalope uses a relatively new revision of FFmpeg unlike prior Ubuntu versions. Restricted encoders are disabled by default, but it is easy to enable them:

HOWTO: Easily enable MP3, MPEG4, AAC, and other restricted encoding in FFmpeg (http://ubuntuforums.org/showthread.php?t=1117283)

dilog
July 1st, 2009, 05:03 PM
excellent instructions and working command row but trying afterwards WinFF with same input says "Could not find FFPlay"
Should I wait until next version of WinFF?

(Ubuntu 9.04 updated)

Dimitris

FakeOutdoorsman
July 1st, 2009, 07:31 PM
excellent instructions and working command row but trying afterwards WinFF with same input says "Could not find FFPlay"
Should I wait until next version of WinFF?

(Ubuntu 9.04 updated)

Dimitris

I'm not too familiar with WinFF. Did you install the libsdl1.2-dev package before compiling FFmpeg? It is under "Optional Dependencies" on this guide.

I am out of town, so my replies may be sparse.

dilog
July 2nd, 2009, 05:16 PM
I'm not too familiar with WinFF. Did you install the libsdl1.2-dev package before compiling FFmpeg? It is under "Optional Dependencies" on this guide.

I am out of town, so my replies may be sparse.

I did but all of the same....

SL666
July 2nd, 2009, 10:04 PM
Where I can get information for Jaunty?

I'm on jaunty, followed these instructions and it works perfectly.

dilog
July 3rd, 2009, 11:30 AM
I did but all of the same....

Sorry, it works perfectly now - many thanks!
Dimitris

andrew.46
July 9th, 2009, 02:01 AM
Hi Fakeoutdoorsman,

It seems that FFmpeg has dropped support for the non-free amr libraries in favour of opencore-amr:



andrew@skamandros~$ svn log svn://svn.mplayerhq.hu/ffmpeg/trunk -r 19365
------------------------------------------------------------------------
r19365 | diego | 2009-07-07 10:28:16 +1000 (Tue, 07 Jul 2009) | 3 lines

Remove support for nonfree libamr library for AMR-NB/WB decoding/encoding.
libopencore can now be used as a replacement except for AMR-WB encoding.

------------------------------------------------------------------------


which of course makes your brief guide:

How to play AMR audio files
http://ubuntuforums.org/showpost.php?p=6320667&postcount=9

correct only for older revisions. I am still scrabbling around myself with the gitorious git repository to re-enable amr support :-). Looks like the following will be a start:



$ git clone --depth=1 git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr
$ cd opencore-amr
$ make
$ sudo make install
$ make clean


and for the FFmpeg ./configure to succeed:



--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-version3


Hmmm.... maybe I have given a little more than a start :-). Mind you I note there is a debian directory with the usual section for creating a debian package which would probably be a better idea.

Andrew

bgiannes
July 9th, 2009, 11:39 PM
i need to do a

cd ffmpeg
cp ffmpeg /usr/bin/

for the build to work


FakeOutdoorsman love your work!! :-)


oh and i needed one or more of these to make x11grab work, (i have a new 9.04 install)

sudo aptitude install libice-dev libsm-dev libx11-dev libxext-dev libxi-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxt-dev libxtrap-dev libxtst-dev libxv-dev x-dev zlib1g-dev

alexcckll
July 10th, 2009, 08:08 AM
Umm - I'm on Hardy, but now scared for when I may need to upgrade to the next LTS.

I trust that the non-free encoders are available in the version of ffmpeg that I would be able to buy from Canonical?

If that is the case - I'll buy the fully-supported version - if it's just an apt-get away...

FakeOutdoorsman
July 10th, 2009, 09:17 PM
Hi Fakeoutdoorsman,

It seems that FFmpeg has dropped support for the non-free amr libraries in favour of opencore-amr:

which of course makes your brief guide:

How to play AMR audio files
http://ubuntuforums.org/showpost.php?p=6320667&postcount=9

...

Hmmm.... maybe I have given a little more than a start :-). Mind you I note there is a debian directory with the usual section for creating a debian package which would probably be a better idea.

Andrew

Thanks for the update, Andrew. I forgot about that post, and truthfully, I've been out of the FFmpeg loop for about a month and even suspended my mailing list subscription. It's been a sunny summer so far which can be rare for southeast Alaska. I'll try to catch up this week, but I can't guarantee anything. It's good to have another video enthusiast at the forums here and I appreciate the time you put into this.


i need to do a

cd ffmpeg
cp ffmpeg /usr/bin/

for the build to work


FakeOutdoorsman love your work!! :-)


oh and i needed one or more of these to make x11grab work, (i have a new 9.04 install)

sudo aptitude install libice-dev libsm-dev libx11-dev libxext-dev libxi-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxt-dev libxtrap-dev libxtst-dev libxv-dev x-dev zlib1g-dev

I never needed to copy the binary to make it work since checkinstall seems to do that fine for me. Did you use checkinstall?

You're right about x11grab. I assumed I tested this when I added --enable-x11grab, but now that I think about it I probably forgot and just thought I did. The libx11-dev package seemed to do the trick so far, but I need to actually test it this time. Thanks for the suggestion!


Umm - I'm on Hardy, but now scared for when I may need to upgrade to the next LTS.

I trust that the non-free encoders are available in the version of ffmpeg that I would be able to buy from Canonical?

If that is the case - I'll buy the fully-supported version - if it's just an apt-get away...

Forgive my ignorance, but I don't really know what you're asking. Are you talking about the Fluendo (http://shop.canonical.com/product_info.php?products_id=244) pack from the Canonical Store? I really know nothing about this software and I don't see any mention of FFmpeg in the item description.

bgiannes
July 11th, 2009, 03:47 AM
Umm - I'm on Hardy, but now scared for when I may need to upgrade to the next LTS.

I trust that the non-free encoders are available in the version of ffmpeg that I would be able to buy from Canonical?

If that is the case - I'll buy the fully-supported version - if it's just an apt-get away...



hello, i think your asking, if you need to pay for ffmpeg (full version).

the full version is FREE! the codecs are all free as well, because the code was all written from the ground up to work as codecs in the market place.

but you need to "build" ffmpeg yourself if you would like these codecs.

so take a look at post #1 and follow it... there is only a little more for you to do them just a apt-get :)


ps i think www.Canonical.com only promotes ubuntu and does training


so updating will only cost you your time.

alexcckll
July 11th, 2009, 10:13 AM
Forgive my ignorance, but I don't really know what you're asking. Are you talking about the Fluendo (http://shop.canonical.com/product_info.php?products_id=244) pack from the Canonical Store? I really know nothing about this software and I don't see any mention of FFmpeg in the item description.

Yes.


What is the difference between the FFMPEG stuff and Fluendo?

And - isn't FFMPEG normally updated as a matter of course by Release Management? Just that I'd prefer to stick to fully-supported solutions. Seeing that I currently have no problem using iPlayer or 4OD...

cor2y
July 12th, 2009, 06:08 AM
Fluendo is the payware implementation of the gstreamer decoding libraries.
It doesnt allow encoding of any media just decoding.
In good conscience i cant recommend fluendo for that anymore because as of now the opensource gstreamer decoders that you can find in ubuntu via synaptic are on par with what fluendo can do.
Also fluendo does not decode EVERY media codec format for example real media (if you still use that or view it) cant be decoded by fluendo however the opensource gstreamer library can.
I discovered this shocking revelation when i tried media playback using the fluendo decoders alone, it made buying them from my point of view useless (Protip read the fine print about what decoding it supports) since when you install the opensource decoders they handle what fluendo was intended to do. Finally fluendo doesnt have 100% support for 64bit OS systems so if you have ubuntu 64 it will be required that you install the open decoders for the unsupported media which then makes fluendo again a moot point.

cor2y
July 12th, 2009, 06:21 AM
Hi Fakeoutdoorsman,

It seems that FFmpeg has dropped support for the non-free amr libraries in favour of opencore-amr:



andrew@skamandros~$ svn log svn://svn.mplayerhq.hu/ffmpeg/trunk -r 19365
------------------------------------------------------------------------
r19365 | diego | 2009-07-07 10:28:16 +1000 (Tue, 07 Jul 2009) | 3 lines

Remove support for nonfree libamr library for AMR-NB/WB decoding/encoding.
libopencore can now be used as a replacement except for AMR-WB encoding.

------------------------------------------------------------------------
which of course makes your brief guide:

How to play AMR audio files
http://ubuntuforums.org/showpost.php?p=6320667&postcount=9

correct only for older revisions. I am still scrabbling around myself with the gitorious git repository to re-enable amr support :-). Looks like the following will be a start:



$ git clone --depth=1 git://gitorious.org/opencore-amr/opencore-amr.git
$ cd opencore-amr
$ make
$ sudo make install
$ make clean
and for the FFmpeg ./configure to succeed:



--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-version3
Hmmm.... maybe I have given a little more than a start :-). Mind you I note there is a debian directory with the usual section for creating a debian package which would probably be a better idea.

Andrew

Yes it scared me a bit when i had to go hunting for opencore-amr but the documentation on enabling it in ffmpeg is simple enough
cd to your ffmpeg directory and pull the code via git within there, next cd into opencore-amr , ./configure, make , cd up one level into the ffmpeg directory ( cd .. ) and them build ffmpeg like normal with --enable-libopencore-amrwb etc via ./configure.

andrew.46
July 12th, 2009, 07:00 AM
Hi cor2y,


Yes it scared me a bit when i had to go hunting for opencore-amr but the documentation on enabling it in ffmpeg is simple enough
cd to your ffmpeg directory and pull the code via git within there, next cd into opencore-amr , ./configure, make , cd up one level into the ffmpeg directory ( cd .. ) and them build ffmpeg like normal with --enable-libopencore-amrwb etc via ./configure.

I will admit that I installed the libraries to the system as I am hopeful that MPlayer will have support for opencore-amr eventually. Mind you FFmpeg will probably discard the opencore-amr libraries in the future anyway as the SOC amr project comes to completion.

Andrew

delphinen
July 13th, 2009, 03:13 AM
Things like mplayer, ffmpeg, x264, etc. should be repackaged for all versions of any Ubuntu at least every week.
With the ffmpeg of Ubuntu 8 Hardy Heron I couldnt watch high quality videos because of the heavy frame rate dropping, and it was very frustrating. I also couldnt manage to make the mkv subs of any anime work with the PS3 Media Server. But this last problem worked without problems on OpenSUSE... why? mplayer version? mencoder parameters? fonts? why???

Well, thanksfully, I reached this thread, which, after compiling everything, made all the high quality video files work without problems even without resintalling anything, I just opened mplayer again and it worked smoothly. It also fixed the problem with the subs on the MKV files and the PS3 Media Server.

Now I remember why I loved Gentoo so much... but because of work I dont have anymore time to maintain it, so I use Ubuntu/Fedora/OpenSUSE/Arch...

but im seriously thinking on coming back to Gentoo now... building your own programs takes a lot of time, but its something that really worth it after all. With ALL of your programs being improved/fixed every day, what packaging system could stand clean always?

SL666
August 2nd, 2009, 01:16 AM
Hi Guys,

I just managed to put my first HD video on youTube, which doesn't sound like an achievement until you try to get the settings that 'the tube' understands.

I ended up using


ffmpeg -y -i in.mts -deinterlace -acodec libmp3lame -ac 2 -ab 192k -ar 44100 -vcodec libx264 -b 6000k -bt 6000k -threads 5 -f mp4 out.mkv


until i managed to get these right, i had triple speed audio, double speed video, half speed video, no audio, youtube conversion failures and most combinations.

seems the -ar is important, needs to be 44100

This was raw AVCHD video - 12 MegaBit video from a Sony HFS10.

endocded with

FFmpeg version SVN-r18858
built on May 25 2009 17:48:50, gcc: 4.3.3

on quad core AMD.


I know this isn't strictly the correct place to post this information but when i was googling i couldn't find any settings for ffmpeg > youtube.


I'd just like to say thanks again for putting these instructions together, making it easier to get high quality video on linux.

andrew.46
August 2nd, 2009, 08:40 AM
Hi SL666,





ffmpeg -y -i in.mts -deinterlace \
-acodec libmp3lame -ac 2 -ab 192k -ar 44100 \
-vcodec libx264 -b 6000k -bt 6000k -threads 5 \
-f mp4 out.mkv



Good on you for working out the correct syntax for youtube HD videos :-). But can I ask 2 questions about your syntax?


You have -f mp4 out.mkv which I suspect is a contradiction. If you mean simply to use an mp4 container I suspect just out.mp4 would be enough for FFmpeg, or do you have a special reason for this?
Will the x264 presets do anything for these videos or does youtube do this sort of encoding with your finished product anyway?


Fascinating though, i have always held off submitting videos to youtube because I was not sure how to present a file that would not be mangled at the youtube end :-).

All the best,

Andrew

SL666
August 2nd, 2009, 01:32 PM
I can't honestly tell you if its a contradiction or not, all i know is that I've been using ffmpeg mostly for encoding DVB mpegTS to play on a mythbuntu box, and i've had trouble playing it if set any other way.

Happy to be corrected (i don't know much about this stuff) but it seems to produce a different file if the extension on the output is mp4 (for example) seems to actually put it into an mkv wrapper with that extension? (i did it, it worked, i didn't ask questions) i do know that it errors if you try '-f mkv'


Unknown input or output format: mkv

andrew.46
August 3rd, 2009, 07:32 AM
Hi SL666,


Happy to be corrected (i don't know much about this stuff) but it seems to produce a different file if the extension on the output is mp4 (for example) seems to actually put it into an mkv wrapper with that extension? (i did it, it worked, i didn't ask questions) i do know that it errors if you try '-f mkv'

Seems a little odd as normally if the output is *.mp4 FFmpeg will produce an mp4 container. Never mind, I am fairly new to this myself :-). BTW the option you are after for Matroska containers is -f matroska.

Andrew

SL666
August 3rd, 2009, 07:52 AM
Interesting, just tried that all 3 ways, the container was the same for both with -f mp4 but was different (as it should be i guess) with -f matroska.

Thanks - I do feel a bit silly about that, but these things happen when you stop questioning why things work.

Cheers Steve.

andrew.46
August 3rd, 2009, 08:11 AM
Hi again SL666,


Thanks - I do feel a bit silly about that, but these things happen when you stop questioning why things work.

Well, while you are re-evaluating your syntax perhaps you could have a look at the part of the Fakeoutdoorsman's guide that deals with 'Two-Pass encode using the fastfirstpass and hq presets'. I am honestly not sure how this would work with whatever conversions youtube will perform on your video but your x264 options are a little bare except for that impressive bitrate :-).

I'm not sure if the Fakeoutdoorsman has worked with youtube at all, and in particular with submitting videos for the 'HD' setting?

Andrew

Fe++
August 3rd, 2009, 09:26 AM
hi dear community,
I have a problem in ffmpeg installation, i follow the procedure explained in this thread and it work without problem, but when the installation is complete and I try to compile an example ffmpeg program (libavcodec/apiexample), the compiler don't find avcodec.h, and all the referenced function are indicated as undefined reference. Obviously i've specificate -lavacodec at gcc. What's the matter?
Thanks in advance

J1S1E1
August 3rd, 2009, 10:16 AM
Fe++

The avcodec.h file has been moved in one of the revision changes. It installs in /usr/include/libavcodec/ instead of /usr/include/ffmpeg/ I had a similar problem with another programs configure not detecting it, so I copied the file into the other folder (since I was too lazy to figure out how to change the configure script.) Perhaps this is the problem.

Fe++
August 3rd, 2009, 11:13 AM
Thanks for the quick reply. I haven't both of these two path, i found libavcodec.a in /usr/local/lib/, I think there is something wrong? Anyone have any idea?

Fe++
August 3rd, 2009, 11:34 AM
I found the ffmpeg folder in /root/mpeg/? It's correct? I include these library using netbeans but my compiler log there is a lot of undefined reference at ffmpeg function. What can I do?

Fe++
August 3rd, 2009, 04:16 PM
I resolve the dependencies by includes all these library: lbavformat,libavcodec, libavdevice, libavutil, libswscale, libthread, libxvidcore, libtheora, libogg,libfaac,libfaad, libx264. But now i have another error: /usr/bin/ld: cannot find -lx264.
I've installed ffmpeg and x264 following the procedure explained on this thread. What could be the problem?
Thanks in advance

FakeOutdoorsman
August 3rd, 2009, 08:39 PM
Hi again SL666,



Well, while you are re-evaluating your syntax perhaps you could have a look at the part of the Fakeoutdoorsman's guide that deals with 'Two-Pass encode using the fastfirstpass and hq presets'. I am honestly not sure how this would work with whatever conversions youtube will perform on your video but your x264 options are a little bare except for that impressive bitrate :-).

I'm not sure if the Fakeoutdoorsman has worked with youtube at all, and in particular with submitting videos for the 'HD' setting?

Andrew

I uploaded my first "HD" video to YouTube last week and also experienced issues. YouTube halved my frame rate and doubled the file size. I converted video from a AVCHD Panasonic HMC-150 to a huffyuv AVI (outputted from Adobe Premiere CS 3) to H.264/AAC using the libx264 fastfirstpass and hq presets for a two-pass encode. I made a good number of tests, including no audio tests, until I found a combination that worked. For some reason YouTube didn't like -flags2 +dct8x8 (included in the libx264 hq preset) in my encoded video because it worked after I added -vpre main to the second pass which I believe disables dct8x8 and changes the H.264 profile from High to Main. This could probably qualify as a bug on YouTube's side. I read some YouTube help posts of others having similar problems from AVCHD sources. I ended up using:


ffmpeg -i input.mts -an -vcodec libx264 -vpre fastfirstpass -threads 0 -b 1728k -bt 1728k -pass 1 -f mp4 -y /dev/null && ffmpeg -i input.mts -acodec libfaac -ab 192k -ac 2 -ar 44100 -vcodec libx264 -vpre hq -vpre main -threads 0 -b 1728k -bt 1728k -pass 2 -f mp4 -y output.mp4

andrew.46
August 4th, 2009, 10:25 AM
Hi Fakeoutdoorsman,


I made a good number of tests, including no audio tests, until I found a combination that worked.

Thanks yet again, I have included your final successful syntax in my personal FFmpeg 'cookbook'!

Andrew

FakeOutdoorsman
August 5th, 2009, 12:59 AM
hi dear community,
I have a problem in ffmpeg installation, i follow the procedure explained in this thread and it work without problem, but when the installation is complete and I try to compile an example ffmpeg program (libavcodec/apiexample), the compiler don't find avcodec.h, and all the referenced function are indicated as undefined reference. Obviously i've specificate -lavacodec at gcc. What's the matter?
Thanks in advance

I'm sorry to say that I have no experience with api-example. Perhaps the FFmpeg libav-user (http://ffmpeg.org/contact.html) mailing list could help or you could try the #ffmpeg IRC channel.


Hi Fakeoutdoorsman,

Thanks yet again, I have included your final successful syntax in my personal FFmpeg 'cookbook'!

Andrew

I'm glad it was useful. Does this mean we will get to see some HD videos of your side of the world?

andrew.46
August 5th, 2009, 01:08 PM
Hi FakeOutdoorsman,


I'm glad it was useful. Does this mean we will get to see some HD videos of your side of the world?

Nothing but kangaroos and dust here :-).

Andrew

chetan55
August 5th, 2009, 08:07 PM
Hello ,
I am trying to convert avi to 3gp and my end goal is to add text to the 3gp file so i started with convertting avi to 3gp and get this error and got stuck in first step would appreciate if any body can help me with this

./ffmpeg -i ../Continental/146362e7e49c3a6fa0f9c3960b05d62f.avi -s qcif -vcodec h263 -acodec libfaac -ac 1 -ar 8000 -r 25 -ab 32 -y outputfile.3gp
FFmpeg version SVN-r19583, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration:
libavutil 50. 2. 0 / 50. 2. 0
libavcodec 52.22. 3 / 52.22. 3
libavformat 52.32. 0 / 52.32. 0
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 7. 1 / 0. 7. 1
built on Aug 5 2009 11:53:19, gcc: 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
[avi @ 0x88b1ad0]non-interleaved AVI
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from '../Continental/146362e7e49c3a6fa0f9c3960b05d62f.avi':
Duration: 00:01:13.17, start: 0.000000, bitrate: 3965 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 29.97 tbr, 29.97 tbn, 30k tbc
Stream #0.1: Audio: adpcm_ima_wav, 44100 Hz, mono, s16, 177 kb/s
WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s
Unknown encoder 'libfaac'



I am new ffmpeg. so please if somebody know the solution please post it

Thanks
Chetan

FakeOutdoorsman
August 5th, 2009, 08:29 PM
Unknown encoder 'libfaac'
Your FFmpeg configuration line is blank so libfaac is unavailable for audio encoding. Did you skip or change any of the steps from the guide?


WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s
You need to add a "k" after your bitrate: -ab 32k.

chetan55
August 5th, 2009, 09:48 PM
I didn't follow the steps because it was installed previosuly.
Thanks
Chetan

chetan55
August 5th, 2009, 09:51 PM
when i do configure I get
./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
FAAD test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

FakeOutdoorsman
August 5th, 2009, 10:04 PM
when i do configure I get
./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
FAAD test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

Did you start the guide from the beginning? I'm guessing that you omitted installing the libfaad-dev package because of the "FAAD test failed" error.

What version of Ubuntu are you using? You may find it easier to use FFmpeg from the repository if you are on Ubuntu Intrepid or Jaunty, or from Medibuntu if you are using Hardy:

HOWTO: Easily enable MP3, MPEG4, AAC, and other restricted encoding in FFmpeg (http://ubuntuforums.org/showthread.php?t=1117283)

If you are looking for a FFmpeg GUI, try WinFF (http://code.google.com/p/winff/wiki/UbuntuInstallation).

chetan55
August 6th, 2009, 01:43 AM
Ok i delete everything and started from fresh

when I do configure i get below error please let me know the solution
./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
FAAD test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

Thank you very much for helping me

Thanks
Chetan

FakeOutdoorsman
August 6th, 2009, 01:54 AM
Ok i delete everything and started from fresh

when I do configure i get below error please let me know the solution
./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
FAAD test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

Thank you very much for helping me

Thanks
Chetan

Open a terminal window, and enter the following command. It will install the libfaad-dev package:

sudo apt-get install libfaad-dev
Now continue with your FFmpeg configuration command. If that fails to fix your error, then paste the end section of ~/ffmpeg/config.err.

chetan55
August 6th, 2009, 05:22 PM
Hey,
sudo apt-get install libfaad-dev

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package libfaad-dev

Please let me know next steps to correct this

Thanks
Chetan

FakeOutdoorsman
August 6th, 2009, 06:58 PM
What version of Ubuntu are you using?
Are you using any third-party repositories or Personal Package Archives (PPA)?
What are the contents of your /etc/apt/sources.list file?
If there are any files in the /etc/apt/sources.list.d/ directory then give the contents of those files.
Give the result of the following command:

tail ~/ffmpeg/config.err

alexcckll
August 6th, 2009, 08:14 PM
Umm- I may sound dense.. but all the developer-level stuff is flying over my head.

All these enhancements you all talk about... will they be in my Update Manager eventually?

Possibly even making it into 8.04LTS.. so if a format is a bit teary.. will Release Management fix it eventually?

Without me using anything except Main, Restricted, Universe and Multiverse?

All I really know to do is stick to the Official Supported Release repositories...

Just your trusting Ubuntu desktop user...

chetan55
August 6th, 2009, 09:30 PM
Ubuntu Version
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"

Are you using any third-party repositories or Personal Package Archives (PPA)?
I don't know


What are the contents of your /etc/apt/sources.list
# deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted
# deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository. This software is not part of Ubuntu, but is
## offered by Canonical and the respective vendors as a service to Ubuntu
## users.
# deb http://archive.canonical.com/ubuntu gutsy partner
# deb-src http://archive.canonical.com/ubuntu gutsy partner
deb http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb http://security.ubuntu.com/ubuntu gutsy-security universe
deb-src http://security.ubuntu.com/ubuntu gutsy-security universe
deb http://security.ubuntu.com/ubuntu gutsy-security multiverse
deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse



No files in

/etc/apt/sources.list.d/

tail ~/ffmpeg/config.err

gcc -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -std=c99 -D_LARGEFILE_SOURCE -c -o /tmp/ffconf.ogwu4110.o /tmp/ffconf.YaQC4101.c
check_header faad.h
check_cpp
BEGIN /tmp/ffconf.YaQC4101.c
1 #include <faad.h>
2 int x;
END /tmp/ffconf.YaQC4101.c
gcc -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -std=c99 -E -o /tmp/ffconf.ogwu4110.o /tmp/ffconf.YaQC4101.c
/tmp/ffconf.YaQC4101.c:1:18: error: faad.h: No such file or directory
FAAD test failed.


I appreciate you helping me thanks
Chetan

FakeOutdoorsman
August 6th, 2009, 10:29 PM
Ubuntu Version
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"

Ubuntu Gutsy is out-dated and support for Gutsy was dropped on April 18, 2009. Can you upgrade to a supported version of Ubuntu? If not, you may still be able to compile FFmpeg. First, you need to change to the out-dated repository in /etc/apt/sources.list by replacing all instances of us.archive.ubuntu.com with old-releases.ubuntu.com. You may also be able to do this in the Synaptic Package Manager with Settings - > Repositories, but I didn't confirm this. Then run the following:

sudo apt-get update
Now follow this guide:

HOWTO: Install FFmpeg and x264 on Ubuntu Dapper Drake 6.06 LTS (http://ubuntuforums.org/showpost.php?p=6566863&postcount=287)

FakeOutdoorsman
August 6th, 2009, 10:32 PM
Umm- I may sound dense.. but all the developer-level stuff is flying over my head.

All these enhancements you all talk about... will they be in my Update Manager eventually?
I don't fully understand your questions. The installation of your compiled FFmpeg is handled by a program called checkinstall whose job is to nicely and cleanly integrate installed software into the Ubuntu package management system (apt, aptitude, and/or Synaptic Package Manager).


Possibly even making it into 8.04LTS.. so if a format is a bit teary.. will Release Management fix it eventually?

Without me using anything except Main, Restricted, Universe and Multiverse?
Sorry, but I don't understand what you're asking.


All I really know to do is stick to the Official Supported Release repositories...
This guide uses official packages from the Ubuntu repository to compile FFmpeg.

chetan55
August 7th, 2009, 12:19 AM
Thanks you very mcuh i did work channging the ulr and then following the process.

I have 2 more question and would be vey happy if you answer them
Url to be replace with this one
http://security.ubuntu.com/ubuntu : ??

how I can add text to 3gp

Thanks Lot
Chetan

FakeOutdoorsman
August 7th, 2009, 12:38 AM
Thanks you very mcuh i did work channging the ulr and then following the process.

I have 2 more question and would be vey happy if you answer them
Url to be replace with this one
http://security.ubuntu.com/ubuntu : ??
You can delete those lines because your version of Ubuntu is not supported by security updates anymore.

how I can add text to 3gp
I've never worked with subtitles before, so I am unsure what to recommend for that.

iheartubuntu
August 10th, 2009, 04:44 PM
After following the instructions, Im getting an error that I dont have FFPLAY installed now. Any tips how to fix this? I didnt get this error before, but WinFF would just crash out and not do the job. Now its asking me for FFPLAY.

FakeOutdoorsman
August 10th, 2009, 07:29 PM
After following the instructions, Im getting an error that I dont have FFPLAY installed now. Any tips how to fix this? I didnt get this error before, but WinFF would just crash out and not do the job. Now its asking me for FFPLAY.
Can you display the error here? Is FFmpeg or WinFF asking you for FFplay? What version of Ubuntu are you using?

TwistedNRG
August 12th, 2009, 08:35 PM
When trying to decode a video using this command I put in the terminal to start the ffmpeg process ...

ffmpeg -r 30 -vcodec libx264 -s 480x320 -f video4linux -i /dev/video0 http://localhost:8090/broadcast_feed.ffm

I get the following error (more specifically the very last line)

FFmpeg version SVN-r19633, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.32. 0 / 52.32. 0
libavformat 52.37. 0 / 52.37. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 7. 1 / 0. 7. 1
built on Aug 12 2009 13:12:35, gcc: 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-24ubuntu
Unknown decoder 'libx264'

I followed the tutorial exactly more then once from beginning to end and I still keep getting the same error. Any help is greatly appreciated. Thank you.

FakeOutdoorsman
August 12th, 2009, 08:58 PM
...
Unknown decoder 'libx264'

I followed the tutorial exactly more then once from beginning to end and I still keep getting the same error. Any help is greatly appreciated. Thank you.

You're getting that error because libx264 is an encoder, not a decoder:

$ ffmpeg -formats | grep libx264
EV libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
The EV indicates that libx264 is an Encoder, Video Format. The H.264 decoder is called h264.

TwistedNRG
August 12th, 2009, 10:18 PM
You're getting that error because libx264 is an encoder, not a decoder:

$ ffmpeg -formats | grep libx264
EV libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10The EV indicates that libx264 is an Encoder, Video Format. The H.264 decoder is called h264.


oh ok I didn't realize that was the case. Thanks a lot

TwistedNRG
August 13th, 2009, 05:27 PM
new error ...

I am using the following command to decode a video ..

ffmpeg -r 30 -vcodec h264 -s 480x320 -f video4linux -i /home/phil/Desktop/iphone.avi http://localhost:8090/broadcast_feed.ffm

and I get the following error when I add in -f video4linux flag .. if I take that flag out there are no errors...

FFmpeg version SVN-r19605, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.32. 0 / 52.32. 0
libavformat 52.37. 0 / 52.37. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 7. 1 / 0. 7. 1
built on Aug 6 2009 13:44:14, gcc: 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-24ubuntu1)
[video4linux @ 0xa684450]VIDIOCGCAP: Inappropriate ioctl for device
/home/phil/Desktop/iphone.avi: I/O error occurred
Usually that means that input file is truncated and/or corrupted.

any help is greatly appreciated. Thank you.

FakeOutdoorsman
August 13th, 2009, 06:01 PM
Thanks. After installing ffmpeg with LAMP can I run youtube like websites?

You can use FFmpeg to encode your video to H.264/AAC MP4, upload it to your server, and use a Flash player such as JW Player (http://www.longtailvideo.com/) or Flowplayer (http://flowplayer.org/) to display your video to your audience. Here is a very simple example (http://greasedscotsman.com/) with no player controls.

Alternatively, you can use "YouTube Clones" like VidiScript (http://www.vidiscript.com/) or PHPmotion (http://www.phpmotion.com/), but I have absolutely no experience with them and I'm not sure if they even use FFmpeg.

FakeOutdoorsman
August 13th, 2009, 06:52 PM
new error ...

I am using the following command to decode a video ..

ffmpeg -r 30 -vcodec h264 -s 480x320 -f video4linux -i /home/phil/Desktop/iphone.avi http://localhost:8090/broadcast_feed.ffm

and I get the following error when I add in -f video4linux flag .. if I take that flag out there are no errors...

FFmpeg version SVN-r19605, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.32. 0 / 52.32. 0
libavformat 52.37. 0 / 52.37. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 7. 1 / 0. 7. 1
built on Aug 6 2009 13:44:14, gcc: 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-24ubuntu1)
[video4linux @ 0xa684450]VIDIOCGCAP: Inappropriate ioctl for device
/home/phil/Desktop/iphone.avi: I/O error occurred
Usually that means that input file is truncated and/or corrupted.

any help is greatly appreciated. Thank you.

This looks more like a video4linux issue, but I've only used it once myself. I recommend heading to the #ffmpeg IRC channel and asking there. Make sure to pastebin (http://ffmpeg.pastebin.com) your full command and full FFmpeg output when asking questions. If that fails to give an answer you can try the ffmpeg-user mailing list (http://ffmpeg.org/contact.html). Maybe someone with more experience with video4linux can help you.

TwistedNRG
August 13th, 2009, 08:02 PM
This looks more like a video4linux issue, but I've only used it once myself. I recommend heading to the #ffmpeg IRC channel and asking there. Make sure to pastebin (http://ffmpeg.pastebin.com) your full command and full FFmpeg output when asking questions. If that fails to give an answer you can try the ffmpeg-user mailing list (http://ffmpeg.org/contact.html). Maybe someone with more experience with video4linux can help you.


Ok great, thanks a lot. I shall do just that.

igorfelluga
August 14th, 2009, 08:48 AM
Hi
Sametime with this command

ffmpeg -i myfile -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 test.1.mp4


I get this error:
[libx264 @ 0x2a21280]b-pyramid + mb-tree is not supported
[libx264 @ 0x2a21280]using SAR=1/1
[libx264 @ 0x2a21280]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0x2a21280]profile High, level 3.1
Output #0, mp4, to 'test.1.mp4':
Stream #0.0(und): Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=10-51, 200 kb/s, 25 tbn, 25 tbc
Stream #0.1(und): Audio: aac, 48000 Hz, 2 channels, s16, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
x264 [error]: malloc of size 4214784 failedtime=1.05 bitrate= 0.4kbits/s
Video encoding failed

FakeOutdoorsman
August 14th, 2009, 07:24 PM
Hi
Sametime with this command

ffmpeg -i myfile -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 test.1.mp4


I get this error:
[libx264 @ 0x2a21280]b-pyramid + mb-tree is not supported
[libx264 @ 0x2a21280]using SAR=1/1
[libx264 @ 0x2a21280]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0x2a21280]profile High, level 3.1
Output #0, mp4, to 'test.1.mp4':
Stream #0.0(und): Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=10-51, 200 kb/s, 25 tbn, 25 tbc
Stream #0.1(und): Audio: aac, 48000 Hz, 2 channels, s16, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
x264 [error]: malloc of size 4214784 failedtime=1.05 bitrate= 0.4kbits/s
Video encoding failed

You have encountered a new error. x264 has a new option: mb-tree. This option is going to dramatically increase video quality of some sources, but it is very new and there are some problems to be aware of:

1. For now it is incompatible with the b-pyramid option. Some -vpre presets currently enable b-pyramid, and mb-tree is enabled by default and causes your error. You can disable b-pyramid by adding -flags2 -bpyramid after -vpre hq:


ffmpeg -i myfile -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -flags2 -bpyramid -crf 22 -threads 0 test.1.mp4

Right now the option to disable mb-tree hasn't been mapped to FFmpeg yet, but it should be soon.

2. The mb-tree option currently does a bad job with fades (video going to or from light and black) and makes them look blocky, but this is being worked on. [see post below]

When using the latest FFmpeg and x264 you get the advantage of bugfixes and recent additions, but once in a while you will encounter errors as new features are introduced. This is an exciting new option and should be watched closely. More info:

x264 "Macroblock Tree Ratecontrol" testing (committed) (http://forum.doom9.org/showthread.php?t=148686)

A tree of thought (http://x264dev.multimedia.cx/?p=98)

Update: This is the more important error:

x264 [error]: malloc of size 4214784 failedtime=1.05 bitrate= 0.4kbits/s
Video encoding failed
I am guessing that you ran out of memory because of mb-tree. You can either wait until you can disable mb-tree through FFmpeg, or revert to an earlier x264 before that option was enabled by default (revision 1196 and earlier).

Dark Shikari
August 14th, 2009, 08:29 PM
You have encountered a new error. x264 has a new option: mb-tree. This option is going to dramatically increase video quality of some sources, but it is very new and there are some problems to be aware of:

1. It is incompatible with the b-pyramid option. Some -vpre presets currently enable b-pyramid, and mb-tree is enabled by default and causes your error. You can disable b-pyramid by adding -flags2 -bpyramid after -vpre hq:That's not an error; x264 will simply disable B-pyramid if it's on and MB-tree isn't turned off.


2. The mb-tree option currently does a bad job with fades (video going to or from light and black) and makes them look blocky, but this is being worked on.Don't spread misinformation; if such a problem existed, I wouldn't have committed MB-tree. MB-tree simply doesn't help fades, so it's possible for them to look relatively worse if the rest of the video got a lot better.


Update: This is the more important error:

x264 [error]: malloc of size 4214784 failedtime=1.05 bitrate= 0.4kbits/s
Video encoding failed
I am guessing that you ran out of memory because of mb-tree. You can either wait until you can disable mb-tree through FFmpeg, or revert to an earlier x264 before that option was enabled by default (revision 1196 and earlier).Or encode at a lower resolution, or upgrade to 64-bit.

That error seems odd, since I can encode 1080p with -vpre hq just fine on 32-bit Windows despite the overhead of Avisynth input, so I suspect something may be weird/broken on your end, like a miscompiled ffmpeg and rc-lookahead being set to a very large value (you can tell how large rc-lookahead is by the number of frames x264 buffers before it starts encoding).

Additionally note that the malloc-checking was added only recently; prior to that, x264 would have just silently crashed.

FakeOutdoorsman
August 14th, 2009, 08:43 PM
Don't spread misinformation; if such a problem existed, I wouldn't have committed MB-tree. MB-tree simply doesn't help fades, so it's possible for them to look relatively worse if the rest of the video got a lot better.
I stand corrected. I shouldn't believe everything I read in #ffmpeg.

DDM
August 18th, 2009, 06:51 PM
Thanks for keeping this guide updated. ffmpeg's configure script seems to change syntax on a monthly basis.

Also that checkinstall trick is very handy.

FakeOutdoorsman
August 18th, 2009, 07:00 PM
Thanks for keeping this guide updated. ffmpeg's configure script seems to change syntax on a monthly basis.

Also that checkinstall trick is very handy.

I'm glad it has been useful, although, as you can see above, I don't get everything right. I must give credit to andrew.46 for much of the checkinstall stuff. I will be working on a new FFmpeg related screen capturing guide soon.

mocha
August 20th, 2009, 04:26 PM
Does anyone know what system-wide effect there is by compiling with --enable-shared? I need to do this in order to get xine-vdpau svn to compile.

Does --enable-shared affect the usage of ffmpeg or is it just to provide shared libraries for other programs that need them, such as xine-vdpau? Does it affect other programs that depend on ffmpeg? I'm not clear how this works. I guess my question is, what other files are added to the ffmpeg package when using --enable-shared and what collateral effects does that have (if any)?

What effect will there be on other libav**** packages that are installed in the package manager? I have a few packages called libavformat, unstripped, etc... If I try to remove them they want to take a ton of programs with them. What is their role and does --enable-shared mess things up even further?

Thanks for any insight!

FakeOutdoorsman
August 21st, 2009, 03:34 AM
Does anyone know what system-wide effect there is by compiling with --enable-shared? I need to do this in order to get xine-vdpau svn to compile.

Does --enable-shared affect the usage of ffmpeg or is it just to provide shared libraries for other programs that need them, such as xine-vdpau? Does it affect other programs that depend on ffmpeg? I'm not clear how this works. I guess my question is, what other files are added to the ffmpeg package when using --enable-shared and what collateral effects does that have (if any)?

What effect will there be on other libav**** packages that are installed in the package manager? I have a few packages called libavformat, unstripped, etc... If I try to remove them they want to take a ton of programs with them. What is their role and does --enable-shared mess things up even further?

Thanks for any insight!

I've hardly ever used FFmpeg with --enable-shared, but I also haven't compiled many things that need that. I don't think this option will have any effect on other packages unless, of course, you are compiling something that needs that option. This is because this guide installs everything to /usr/local/lib instead of /usr/lib. This separation of compiled and system/repository packages creates a nice safety net. Repository packages should look for the usual repository versions of libavformat, unstripped, etc in /usr/lib, and your other compiled packages can use whatever is in /usr/local/lib. I think you can have repository packages utilize your compiled stuff in /usr/local/lib, but I'm unsure how to do that. That's more of a subject for mc4man. Package management is where my attention starts to fade out.

Installing with --enable-shared adds the following files and links:

/usr/local/lib/libswscale.so.0.7.1
/usr/local/lib/libavformat.so.52.37.0
/usr/local/lib/libavcodec.so.52.32.0
/usr/local/lib/libavdevice.so.52.2.0
/usr/local/lib/libavutil.so.50.3.0
/usr/local/lib/libavutil.so.50 -> libavutil.so.50.3.0
/usr/local/lib/libavcodec.so -> libavcodec.so.52.32.0
/usr/local/lib/libavformat.so -> libavformat.so.52.37.0
/usr/local/lib/libavdevice.so.52 -> libavdevice.so.52.2.0
/usr/local/lib/libswscale.so -> libswscale.so.0.7.1
/usr/local/lib/libswscale.so.0 -> libswscale.so.0.7.1
/usr/local/lib/libavutil.so -> libavutil.so.50.3.0
/usr/local/lib/libavcodec.so.52 -> libavcodec.so.52.32.0
/usr/local/lib/libavdevice.so -> libavdevice.so.52.2.0
/usr/local/lib/libavformat.so.52 -> libavformat.so.52.37.0

I compared the .deb files (one with --enabled-shared, one without) that are created in ~/ffmpeg after installing with checkinstall:

dpkg -c ffmpeg_3:0.svn20090820-12ubuntu3-1_i386.deb | cut - -c 50- > ffmpegdebshared.txt

The only thing addition to this guide is to run sudo ldconfig after your shared FFmpeg installation to update the links to the new shared libraries; otherwise you might get some errors if you try using FFmpeg. Also, stay away from any libav*-dev packages if you're going to compile FFmpeg and other things that want a compiled FFmpeg. I'm not sure if they actually cause problems for such a setup, but I have a shadow of a memory that indicates that it has caused issues for some users.

mc4man
August 21st, 2009, 06:18 AM
Does anyone know what system-wide effect there is by compiling with --enable-shared

I don't see any real issue following the guide here and enabling shared. The packages you have or install that depend on libav*s will use the existing ones.
What happens, or what you can control when you build against not exactly sure, would be easy to test.

From my viewpoint of updating hardy to whatever extent possible, building ffmpeg and everything else off of it and doing all as packages was the best choice, the least of which of just keeping track, I think my local repo is about 130 packages now.

Plus there's the assurance that anything built or installed that uses libavcodec will use the current one.

Anyway I'm somewhat surprised your saying that xine-lib needs to build off of the shared libs, it would seem more likely it needs the dev files. (possibly it has some shared libs as install depends,

Would be curious to know what source your using, and if the config or build is failing, what's the error(s).

The xine-vdpau source I saw only needed the -dev's, and for interest's sake also took a look at xine-lib-1.2.

Actually both failed the build in exactly the same manner due to a faulty ff_video_decoder.c file ( at least using an ffmpeg build from yesterday.

So if you get an error concerning 'ff_video_decoder.c' let me know, I patched it so the build would complete, (on xine-lib-1.2), though haven't checked for any unintended issues. ( and probably can't as 1.2 is useless here.

mc4man
August 21st, 2009, 07:49 AM
small note slightly off topic to thread

Happened to be on a jaunty live cd so got this source of xine-vdpau


svn co svn://jusst.de/xine-vdpau
............................
Checked out revision 279.

Using just the jaunty repo libav*s (-devs) and adding a few other packages it built just fine. (libpostproc-dev is a must, as is cvs


Using the latest ffmpeg svn, built as described here, (static and shared, enabled postproc), the build failed as described previously.

So while the source can be patched to work with latest svn ffmpeg, you shouldn't have any issues with the jaunty repo version (if that's what your using, the intrepid repo version is a bit to old

That svn source of xine-vdpau seems a bit old, don't know how well it would work

mocha
August 21st, 2009, 09:42 AM
The main problem on my end is that something is broken. I can't even install the libav dev or libpostproc dev packages anymore. Note, I believe this happened from installing debs from getdeb.net. It seems to trace back to some dvd-slideshow program. Probably if I cleared all this stuff out everything would resolve again.


The following packages have unmet dependencies:
libavformat-dev: Depends: libavcodec-dev (= 3:0.svn20090303-1ubuntu6) but it is not going to be installed
E: Broken packages

Even though nothing in synaptic is shown as broken.

I did compile ffmpeg r18991 (an older version) with --enable-shared and then I was able to compile the latest svn of xine-vdpau. My ffmpeg and xine-vdpau are both in /usr/local, so I guess that's why it works.

Thanks for all the information.

mocha
August 21st, 2009, 05:30 PM
Okay I figured out what the problem is. I figured it out by looking at dvdstyler in the jaunty repo. dvdstyler depends on the libavcodec-unstripped-52 and libavutil-unstripped-49 packages, but you can't install any of the libav dev packages when these unstripped packages are installed. I guess most of you don't use dvdstyler?? What a shame!

This is actually a big problem for others too, see https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/312898 This bug report relates it to ffmpeg so you might want to review this fakeoutdoorsman. Apparently it's fixed in karmic by including the necessary dev files in the unstripped packages as well. Quote from the bug report:

"So if (in karmic) libavcodec-dev can now be satisfied by having libavcodec- unstripped, etc., then it's all good. thanks!"

igorfelluga
August 29th, 2009, 04:09 PM
That's not an error; x264 will simply disable B-pyramid if it's on and MB-tree isn't turned off.

Don't spread misinformation; if such a problem existed, I wouldn't have committed MB-tree. MB-tree simply doesn't help fades, so it's possible for them to look relatively worse if the rest of the video got a lot better.

Or encode at a lower resolution, or upgrade to 64-bit.

That error seems odd, since I can encode 1080p with -vpre hq just fine on 32-bit Windows despite the overhead of Avisynth input, so I suspect something may be weird/broken on your end, like a miscompiled ffmpeg and rc-lookahead being set to a very large value (you can tell how large rc-lookahead is by the number of frames x264 buffers before it starts encoding).

Additionally note that the malloc-checking was added only recently; prior to that, x264 would have just silently crashed.


how to upgrade to 64'

forgewire
August 29th, 2009, 11:39 PM
It looks like you need a Computer Science degree to install ffmpeg properly on Linux, but this tutorial works like charm.
The best I've come across.
To convert your flash video loaded from Internet to 3gp that you can play on your mobile phone use something like:


ffmpeg -i input.flv -s qcif -vcodec h263 -acodec libfaac -ac 1 -ar 22050 -r 25 -ab 128 -y output.3gp

FakeOutdoorsman
August 30th, 2009, 06:28 PM
how to upgrade to 64'
I believe he is referring to a 64-bit installation of Ubuntu.


It looks like you need a Computer Science degree to install ffmpeg properly on Linux, but this tutorial works like charm.
The best I've come across.
To convert your flash video loaded from Internet to 3gp that you can play on your mobile phone use something like:

ffmpeg -i input.flv -s qcif -vcodec h263 -acodec libfaac -ac 1 -ar 22050 -r 25 -ab 128 -y output.3gp

Thanks, forgewire. I'm glad it worked.

igorfelluga
August 31st, 2009, 09:21 AM
I believe he is referring to a 64-bit installation of Ubuntu.


I have Ubuntu 9 64bit

rodrigopolo
September 2nd, 2009, 08:40 AM
I want to make an static, stand alone, single file build of FFmpeg on Ubuntu 9.04

I have done this with SVN-r16315 using the following "config" settings:

./configure \
--enable-static \
--extra-cflags=-static \
--extra-ldflags=-static \
--disable-shared \
--enable-libmp3lame \
--enable-gpl \
--enable-libfaad \
--enable-pthreads \
--enable-libfaac \
--enable-libxvid \
--enable-x11grab \
--enable-libgsm \
--enable-libx264 \
--enable-libtheora \
--enable-libvorbis

As you can see the "--extra-cflags=-static --extra-ldflags=-static" options make the magic, but now with the latest SVN doesn't work, also with the V0.5

Here I share the guide that IT WORKS but only with SVN-r16315

[1-Install needed packages]:

sudo aptitude install build-essential subversion git-core zlib1g-dev checkinstall libgpac-dev libfaad-dev libfaac-dev liblame-dev libtheora-dev libvorbis-dev gpac liba52-dev libgsm1-dev libxvidcore4-dev libschroedinger-dev libogg-dev libspeex-dev

[2-Install yasm]:

cd ~
wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.1.tar.gz
tar xzvf yasm-0.7.1.tar.gz
cd yasm-0.7.1
./configure
make
sudo checkinstall

[3. Get latest libx264]:

cd ~/
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-pthread --enable-mp4-output --enable-shared
make
sudo checkinstall

[4-Update the links to the shared libraries created by x264]:

sudo ldconfig

[5. Get newest ffmpeg]:

cd ~/
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
-----------------------------------------------------------
./configure \
--enable-static \
--extra-cflags=-static \
--extra-ldflags=-static \
--disable-shared \
--enable-libmp3lame \
--enable-gpl \
--enable-libfaad \
--enable-pthreads \
--enable-libfaac \
--enable-libxvid \
--enable-x11grab \
--enable-libgsm \
--enable-libx264 \
--enable-libtheora \
--enable-libvorbis

ANY HELP will be apreciated

FakeOutdoorsman
September 2nd, 2009, 10:32 PM
I want to make an static, stand alone, single file build of FFmpeg on Ubuntu 9.04

I have done this with SVN-r16315 using the following "config" settings:

./configure \
--enable-static \
--extra-cflags=-static \
--extra-ldflags=-static \
--disable-shared \
--enable-libmp3lame \
--enable-gpl \
--enable-libfaad \
--enable-pthreads \
--enable-libfaac \
--enable-libxvid \
--enable-x11grab \
--enable-libgsm \
--enable-libx264 \
--enable-libtheora \
--enable-libvorbis

As you can see the "--extra-cflags=-static --extra-ldflags=-static" options make the magic, but now with the latest SVN doesn't work, also with the V0.5

Here I share the guide that IT WORKS but only with SVN-r16315

[1-Install needed packages]:

sudo aptitude install build-essential subversion git-core zlib1g-dev checkinstall libgpac-dev libfaad-dev libfaac-dev liblame-dev libtheora-dev libvorbis-dev gpac liba52-dev libgsm1-dev libxvidcore4-dev libschroedinger-dev libogg-dev libspeex-dev

[2-Install yasm]:

cd ~
wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.1.tar.gz
tar xzvf yasm-0.7.1.tar.gz
cd yasm-0.7.1
./configure
make
sudo checkinstall

[3. Get latest libx264]:

cd ~/
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-pthread --enable-mp4-output --enable-shared
make
sudo checkinstall

[4-Update the links to the shared libraries created by x264]:

sudo ldconfig

[5. Get newest ffmpeg]:

cd ~/
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
-----------------------------------------------------------
./configure \
--enable-static \
--extra-cflags=-static \
--extra-ldflags=-static \
--disable-shared \
--enable-libmp3lame \
--enable-gpl \
--enable-libfaad \
--enable-pthreads \
--enable-libfaac \
--enable-libxvid \
--enable-x11grab \
--enable-libgsm \
--enable-libx264 \
--enable-libtheora \
--enable-libvorbis

ANY HELP will be apreciated

I'm not going to be very helpful because I'm unsure of the answer. This would be a question for the #ffmpeg IRC channel or the ffmpeg-user (http://ffmpeg.org/contact.html) mailing list. Your instructions are dated in several ways, but you can see the differences in the guide. If you ask for help on the IRC channel or mailing list make sure to supply your FFmpeg error.

mc4man
September 3rd, 2009, 01:59 AM
While I can only make a very uneducated guess as to why you'd want to use those flags, based on your config this would work on a current svn.


./configure --enable-static --extra-cflags=-static --extra-ldflags=-static --disable-shared --enable-libmp3lame --enable-gpl --enable-pthreads --enable-libxvid --enable-x11grab --enable-libgsm --enable-libx264 --enable-libtheora

(lose the libfaad, libfaac, libvorbis and in the unlikely event you have libva-dev intalled then add a --disable-hwaccels (or specific to vaapi

qyot27
September 5th, 2009, 02:36 AM
One of the reasons is that FAAC is no longer considered free (because it contains code from the ISO reference encoder (http://www.audiocoding.com/faac.html)), and thus you have to use the --enable-nonfree option to include it.

I wouldn't be surprised in the least if that was the impetus behind the Low Complexity AAC encoder project in ffmpeg's SoC lineup in 2008.

qyot27
September 10th, 2009, 06:49 AM
Several months ago I had asked about including x264's revision number in the checkinstall process in place of the date. That's been working perfectly, but I cannot seem to figure out how to do the same with ffmpeg. Any ideas?

andrew.46
September 10th, 2009, 07:46 AM
Hi qyot,


Several months ago I had asked about including x264's revision number in the checkinstall process in place of the date. That's been working perfectly, but I cannot seem to figure out how to do the same with ffmpeg. Any ideas?

Traditionally you would use cut for this, perhaps something like:



sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg \
--pkgversion "3:0.svn-`grep "FFMPEG_VERSION" version.h | \
cut -d '"' -f2 | cut -d '-' -f2`-12ubuntu3" --default


Or there is a fairly cool version of the above using sed:



sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg \
--pkgversion "3:0.svn-r`grep "FFMPEG_VERSION" version.h | \
sed 's/[^0-9]//g'`-12ubuntu3" --default


My brain has always worked better with sed than cut, and I am not sure what that says about me :).

Andrew

FakeOutdoorsman
September 11th, 2009, 04:12 AM
Or there is a fairly cool version of the above using sed:



sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg \
--pkgversion "3:0.svn-r`grep "FFMPEG_VERSION" version.h | \
sed 's/[^0-9]//g'`-12ubuntu3" --default


My brain has always worked better with sed than cut, and I am not sure what that says about me :).

Andrew

Excellent! The sed command is something I need to work on. I've often needed it, but not often enough to take the time to learn it but I'm getting better.

qyot27
September 11th, 2009, 07:12 AM
Hi qyot,



Traditionally you would use cut for this, perhaps something like:



sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg \
--pkgversion "3:0.svn-`grep "FFMPEG_VERSION" version.h | \
cut -d '"' -f2 | cut -d '-' -f2`-12ubuntu3" --default


Or there is a fairly cool version of the above using sed:



sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg \
--pkgversion "3:0.svn-r`grep "FFMPEG_VERSION" version.h | \
sed 's/[^0-9]//g'`-12ubuntu3" --default


My brain has always worked better with sed than cut, and I am not sure what that says about me :).

Andrew
Both worked, thanks. Is there any benefit for using the sed method over the one with cut?

Also, x264 always installs and gets listed fine, but apt put ffmpeg under the auto removable category. Which is somewhat annoying. Is that from a package numbering issue (which I hope can be resolved) or just an inherent thing?

Note: the first time I tried to install I used the cut method, but during the process everything locked up completely and I was forced to reboot, which canceled the installation. The sed method was the one that completed the install successfully, and then I noticed the auto removable thing. I don't know if that has anything to do with it, though.

andrew.46
September 11th, 2009, 10:35 AM
Hi qyot,


Both worked, thanks. Is there any benefit for using the sed method over the one with cut?

I guess what you would look for is the ever-present possibility of the FFmpeg developers changing the syntax and decide on a variation that might accommodate this.


Also, x264 always installs and gets listed fine, but apt put ffmpeg under the auto removable category. Which is somewhat annoying. Is that from a package numbering issue (which I hope can be resolved) or just an inherent thing?

I see the problem. The Jaunty Ubuntu repository version is in fact labelled by date --> 3:0.svn20090303-1ubuntu6 not by revision number. It depends how keen you are to use revision numbers, you may have to play with the initial 3:0 numbers...


Note: the first time I tried to install I used the cut method, but during the process everything locked up completely and I was forced to reboot, which canceled the installation. The sed method was the one that completed the install successfully, and then I noticed the auto removable thing. I don't know if that has anything to do with it, though.

I am afraid I am not entirely sure what that is all about, both techniques produce the same end result.

All the best,

Andrew

andrew.46
September 11th, 2009, 10:37 AM
Hi FakeOutdoorsman,


Excellent! The sed command is something I need to work on. I've often needed it, but not often enough to take the time to learn it but I'm getting better.

Works well but looks like it it will not work with your guide to trump the repository package version :(. I am sure a little more twiddling should get it working correctly though...

Andrew

qyot27
September 11th, 2009, 08:23 PM
I am afraid I am not entirely sure what that is all about, both techniques produce the same end result.
By that part I simply meant that I was thinking the freeze-up could have made the system think something was wrong and resulted in what I saw, not that the difference in method between cut and sed did. Just that I thought the interference might have had something to do with it.

I think what had happened was that the disc I was playing encountered an error and that made Audacious spazz out, and it in turn brought the rest of the freeze-up (I couldn't have used force quit, as the screen locked up, my music was either looping in ½-second bursts or had been replaced by endless beeping, etc. - the only way I could fix it was doing a hard reboot, and then everything was fine). I have no clue what happened, as I had to step out for just a couple of minutes and it was fine when I left, but when I came back it was in the middle of its panic attack or whatever that was. I also thought maybe it was a mini power surge, but there was no other evidence for that.

dmitryme
September 16th, 2009, 10:51 AM
Great thanks!
It helps me to convert FullHD (AVCHD) videos from my Canon cam to MPEG.

FakeOutdoorsman
September 16th, 2009, 06:49 PM
Great thanks!
It helps me to convert FullHD (AVCHD) videos from my Canon cam to MPEG.

Good to hear that it converted AVCHD with no problems. I'm sure we'll be seeing more of this format.

tvkpz
September 25th, 2009, 04:27 AM
Hi

I have successfully installed FFMPEG from source following your directions. Thanks for that.

I tried writing a simple program to test how it works (attached below)

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[]) {
printf("Before av_register_all(); \n");
av_register_all();
printf("OK 1\n");
return 0;
}

and compiled using

gcc -o test-ffmpeg test-ffmpeg.c -lavformat -lavcodec -lavutil -lswscale -lz -lm

I get a whole list of errors (attached below). Seems there are too many undefined things. Am I missing out setting some env variables etc.

Looking forward to your help!

tvkpz


/usr/local/lib/libavcodec.a(libfaac.o): In function `Faac_encode_frame':
/home/sujoy/ffmpeg/libavcodec/libfaac.c:128: undefined reference to `faacEncEncode'
/usr/local/lib/libavcodec.a(libfaac.o): In function `Faac_encode_close':
/home/sujoy/ffmpeg/libavcodec/libfaac.c:144: undefined reference to `faacEncClose'
/usr/local/lib/libavcodec.a(libfaac.o): In function `Faac_encode_init':
/home/sujoy/ffmpeg/libavcodec/libfaac.c:46: undefined reference to `faacEncOpen'
/home/sujoy/ffmpeg/libavcodec/libfaac.c:51: undefined reference to `faacEncGetCurrentConfiguration'
/home/sujoy/ffmpeg/libavcodec/libfaac.c:75: undefined reference to `faacEncClose'
/home/sujoy/ffmpeg/libavcodec/libfaac.c:114: undefined reference to `faacEncSetConfiguration'
/home/sujoy/ffmpeg/libavcodec/libfaac.c:54: undefined reference to `faacEncClose'
/home/sujoy/ffmpeg/libavcodec/libfaac.c:102: undefined reference to `faacEncGetDecoderSpecificInfo'
/usr/local/lib/libavcodec.a(libfaad.o): In function `faac_decode_init':
/home/sujoy/ffmpeg/libavcodec/libfaad.c:252: undefined reference to `NeAACDecOpen'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:253: undefined reference to `NeAACDecClose'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:254: undefined reference to `NeAACDecGetCurrentConfiguration'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:255: undefined reference to `NeAACDecSetConfiguration'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:256: undefined reference to `NeAACDecInit'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:257: undefined reference to `NeAACDecInit2'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:258: undefined reference to `NeAACDecDecode'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:260: undefined reference to `NeAACDecGetErrorMessage'
/home/sujoy/ffmpeg/libavcodec/libfaad.c:274: undefined reference to `NeAACDecOpen'
/usr/local/lib/libavcodec.a(libmp3lame.o): In function `MP3lame_encode_frame':
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:160: undefined reference to `lame_encode_buffer'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:152: undefined reference to `lame_encode_buffer_interleaved'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:170: undefined reference to `lame_encode_flush'
/usr/local/lib/libavcodec.a(libmp3lame.o): In function `MP3lame_encode_close':
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:212: undefined reference to `lame_close'
/usr/local/lib/libavcodec.a(libmp3lame.o): In function `MP3lame_encode_init':
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:48: undefined reference to `lame_init'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:50: undefined reference to `lame_set_in_samplerate'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:51: undefined reference to `lame_set_out_samplerate'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:52: undefined reference to `lame_set_num_channels'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:56: undefined reference to `lame_set_quality'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:59: undefined reference to `lame_set_mode'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:60: undefined reference to `lame_set_brate'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:66: undefined reference to `lame_set_bWriteVbrTag'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:67: undefined reference to `lame_set_disable_reservoir'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:68: undefined reference to `lame_init_params'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:71: undefined reference to `lame_get_framesize'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:54: undefined reference to `lame_set_quality'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:79: undefined reference to `lame_close'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:62: undefined reference to `lame_set_brate'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:63: undefined reference to `lame_set_VBR'
/home/sujoy/ffmpeg/libavcodec/libmp3lame.c:64: undefined reference to `lame_set_VBR_q'
/usr/local/lib/libavcodec.a(libtheoraenc.o): In function `encode_frame':
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:203: undefined reference to `theora_encode_YUVin'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:222: undefined reference to `theora_encode_packetout'
/usr/local/lib/libavcodec.a(libtheoraenc.o): In function `encode_close':
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:252: undefined reference to `theora_encode_packetout'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:253: undefined reference to `theora_clear'
/usr/local/lib/libavcodec.a(libtheoraenc.o): In function `encode_init':
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:89: undefined reference to `theora_info_init'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:124: undefined reference to `theora_encode_init'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:130: undefined reference to `theora_info_clear'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:142: undefined reference to `theora_encode_header'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:148: undefined reference to `theora_comment_init'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:149: undefined reference to `theora_encode_comment'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:154: undefined reference to `theora_comment_clear'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:157: undefined reference to `ogg_packet_clear'
/home/sujoy/ffmpeg/libavcodec/libtheoraenc.c:160: undefined reference to `theora_encode_tables'
/usr/local/lib/libavcodec.a(libx264.o): In function `X264_frame':
/home/sujoy/ffmpeg/libavcodec/libx264.c:105: undefined reference to `x264_encoder_encode'
/usr/local/lib/libavcodec.a(libx264.o): In function `X264_close':
/home/sujoy/ffmpeg/libavcodec/libx264.c:144: undefined reference to `x264_encoder_close'
/usr/local/lib/libavcodec.a(libx264.o): In function `X264_init':
/home/sujoy/ffmpeg/libavcodec/libx264.c:155: undefined reference to `x264_param_default'
/home/sujoy/ffmpeg/libavcodec/libx264.c:285: undefined reference to `x264_encoder_open_76'
/home/sujoy/ffmpeg/libavcodec/libx264.c:295: undefined reference to `x264_encoder_headers'
/usr/local/lib/libavcodec.a(libxvidff.o): In function `ff_xvid_encode_frame':
/home/sujoy/ffmpeg/libavcodec/libxvidff.c:431: undefined reference to `xvid_encore'
/usr/local/lib/libavcodec.a(libxvidff.o): In function `ff_xvid_encode_close':
/home/sujoy/ffmpeg/libavcodec/libxvidff.c:481: undefined reference to `xvid_encore'
/usr/local/lib/libavcodec.a(libxvidff.o): In function `ff_xvid_encode_init':
/home/sujoy/ffmpeg/libavcodec/libxvidff.c:184: undefined reference to `xvid_global'
/home/sujoy/ffmpeg/libavcodec/libxvidff.c:271: undefined reference to `xvid_plugin_lumimasking'
/home/sujoy/ffmpeg/libavcodec/libxvidff.c:349: undefined reference to `xvid_encore'
/home/sujoy/ffmpeg/libavcodec/libxvidff.c:264: undefined reference to `xvid_plugin_single'
/home/sujoy/ffmpeg/libavcodec/libxvidff.c:255: undefined reference to `xvid_plugin_2pass2'
/usr/local/lib/libavcodec.a(libxvid_rc.o): In function `ff_xvid_rate_control_uninit':
/home/sujoy/ffmpeg/libavcodec/libxvid_rc.c:146: undefined reference to `xvid_plugin_2pass2'
/usr/local/lib/libavcodec.a(libxvid_rc.o): In function `ff_xvid_rate_estimate_qscale':
/home/sujoy/ffmpeg/libavcodec/libxvid_rc.c:127: undefined reference to `xvid_plugin_2pass2'
/home/sujoy/ffmpeg/libavcodec/libxvid_rc.c:119: undefined reference to `xvid_plugin_2pass2'
/usr/local/lib/libavcodec.a(libxvid_rc.o): In function `ff_xvid_rate_control_init':
/home/sujoy/ffmpeg/libavcodec/libxvid_rc.c:80: undefined reference to `xvid_plugin_2pass2'
/usr/local/lib/libavcodec.a(pthread.o): In function `avcodec_thread_free':
/home/sujoy/ffmpeg/libavcodec/pthread.c:95: undefined reference to `pthread_join'
/usr/local/lib/libavcodec.a(pthread.o): In function `avcodec_thread_init':
/home/sujoy/ffmpeg/libavcodec/pthread.c:159: undefined reference to `pthread_create'
collect2: ld returned 1 exit status

zelalem
September 25th, 2009, 09:52 AM
Hi FakeOutdoorsman, I followed your step and when I issue the following command I got a series of errors that are listed after the command:

sudo apt-get purge ffmpeg x264 libx264-dev


apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by apt-get)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by apt-get)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by apt-get)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by /usr/lib/libapt-pkg-libc6.7-6.so.4.6)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by /usr/lib/libapt-pkg-libc6.7-6.so.4.6)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by /usr/lib/libapt-pkg-libc6.7-6.so.4.6)
apt-get: relocation error: /usr/lib/libapt-pkg-libc6.7-6.so.4.6: symbol _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13ba sic_ostreamIT_T0_ES6_PKS3_i, version GLIBCXX_3.4.9 not defined in file libstdc++.so.6 with link time reference

What could be the reason.

Thank you.

Zelalem

FakeOutdoorsman
September 25th, 2009, 06:48 PM
Hi

I have successfully installed FFMPEG from source following your directions. Thanks for that.

I tried writing a simple program to test how it works (attached below)
I get a whole list of errors (attached below). Seems there are too many undefined things. Am I missing out setting some env variables etc.

Looking forward to your help!

tvkpz

This goes beyond my experience with FFmpeg. This would be a question to ask the FFmpeg libav-user (http://ffmpeg.org/contact.html) mailing list and perhaps the #ffmpeg IRC channel. I'm sorry that I can't be more helpful.

FakeOutdoorsman
September 25th, 2009, 06:56 PM
Hi FakeOutdoorsman, I followed your step and when I issue the following command I got a series of errors that are listed after the command:

sudo apt-get purge ffmpeg x264 libx264-dev


apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by apt-get)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by apt-get)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by apt-get)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by /usr/lib/libapt-pkg-libc6.7-6.so.4.6)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by /usr/lib/libapt-pkg-libc6.7-6.so.4.6)
apt-get: /usr/local/lib/libstdc++.so.6: no version information available (required by /usr/lib/libapt-pkg-libc6.7-6.so.4.6)
apt-get: relocation error: /usr/lib/libapt-pkg-libc6.7-6.so.4.6: symbol _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13ba sic_ostreamIT_T0_ES6_PKS3_i, version GLIBCXX_3.4.9 not defined in file libstdc++.so.6 with link time reference

What could be the reason.

Thank you.

Zelalem

This seems more like an Ubuntu package management issue and I'm unsure what would have caused this. A possibly related bug report:

Bug #180160 in apt (Ubuntu): cannot run apt-get after upgrading to ubuntu 8.04 (https://bugs.launchpad.net/ubuntu/+source/apt/+bug/180160)

In your previous forum thread, Need help with ffmpeg installation (http://ubuntuforums.org/showthread.php?t=1272361), someone suggested that you make some changes to your .bashrc file. I am guessing, but this may have caused your error. Also, in that same thread you said, "I installed all the dependencies and ffmpeg". If you followed an FFmpeg installation guide, can you give me the link? I would like to check if the guide may have caused your errors somehow.

zelalem
September 26th, 2009, 11:27 AM
Hi FakeOutdoorsman, you are right it relates to ubuntu package management. I remember getting this e-mail long time ago but didn't know how i solved it. I might have tweked it. Anyway, I will try to check out the link you proposed and come back here if I got any problem.

Thank you again for the good work.

Best regards,

Zelalem

TuxProbe
September 27th, 2009, 04:33 AM
Movie time! :popcorn:

Hi all and thanks to authors of these very helpful howto's! I'd like to add to it an automation of things - customizable configuring by setting some variables defined in a Makefile.

It includes automated fetch, configure, compile and install each of the following targets:
x264,
live,
amr,
ffmpeg

Issuing the following will ultimately result in the four .deb packages being installed and mplayer ready to be built


make && sudo make install

While waiting turn on your favourite soapopera.. Of course at one point, you'll be prompted for sudo access :)

After de-/en-coders have been compiled and installed - mplayer can be rebuilt from svn. Specific make-targets are available for this, issue the following.


make mplayer && sudo make mplayer-install

Optionally trying to pull out a few more frames pr second on a multiprocessor system, use this statement while building mplayer:


make mplayer-mt && sudo make mplayer-install

The following code is to be copied into 'Makefile', use your fav. editor and save it to a separate dir (as andrew, im no big fan of buildchains deployed in $(HOME) :P )



################################################## #############################
### Automated Makefile for building a 'very-latest' mplayer package. ###
### suited for use on intrepid / jaunty ubuntu releases. ###
### Script was written by <Morten Sigsgaard Christensen> mschr@es.aau.dk. ###
### Distribute and use freely, but without warrenty. ###
### ###
### The following threads on ubuntuforums have been used as references. ###
### Thanks to Andrew.46, http://ubuntuforums.org/showthread.php?t=1081070 ###
### ###
### Runesvend pointed out how to make us of multithreaded decoding, ###
### see his thread: http://ubuntuforums.org/showthread.php?t=1049449 ###
### Replace 'make mplayer' with 'make mplayer-mt' to patch the av* sources. ###
### ###
### Set your ./configure options according to the targets below. ###
### If at some point mplayer.hu releases a new codecpack set CODECS_URL ###
################################################## #############################

# Target directory for generated .deb packages
PKGDIR=`pwd`

# Miscellaneous urls to fetch from
CODECS_URL="http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2"
LIVE_URL="http://www.live555.com/liveMedia/public/live555-latest.tar.gz"
# NB: repositories have been hardcodet, hopefully wont change

# Any configure options sent to ./configure
AMR_CFGOPTIONS=
X264_CFGOPTIONS=--prefix=/usr --enable-mp4-output --enable-shared
FFMPEG_CFGOPTIONS=--enable-gpl --enable-nonfree \
--enable-pthreads --enable-libfaac --enable-libfaad --enable-libvorbis \
--enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid \
--enable-x11grab --enable-libopencore-amrwb --enable-libopencore-amrnb \
--enable-version3
MPLAYER_CFGOPTIONS=--confdir=/etc/mplayer

################################################## #############################
### Output veriables, only for easy-readable maketarget-code ###
################################################## #############################
mpl_aptcmd="sudo apt-get install debhelper em8300-headers gawk gettext html2text \
intltool-debian ladspa-sdk libaa1-dev libasound2-dev libatk1.0-dev libaudio-dev \
libaudio2 libaudiofile-dev libavahi-client-dev libavahi-common-dev libcaca-dev \
libcairo2-dev libcdparanoia-dev libcelt0 libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev \
libdirectfb-extra libdts-dev libdv4-dev libenca-dev libenca0 libesd0-dev libexpat1-dev \
libfaac-dev libfaac0 libffado0 libfontconfig1-dev libfreebob0 libfreetype6-dev \
libfribidi-dev libggi-target-x libggi2 libggi2-dev libggimisc2 libggimisc2-dev \
libgif-dev libgii1 libgii1-dev libgii1-target-x libgl1-mesa-dev libglib2.0-dev \
libglu1-mesa-dev libgtk2.0-dev libice-dev libjack-dev libjack0 libjpeg62-dev \
liblzo-dev liblzo1 liblzo2-2 liblzo2-dev libmad0-dev libmail-sendmail-perl \
libmp3lame-dev libmp3lame0 libmpcdec-dev libmpcdec3 libncurses5-dev libogg-dev \
libopenal-dev libopenal1 libpango1.0-dev libpixman-1-dev libpng12-dev libpopt-dev \
libpthread-stubs0 libpthread-stubs0-dev libpulse-dev libpulse-mainloop-glib0 \
libsdl1.2-dev libslang2-dev libsm-dev libsmbclient-dev libspeex-dev libsvga1 \
libsvga1-dev libsys-hostname-long-perl libsysfs-dev libtheora-dev libtwolame-dev \
libtwolame0 libvorbis-dev libx11-dev libxau-dev libschroedinger-dev libstdc++5 \
libxcb-render-util0-dev libxcb-render0-dev libxcb1-dev libxcomposite-dev \
libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev \
libxi-dev libxinerama-dev libxml++2.6-2 libxrandr-dev libxrender-dev libxt-dev \
libxv-dev libxvidcore4-dev libxvmc-dev libxxf86dga-dev libxxf86vm-dev mesa-common-dev \
po-debconf sharutils x11proto-composite-dev x11proto-core-dev x11proto-damage-dev \
x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev \
x11proto-render-dev x11proto-video-dev x11proto-xext-dev x11proto-xf86dga-dev \
x11proto-xf86vidmode-dev x11proto-xinerama-dev xtrans-dev zlib1g-dev \
liboil0.3-dev libcddb2-dev"

# mtime checks for non-repos
modified_on_amr=`stat opencore-amr | head -n 7 | tail -n 1 | cut -d " " -f2`
modified_on_live=`stat live | head -n 7 | tail -n 1 | cut -d " " -f2`
now=`date +%Y-%m-%d`
# a bit of coloured output
eprefix=echo -en '\e[1;34m---------------------------------------------------------------------------------------------------\e[0m\n\e[1;34m-- \e[0m'
epostfix=echo -e '\e[1;34m---------------------------------------------------------------------------------------------------\e[0m'


################################################## #############################
### Global targets ###
################################################## #############################


all: dependencies fetch config compile
@bash -c 'echo -en "\e[1;34m#\e[0m "'
@echo "Codecs have been prepared! Run the following to make em available for mplayer build"
@bash -c 'echo -e "\t\e[0;36msudo make install\e[0m"'
@bash -c 'echo -en "\e[1;34m#\e[0m "'
@echo "Then issue"
@bash -c 'echo -e "\t\e[0;36mmake mplayer mplayer-install\e[0m"'

dependencies:
@bash -c "${eprefix}"
@echo "Removing known conflicting packages"
@bash -c "${epostfix}"
sudo apt-get remove mplayer-nogui ffmpeg || echo Ok seems fine

@bash -c "${eprefix}"
@echo "Installing all dependencies"
@bash -c "${epostfix}"
@bash -c "${mpl_aptcmd1}"
fetch:
make amr-fetch live-fetch x264-fetch ffmpeg-fetch
config:
make amr-config live-config x264-config ffmpeg-config
compile:
@bash -c "${eprefix}"
@echo "AMR COMPILE"
@bash -c "${epostfix}"
make --directory opencore-amr 1> /dev/null
@bash -c "${eprefix}"
@echo "x264 COMPILE"
@bash -c "${epostfix}"
make --directory x264 1> /dev/null
@bash -c "${eprefix}"
@echo "LIVE COMPILE"
@bash -c "${epostfix}"
make --directory live 1> /dev/null
@bash -c "${eprefix}"
@echo "FFMPEG COMPILE"
@bash -c "${epostfix}"
make --directory ffmpeg 1> /dev/null || bash -c 'echo -e "\t\e[0;36m Trying to fix ownership\e[0m" && sudo chown ${USER} ffmpeg/* && make --directory ffmpeg'
install:
@bash -c "${eprefix}"
@echo "Starting install (amr, live, x264 & ffmpeg)"
@bash -c "${epostfix}"
make amr-install
make live-install
make x264-install
make ffmpeg-install
@bash -c "${eprefix}"
@echo "Codecs installed, now compile mplayer against em"
@bash -c 'echo -e "\t\e[0;36m make mplayer && sudo make mplayer-install\e[0m"'
@bash -c "${epostfix}"
clean:
make --directory opencore-amr distclean
make --directory live distclean
make --directory x264 distclean
make --directory ffmpeg distclean
make --directory mplayer distclean


################################################## #############################
### Encoder / decoder specific targets ###
################################################## #############################






amr-fetch:
@bash -c "${eprefix}"
@echo "AMR FETCH"
@bash -c "${epostfix}"
if [ "$(modified_on_amr)" != "$(now)" ]; then rm -fr opencore-amr && git clone --depth=1 \
git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/opencore-amr; fi
amr-config:
@bash -c "${eprefix}"
@echo "AMR CONFIG"
@bash -c "${epostfix}"
cd opencore-amr && ./configure ${AMR_CFGOPTIONS}
amr-install:
@bash -c "${eprefix}"
@echo "AMR INSTALL"
@bash -c "${epostfix}"
cd opencore-amr && sudo checkinstall --fstrans=no --install=yes --pakdir "${PKGDIR}" \
--maintainer "${USER}" --pkgname="libopencore-amr" --pkgversion="9999_$(date +%Y%m%d)" \
--backup=no --deldoc=yes --deldesc=yes --delspec=yes --gzman --default && cp *.deb ${PKGDIR}

live-fetch:
@bash -c "${eprefix}"
@echo "LIVE FETCH"
@bash -c "${epostfix}"
if [ "$(modified_on_live)" != "$(now)" ]; then rm -fr live && wget ${LIVE_URL} > `tty` && tar xf `basename ${LIVE_URL}` && rm `basename ${LIVE_URL}`; fi
live-config:
@bash -c "${eprefix}"
@echo "LIVE CONFIG"
@bash -c "${epostfix}"
cd live && ./genMakefiles linux
live-install:
@bash -c "${eprefix}"
@echo "LIVE INSTALL"
@bash -c "${epostfix}"
@rm $(ls live/config.[^lbu]*) 2> /dev/null || echo -O4
sudo cp -r live /usr/lib

x264-fetch:
@bash -c "${eprefix}"
@echo "x264 FETCH"
@bash -c "${epostfix}"
@test -d x264 || git clone git://git.videolan.org/x264.git > `tty`
@cd x264 && git pull > `tty`
x264-config:
@bash -c "${eprefix}"
@echo "x264 CONFIG"
@bash -c "${epostfix}"
cd x264 && ./configure ${X264_CFGOPTIONS}
x264-install:
@bash -c "${eprefix}"
@echo "x264 INSTALL"
@bash -c "${epostfix}"
cd x264 && sudo checkinstall --fstrans=no --install=yes --pakdir "${PKGDIR}" \
--maintainer "${USER}" --pkgname=x264 --pkgversion "9999_$(date +%Y%m%d)" \
--backup=no --deldoc=yes --deldesc=yes --delspec=yes --gzman --default && cp *.deb ${PKGDIR}


ffmpeg-fetch:
@bash -c "${eprefix}"
@echo "FFMPEG FETCH"
@bash -c "${epostfix}"
@test -d ffmpeg || svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg > `tty`
@cd ffmpeg && svn up > `tty`
ffmpeg-config:
@bash -c "${eprefix}"
@echo "FFMPEG CONFIG"
@bash -c "${epostfix}"
cd ffmpeg && ./configure ${FFMPEG_CFGOPTIONS}
ffmpeg-install:
@bash -c "${eprefix}"
@echo "FFMPEG INSTALL"
@bash -c "${epostfix}"
cd ffmpeg && sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg \
--pkgversion "9999_$(date +%Y%m%d)" --default && cp *.deb ${PKGDIR}

################################################## #############################
### MPlayer specific targets ###
################################################## #############################

mplayer: mplayer-fetch mplayer-config
@bash -c "${eprefix}"
@echo "MPLAYER COMPILE"
@bash -c "${epostfix}"
make --directory mplayer
#done, use make %MAKETARGET%-install to apply package

mplayer-config:
@bash -c "${eprefix}"
@echo "MPLAYER CONFIG"
@bash -c "${epostfix}"
cd mplayer && ./configure ${MPLAYER_CFGOPTIONS}

mplayer-fetch:
@bash -c "${eprefix}"
@echo "MPLAYER FETCH"
@bash -c "${epostfix}"
test -d mplayer || svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer && svn update

mplayer-mt: mplayer-fetch mplayer-patch-mt mplayer-config mplayer

mplayer-patch-mt:
@bash -c "${eprefix}"
@echo "MPLAYER PATCH"
@echo "(deploys ffmpeg-mt repo temporarily and overwrites av* src files in mplayer"
@bash -c "${epostfix}"
@test -d ffmpeg-mt || git clone http://git.gitorious.org/ffmpeg/ffmpeg-mt.git > `tty`
@cd ffmpeg-mt && git pull http://git.gitorious.org/ffmpeg/ffmpeg-mt.git > `tty`
@make --directory mplayer distclean
rm -rf mplayer/libavcodec mplayer/libavformat mplayer/libavutil
cp -a ffmpeg-mt/libavcodec ffmpeg-mt/libavformat ffmpeg-mt/libavutil mplayer
#@rm -fr ffmpeg-mt
mplayer-install:
@bash -c "${eprefix}"
@echo "MPLAYER (codec) INSTALL"
@bash -c "${epostfix}"
@test -f `basename ${CODECS_URL}` || wget ${CODECS_URL}
mkdir -pv /usr/lib/codecs
tar xjf `basename ${CODECS_URL}`
cp -v `echo $(shell basename ${CODECS_URL}|sed 's/\.tar.*//')`/* /usr/lib/codecs
rm `basename ${CODECS_URL}`
@bash -c "${eprefix}"
@echo "MPLAYER (binaries) INSTALL"
@bash -c "${epostfix}"
cd mplayer && checkinstall -D --install=yes --fstrans=no --pakdir "${PKGDIR}" \
--pkgname mplayer --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
--maintainer "${USER}" --pkgversion "9999_$(grep "#define VERSION" version.h | cut -d"-" -f2)svn"
cp mplayer/*.deb ${PKGDIR}


Distribute freely, mail me if you have any questions - or post here, will try to monitor the thread. If others have success in using it also, feel free to use in ubuntu guides.

// Tuxprobe

arnab_das
September 28th, 2009, 09:40 PM
i am getting an error saying i need to install "ffplay" when i try converting anything with winff.

why is that?

FakeOutdoorsman
September 29th, 2009, 12:46 AM
i am getting an error saying i need to install "ffplay" when i try converting anything with winff.

why is that?

What version of Ubuntu are you using? FFplay needs the libsdl1.2-dev package as a dependency, so you need to install this before compiling FFmpeg. The guide on the first page of this thread for Intrepid and Hardy include this file in Step 2, but the guides for Hardy and Dapper put the package under "optional dependencies". I just did a test run of the first page guide and FFplay is installed successfully.


thank u so very much for writing such an awesome article. but can i delete the ffmpeg and x264 folders (under home directory) which have been created? they're consuming around 300mb.

Yes, you can delete these directories, but they are useful to keep if you ever want to upgrade x264 and FFmpeg. See the Updating Your Installation section of this guide.

Crosslinked to:
ffplay missing (http://ubuntuforums.org/showthread.php?t=1277681)
Re: Update ffmpeg (http://ubuntuforums.org/showthread.php?t=1277460)
Re: Any good video converter? (http://ubuntuforums.org/showthread.php?t=1275971)

arnab_das
September 29th, 2009, 08:56 AM
What version of Ubuntu are you using? FFplay needs the libsdl1.2-dev package as a dependency, so you need to install this before compiling FFmpeg. The guide on the first page of this thread for Intrepid and Hardy include this file in Step 2, but the guides for Hardy and Dapper put the package under "optional dependencies". I just did a test run of the first page guide and FFplay is installed successfully.



Yes, you can delete these directories, but they are useful to keep if you ever want to upgrade x264 and FFmpeg. See the Updating Your Installation section of this guide.

Crosslinked to:
ffplay missing (http://ubuntuforums.org/showthread.php?t=1277681)
Re: Update ffmpeg (http://ubuntuforums.org/showthread.php?t=1277460)

i installed winff after installing ffmpeg. then i tried converting a video with it.
and here's the error i find. i have installed libsdl1.2-dev as u can see in the synaptic.

whats the problem here?

http://i692.photobucket.com/albums/vv287/frnd08/Screenshot-3.png

FakeOutdoorsman
September 29th, 2009, 06:40 PM
i installed winff after installing ffmpeg. then i tried converting a video with it.
and here's the error i find. i have installed libsdl1.2-dev as u can see in the synaptic.

whats the problem here?

As paul.gevers mentioned in Re: Update ffmpeg (http://ubuntuforums.org/showpost.php?p=8024513&postcount=5) and in Re: Any good video converter? (http://ubuntuforums.org/showpost.php?p=8024501&postcount=7) If you're using WinFF from the repository you will need to go to WinFF -> Edit -> Preferences -> Linux Tab. In the Path to FFplay Executable box, enter:

/usr/local/bin/ffplay

WinFF is looking for FFplay in /usr/bin where repository FFplay gets installed, but this guide compiles FFmpeg and FFplay to /usr/local/bin to keep from conflicting with repository packages.

Also, you have asked this question in four different threads and I recommend just asking in one next time. Your question will be seen, you won't have people repeating answers, and it will be easier to follow.

Anyway, I quickly tested this with my compiled FFmpeg and WinFF from the repository and it seemed to work after I changed the path to the correct location as paul.gevers mentioned.

arnab_das
September 29th, 2009, 08:25 PM
As paul.gevers mentioned in Re: Update ffmpeg (http://ubuntuforums.org/showpost.php?p=8024513&postcount=5) and in Re: Any good video converter? (http://ubuntuforums.org/showpost.php?p=8024501&postcount=7) If you're using WinFF from the repository you will need to go to WinFF -> Edit -> Preferences -> Linux Tab. In the Path to FFplay Executable box, enter:

/usr/local/bin/FFplayWinFF is looking for FFplay in /usr/bin where repository FFplay gets installed, but this guide compiles FFmpeg and FFplay to /usr/local/bin to keep from conflicting with repository packages.

Also, you have asked this question in four different threads and I recommend just asking in one next time. Your question will be seen, you won't have people repeating answers, and it will be easier to follow.

Anyway, I quickly tested this with my compiled FFmpeg and WinFF from the repository and it seemed to work after I changed the path to the correct location as paul.gevers mentioned.

thanks. actually i changed the ffmpeg and ffplay location to "/usr/local/bin/ffmpeg" (-path to ffmpeg executable) and "/usr/local/bin/FFplay" (-path to ffplay executable) and "/usr/bin/x-terminal-emulator" (-terminal to run ffmpeg). is this the correct setting?

winff is working okay at the moment

P.S.- i apologise multiple posts. wont happen again.

FakeOutdoorsman
September 30th, 2009, 06:57 PM
thanks. actually i changed the ffmpeg and ffplay location to "/usr/local/bin/ffmpeg" (-path to ffmpeg executable) and "/usr/local/bin/FFplay" (-path to ffplay executable) and "/usr/bin/x-terminal-emulator" (-terminal to run ffmpeg). is this the correct setting?

winff is working okay at the moment

P.S.- i apologise multiple posts. wont happen again.

That may work, but the FFplay binary file is spelled "ffplay", so your path in WinFF should be "/usr/local/bin/ffplay". I capitalized it by mistake in my earlier post.

arnab_das
September 30th, 2009, 07:34 PM
That may work, but the FFplay binary file is spelled "ffplay", so your path in WinFF should be "/usr/local/bin/ffplay". I capitalized it by mistake in my earlier post.

okey dokey. thanks a lot mate.

rahul23
October 1st, 2009, 06:45 PM
php5-ffmpeg extension of php requires , ffmpeg to be compiled as shared , I installed successfully ffmpeg this method but got error while compiling php5-fmpeg

"ffmpeg: error while loading shared libraries: libavutil.so.50: cannot open
shared object file: No such file or directory"

Can you please solve my problem
thanks.

FakeOutdoorsman
October 1st, 2009, 07:14 PM
php5-ffmpeg extension of php requires , ffmpeg to be compiled as shared , I installed successfully ffmpeg this method but got error while compiling php5-fmpeg


"ffmpeg: error while loading shared libraries: libavutil.so.50: cannot open
shared object file: No such file or directory"

Can you please solve my problem
thanks.

Unfortunately I have no experience with php5-ffmpeg. I'm unsure if php5-ffmpeg will even recognize the shared libraries from a compiled FFmpeg SVN. Did you enable sharing on FFmpeg? The FFmpeg configure line requires "--enable-shared". After you install FFmpeg, you need to run "sudo ldconfig". I don't really know what I'm talking about here because shared FFmpeg and Ubuntu package management are not my strong points.

I have no idea what version of Ubuntu you're using, but why not install php5-ffmpeg with FFmpeg and libavcodec-unstripped-5* (to enable restricted encoders) from the repository?