Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Monday, March 24, 2014

Replace libav with ffmpeg in LM16 / Ubuntu 13.10 (and Ubuntu 12.04 as well)

I prefer ffmpeg.  I think their compilation instructions are good, but wish to completely replace libav on my system and use ffmpeg exclusively (not just limited to a single user).  This isn't a post about why I make that choice, just a how I made it happen.

I have used the following pages in putting this how-to together:

I would love suggestions if there are ways to improve this process.

Compiling and Installation

Preparation

sudo apt-get update

sudo apt-get -y install checkinstall autoconf automake build-essential libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev yasm

mkdir ~/Downloads/ffmpeg

cd ~/Downloads/ffmpeg

wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 && tar xjvf last_x264.tar.bz2

wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master && unzip fdk-aac.zip

wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz && tar xzvf lame-3.99.5.tar.gz

wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz && tar xzvf opus-1.1.tar.gz

wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2 && tar xjvf libvpx-v1.3.0.tar.bz2

wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && tar xjvf ffmpeg-snapshot.tar.bz2

sudo apt-get --purge remove libav-tools

Ubuntu 12.04 ONLY, Installation: yasm 1.2

On Ubuntu 12.04 you need to compile the latest yasm, as the one in the repository is too old to work properly for the rest of the software compilations.

wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz && tar xzvf yasm-1.2.0.tar.gz

cd ./yasm-1.2.0

sudo apt-get remove yasm

./configure

make

sudo checkinstall --pkgname=yasm --pkgversion="2:1.2.0" --backup=no --deldoc=yes --fstrans=no --default

cd ../

Installing: libx264

cd ./x264-snapshot*

./configure --enable-static

make

sudo checkinstall --pkgname=libx264 --pkgversion="20140323-2245" --backup=no --deldoc=yes --fstrans=no --default

cd ../

Installing: libfdk-aac

cd mstorsjo-fdk-aac*

autoreconf -fiv

./configure --disable-shared

make

sudo checkinstall --pkgname=libfdk-aac --pkgversion="1.3" --backup=no --deldoc=yes --fstrans=no --default

cd ../

Installing: libopus

cd opus-1.1

./configure --disable-shared

make

sudo checkinstall --pkgname=libopus --pkgversion="1.1" --backup=no --deldoc=yes --fstrans=no --default

cd ../

Installing: libvpx

cd libvpx-v1.3.0

./configure --disable-examples

make

sudo checkinstall --pkgname=libvpx --pkgversion="1.3" --backup=no --deldoc=yes --fstrans=no --default

cd ../

Installing: ffmpeg

cd ffmpeg

./configure --extra-cflags="-I/usr/local/include" --extra-ldflags="-L/usr/local/lib" --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab --enable-version3 --enable-postproc --enable-avresample --enable-pic --enable-avisynth

make

sudo checkinstall --pkgname=ffmpeg --pkgversion="7:2.1" --backup=no --deldoc=yes --fstrans=no --default

cd ../

Final Adjustments

There is one thing left to do. We need to tell Linux that there are some library files located in /usr/local/lib

  1. sudo gedit /etc/ld.so.conf
  2. Add the text "/usr/local/lib" on a new line at the bottom of the document.
  3. Save changes and close gedit
  4. sudo ldconfig -v

Testing

ffmpeg -version
ffmpeg version 2.2.git
built on Mar 24 2014 15:22:19 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
configuration: --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab --enable-version3 --enable-postproc
libavutil      52. 69.100 / 52. 69.100
libavcodec     55. 54.100 / 55. 54.100
libavformat    55. 35.100 / 55. 35.100
libavdevice    55. 11.100 / 55. 11.100
libavfilter     4.  3.100 /  4.  3.100
libswscale      2.  5.102 /  2.  5.102
libswresample   0. 18.100 /  0. 18.100
libpostproc    52.  3.100 / 52.  3.100

Success!

Un-install

To Un-install any changes made from this how-to, simply remove the packages like this:

sudo apt-get --purge remove libx264 libfdk-aac libopus libvpx ffmpeg

You may at that point re-install libav-tools if you choose to, like this:

sudo apt-get install libav-tools

End Thoughts

My larger goal is to get avxsynth to install and function. With stability. The options "--enable-avresample --enable-pic --enable-avisynth" is for ffms2 and avxsynth to work properly.

I will be posting a how to when I have got that installation ironed out correctly.

Tuesday, January 13, 2009

How To: Installing CHDK from Ubuntu

I finally got around to putting CHDK (Canon Hacker's Development Kit, chdk.wikia.com) on my Canon PowerShot SD400 Digital Elph. It's actually a lot easier than what I thought it was going to be. I'll save anyone who reads this a few minutes of figuring out. Here is a three (basic) step how-to. I have used exhastive directions, so hopefully this is easy to follow. Just read it all over once, and then start going right down the list and you should do it without any hassles.
You will need:
- SD Card (anything larger than 4GB might have issues, see the CHDK site)
- SD Card reader for the computer (I found that my Toshiba card reader DID NOT work for this)
- hexedit (sudo apt-get install hexedit in a terminal will fetch it)

1) Check if your camera is supported and download CHDK
1. a. Get your firmware for your camera.
-Connect your SD card onto your computer
-Create two empty text files on the root directory of the card (not in any folders, just on the main part of the card). The files need to be named "ver.req" and "vers.req". My camera was old enough, it needed the "ver.req" text file. Newer cameras need the "vers.req" file. I found that it worked if I just had BOTH in there.
-Unmount the card, put it in your camera (right click on the SD Card on your desktop and press select "Unmount" to unmount the card)
-Power on, go to the "play" function on your camera, hold "Func / Set" and press "Disp"
-Write down what it says your Firmware version is (will be something like 1.01A, 1.01E, etc NOT 1.0.0.0 or 1.0.1.0)
1. b. Download CHDK for your camera (by the easiest method: autobuild site)
-Go to http://mighty-hoernsche.de/ (preferably in a different tab / window)
-Download the zip file for your camera model and your camera's firmware

2) Create a bootable SD Card and "install" CHDK
2. a. Create the bootable SD Card
-Connect your SD Card to your computer
-BACK UP ANY PICTURES OR MOVIES YOU WANT TO SAVE
-Unmount the card, put it in your camera
-Format the card using the function found in the camera's menu (this will ERASE EVERYTHING ON THE CARD)
-Connect your SD Card to your computer again
-open up a terminal
-type "sudo fdisk -l", figure out the "/dev/sd{letter}" of the SD Card (hint: look at the storage capacities)
-write down what you found out (for me, it was "/dev/sdb") and add a "1" to the end (again, for me, it was "/dev/sdb1")
-type "sudo hexedit /dev/sdb1" (replace with what you wrote above)
----press Enter / Return key
----type 40 (to take you to 0x40)
----press Tab key
----type "BOOTDISK"
----hold Ctrl and press the "x" key
----confirm you are saving and quitting hexedit
2. b. "Install" CHDK
-Unzip the file you downloaded for CHDK
-go to Places and then click on the SD card
-Copy the files from CHDK onto the SD card (do not place in any folders) (I had two files to copy "DISKBOOT.BIN" and "PS.FIR", some newer models will only need "DISKBOOT.BIN" apparently)
-Unmount SD card, take out of the reader (we will put it in the camera in just a bit)

3) Test CHDK
-Slide the "Lock" on the SD Card before you put it into the camera
-Put the SD Card in your camera, turn it on

There you go, you can now play around with CHDK. If you don't want to use CHDK, just unlock the SD Card and put it back in the camera. No harm to your camera. No hassle.