Page 1 of 241 1231151101 ... LastLast
Results 1 to 10 of 2402

Thread: HOWTO: Install and use the latest FFmpeg and x264

  1. #1
    Join Date
    Sep 2006
    Beans
    3,713

    HOWTO: Install and use the latest FFmpeg and x264

    This guide has been moved to the official FFmpeg wiki:

    How to Compile FFmpeg and x264 on Ubuntu

    The guide will be kept up to date and all supported Ubuntu versions will be included.
    Last edited by FakeOutdoorsman; December 3rd, 2014 at 05:19 AM. Reason: update URL

  2. #2
    Join Date
    Jan 2005
    Location
    Baltimore, MD, USA
    Beans
    865
    Distro
    Ubuntu Development Release

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Great guide. Thanks a lot. One problem:

    When I configure x264 I get the error:
    Code:
    ./configure --enable-pthread --enable-mp4-output --enable-shared
    No suitable assembler found.  x264 will be several times slower.
    Please install 'yasm' to get MMX/SSE optimized code.
    I tried nasm and yasm from the repos but they didn't work

    But I figured it out!

    All I had to do was go to:
    http://www.tortall.net/projects/yasm/wiki/Download

    Grab the 0.7.0 tarball, then ./configure, make, sudo checkinstall, then build x264, then ffmpeg. Now I can encode much faster.

    A note to those who are interested:

    I used the ffmpeg encoding script:
    Code:
    #!/bin/sh
    ffmpeg -i $1 -y -an -pass 1 -vcodec libx264 -threads 4 -b 1024kbps -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me epzs -subq 1 -trellis 0 -refs 1 -bf 3 -b_strategy 1 -coder 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 $2
    
    ffmpeg -i $1 -y -acodec libfaac -ab 128k -pass 2 -vcodec libx264 -threads 4 -b 1024kbps -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +mixed_refs -me umh -subq 5 -trellis 1 -refs 5 -bf 3 -b_strategy 1 -coder 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 $2
    Which can be run:
    Code:
    ./scriptname myfile.avi myfile.mp4
    And the result plays in Flash 9 using their h264 playback stuff. Pretty neat and high quality too.
    Knowledge is half the battle.
    The other half is violence!

  3. #3
    Join Date
    Sep 2006
    Beans
    3,713

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Quote Originally Posted by Paerez View Post
    Great guide. Thanks a lot. One problem:

    When I configure x264 I get the error:
    Code:
    ./configure --enable-pthread --enable-mp4-output --enable-shared
    No suitable assembler found.  x264 will be several times slower.
    Please install 'yasm' to get MMX/SSE optimized code.
    I tried nasm and yasm from the repos but they didn't work

    ...
    Thanks for pointing that out. I'll update it with a section on yasm compilation. Was the error the same if you tried using just nasm?

    As of March 14, '08 (I think), x264 requires a newer yasm >= 0.6.0 than what is in the Ubuntu universe repository (yasm 0.5.0). x264 should fallback to nasm if yasm isn't detected and worked for me just fine despite the following error:
    Code:
    ./configure: 330: yasm: not found
    If I omitted nasm, I got the same error as you. I'm not sure why nasm worked for me and not for you.

    Before I wrote this tutorial I tested the speed of x264 either using a compiled yasm 0.7.0, nasm from the repository, or no assembler. The speed differences were very small between compiled yasm and nasm from the repo:
    x264/mencoder/ffmpeg on a dual quad core.

    Edit: Tutorial updated with yasm compilation.
    Last edited by FakeOutdoorsman; May 13th, 2008 at 12:11 AM.

  4. #4
    Join Date
    Jan 2005
    Location
    Baltimore, MD, USA
    Beans
    865
    Distro
    Ubuntu Development Release

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    I tried using both nasm and yasm from the repos, and x264 would compile but it would say it was building without support for yasm and nasm.

    Then, when I used it to convert a file it would say that it was using no cpu extensions, as opposed to saying "MMX SSE ...". It would also take significantly longer (like 2-5 times as long).

    But just installing the yasm from source fixed it, and it wasn't very difficult to do.
    Knowledge is half the battle.
    The other half is violence!

  5. #5
    Join Date
    Apr 2006
    Beans
    1

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Thanks a million. Great in depth job on this one.

  6. #6
    Join Date
    Jan 2008
    Beans
    2

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    This is a great howto, since in my opinion ffmpeg is broken due to these issues.

    Therefore, what are the additional steps to fully replace ffmpeg, x64 and the libx264 packages such that it satisfies dependencies for other applications that use ffmpeg and my update manager does not keep asking me to upgrade from the checkinstall packages?

  7. #7
    Join Date
    Jul 2005
    Beans
    10

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    When I try to "make" x264, I get this error.
    Code:
    /usr/bin/ld: common/mc.o: relocation R_X86_64_32S against `a local symbol' can not be used 
    when making a shared object; recompile with -fPIC
    common/mc.o: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: *** [libx264.so.60] Error 1
    I'm on 64-bit Ubuntu, is there something else I should be doing? Dunno what "-fPIC" means.

    UPDATE: Never mind. Cleaned up my folder of a previous failed build attempt and it seems to be okay now. Thanks for the guide!
    Last edited by Nais; June 26th, 2008 at 06:08 PM.

  8. #8
    Join Date
    Sep 2006
    Beans
    3,713

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Quote Originally Posted by d_mcqueen View Post
    This is a great howto, since in my opinion ffmpeg is broken due to these issues.

    Therefore, what are the additional steps to fully replace ffmpeg, x64 and the libx264 packages such that it satisfies dependencies for other applications that use ffmpeg and my update manager does not keep asking me to upgrade from the checkinstall packages?
    I believe your compiled versions should satisify as dependencies for other packages as long as the packages are named correctly and compiling options that are required by the parent package are enabled. I don't use update-manager so I can't give instruction on that, but you can try:
    Code:
    sudo aptitude hold ffmpeg
    If you prefer Synaptic, then select the package and then choose "Package -> Lock Version" from the menu. I haven't tested either of these commands, so I'm unsure how effective they are.

  9. #9
    Join Date
    Dec 2005
    Beans
    733
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Yes locking versions work but how about trying to get synaptic to see that you installed libx264 via the source code with checkinstall so far according to synaptic i only have x264 the binary installed and not libx264 and libx264-dev so now other multimedia apps will not install without using the repos version of libx264 if i try to install via synaptic

  10. #10
    Join Date
    Sep 2006
    Beans
    3,713

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Quote Originally Posted by cor2y View Post
    Yes locking versions work but how about trying to get synaptic to see that you installed libx264 via the source code with checkinstall so far according to synaptic i only have x264 the binary installed and not libx264 and libx264-dev so now other multimedia apps will not install without using the repos version of libx264 if i try to install via synaptic
    When you compile x264 it should create the same files that libx264 and libx264-dev would create. If you add "--prefix=/usr" to the x264 configure line then these files will also install in the same location as the repo versions instead of the default /usr/local/lib. I'm unsure how to get Synaptic or apt to recognize this. I'm out of town until July 4 and can't test anything until then.

Page 1 of 241 1231151101 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •