The information for this is VERY very sparse, so here is a summary of what I have found.

Install libx264

Get the libx264 package from here: http://www.videolan.org/developers/x264.html

Extracts the bz2 file

1
tar -xjvf /path/to/x264-snapshot-20080805-2245.tar.bz2

And now the useual

1
2
3
4
5
cd /path/to/x264-dir
./configure --enable-shared
make
make install
ldconfig

Get a nice error message:

1
2
3
[root@dev01 x264-snapshot-20080805-2245]# ./configure
No suitable assembler found.  Install 'yasm' to get MMX/SSE optimized code.
If you really want to compile without asm, configure with --disable-asm.

You do want MMX/SSE at somepoint for the time being I am disabling this though (lack of time to find a valid RHEL source). so I added the disable asm line.

Install ffmpeg

For this I use subversion.

1
2
3
4
5
6
cd /path/to/where/I/want/sources
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd /path/to/where/I/want/sources/ffmpeg
./configure --enable-libx264 --enable-gpl --enable-shared
make
make install

et voila ffmpeg is now installed with libx264 (h264).


error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

To fix this:

1
vi /etc/ld.so.conf.d/custom-libs.conf

Add the line : /usr/local/lib

And run ldconfig.

UPDATE: I am writing a full set of notes blog entry for installing ffmpeg with codecs on RHEL4

Tags: , ,
17 Responses to “ffmpeg install with libx264 (h264)”
  1. ymark says:

    I have done all the steps…but when i’m trying to run ffmpeg i have this error :

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

  2. Buzz says:

    ymark you are missing libavutil.

    Installing it should resolve the problem you are having.

  3. Unni says:

    Thanks a lot.

    The information was really useful :)

  4. Unni says:

    Some error occurred during making ffmpeg… in V4l …

    So i used
    # ./configure –enable-libx264 –enable-gpl –enable-shared –disable-muxer=v4l –disable-demuxer=v4l

  5. Anilmwr says:

    I am using Fedora 11.

    /etc/ld.so.conf ddn’t include dir “/usr/local/lib”.

    So I added it to /etc/ld.so.conf and issued ldconfig.

    Works fine after that.

  6. Buzz says:

    @Anilmwr

    This entry did say how to solve the fact ‘/usr/local/lib’ was not being included by ldconfig:


    error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

    To fix this:

    vi /etc/ld.so.conf.d/custom-libs.conf

    Add the line : /usr/local/lib

    And run ldconfig.

    ;-)

    Cheers

    Buzz

  7. Juan says:

    Hi, I am trying to build ffmpeg from source following this tutorial. Unfortunately, ffmpeg will not build.

    /home/juanjavier/ffmpeg/ffmpeg/libavcodec/libavcodec.so: undefined reference to `x264_encoder_open_77′
    collect2: ld returned 1 exit status
    make: *** [ffmpeg_g] Error 1
    rm ffmpeg.o

    Any help on this?

  8. Buzz says:

    HI Juan,

    As my instructions above show I was using a snapshot from the daily builds, more than likely the build you downloaded included some bugged code, either download an older version or try a newer one to see if this issue persists.

    Or you can always contact the developers at videolan.

    Cheers

    buzz

  9. codechimp says:

    Thanks buzz, great info.
    For googlers:
    I achieved the same on ubuntu/karmic by installing the ‘unrestricted’ ffmpeg libraries by the doing the following apt-gets

    libavutil-extra-49
    libavfilter-extra-0
    libswscale-extra-0
    libavdevice-extra-52
    libavcodec-extra-52
    libavformat-extra-52

    now I can do:
    ffmpeg -f video4linux2 -s 640×480 -r 30 -b 600k -i /dev/video0 -vcodec libx264 -f flv videocapture/test.flv
    this is an excellent encoder

    Hope it helps someone out….

  10. Steve says:

    Just the stuff I was looking for! Thanks, worked great for me.

  11. kevin says:

    This shed light upon my greatest Linux-related questions. At last taught me how to use subversions, and compiling and assembling. Thank you! Btw, I was trying to install VLC manually :)

  12. [...] for mac It explained the need to install lame, faac, and faad before ffmpeg. I would also recommend installing libx264 though I feel like it should have already been there, but things worked after I did [...]

  13. joey says:

    YES!!!! This post has helped me a lot and made me very HAPPY :) :)

    MANY THANKS

  14. vijesh says:

    Hi all,

    While giving the following command fatal error occured… pls help

    [root@test x264-snapshot-20110104-2245] # ./configure –enable-shared

    The output is

    fatal: Not a git repository
    Platform: X86
    System: LINUX
    asm: yes
    avs: no
    lavf: no
    ffms: no
    gpac: no
    gpl: yes
    thread: posix
    filters: resize crop select_every
    debug: no
    gprof: no
    PIC: no
    shared: yes
    visualize: no
    bit depth: 8

    You can run ‘make’ or ‘make fprofiled’ now.

    Please help.

    Thanks in advance..

  15. Kani says:

    I was in need and your instructions helped me.

    THANKS

  16. Michela says:

    Thanks so much for this post revealing the existence (to me at least!) of custom-libs.conf

  17.  
Leave a Reply