Page 31 of 234 FirstFirst ... 2129303132334181131 ... LastLast
Results 301 to 310 of 2332

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

  1. #301
    Join Date
    Dec 2006
    Beans
    7,034

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

    Hi,

    Quote Originally Posted by FakeOutdoorsman View Post
    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:

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


    Code:
    #!/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
    Last edited by andrew.46; January 29th, 2009 at 09:40 AM.
    You think that's air you're breathing now?

  2. #302
    Join Date
    Sep 2006
    Beans
    548

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

    Quote Originally Posted by HalNineThousand View Post
    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.

  3. #303
    Join Date
    Dec 2006
    Beans
    7,034

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

    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:

    Code:
    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:

    Code:
    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:

    Code:
    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
    You think that's air you're breathing now?

  4. #304
    Join Date
    Sep 2006
    Beans
    3,513

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

    Quote Originally Posted by andrew.46 View Post
    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.

  5. #305
    Join Date
    Oct 2005
    Beans
    12

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

    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
    Last edited by Halfwalker; February 17th, 2009 at 01:04 AM. Reason: Show process to build

  6. #306
    Join Date
    Sep 2006
    Beans
    3,513

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

    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.

  7. #307
    Join Date
    Oct 2005
    Beans
    12

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

    Quote Originally Posted by FakeOutdoorsman View Post
    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
    Code:
    	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
    Code:
    	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
    Code:
    	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
    Code:
    	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 ...
    Code:
    	sudo apt-get install mjpegtools
    results in this ...
    Code:
    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.

  8. #308
    Join Date
    Oct 2005
    Beans
    12

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

    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

    Code:
        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.

  9. #309
    Join Date
    May 2008
    Beans
    40

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

    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

  10. #310
    Join Date
    Sep 2006
    Beans
    3,513

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

    Quote Originally Posted by Halfwalker View Post
    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

    Code:
        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.

Page 31 of 234 FirstFirst ... 2129303132334181131 ... 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
  •