|
5#
楼主 |
发表于 10-8-2011 16:37:12
|
只看该作者
Ubuntu ffmpeg
http://ubuntuforums.org/showthread.php?t=786095
https://wiki.ubuntu.com/ffmpeg
1. Uninstall x264, libx264-dev, and ffmpeg if they are already installed. Open a terminal and run the following (you can usually paste into a terminal with shift+ctrl+v). Copy and paste the whole code box for each step.
- sudo apt-get remove ffmpeg x264 libx264-dev
复制代码
2. Get all of the packages you will need to install FFmpeg and x264 (you may need to enable the Universe and Multiverse repositories):
- sudo apt-get updatesudo apt-get install build-essential checkinstall git libfaac-dev libjack-jackd2-dev \ libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \ libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html \ yasm zlib1g-dev
复制代码
Install x264
3. Get the current source files, compile, and install x264.
Code:
cdgit clone git://git.videolan.org/x264cd x264./configure --enable-staticmakesudo checkinstall --pkgname=x264 --pkgversion="3: $ (./version.sh | \ awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \ --fstrans=no --default
Install libvpx (optional)
4. This is used to encode VP8 video. If you follow this step, add --enable-libvpx to the FFmpeg ./configure line in step 5.
- sudo apt-get remove libvpx-devcdgit clone git://review.webmproject.org/libvpxcd libvpx./configuremakesudo checkinstall --pkgname=libvpx --pkgversion="1: $ (date +%Y%m%d%H%M)-git" --backup=no \ --deldoc=yes --fstrans=no --default
复制代码
Install FFmpeg
5. Get the most current source files, compile, and install FFmpeg.
- cdgit clone git://git.videolan.org/ffmpegcd ffmpeg
- ./configure --enable-gpl --enable-postproc --enable-swscale --enable-pthreads \
- --enable-x11grab --enable-libdc1394 --enable-libfaac --enable-libfaad \
- --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis \
- --enable-libx264 --enable-libxvid
- make
- sudo checkinstall --pkgname=ffmpeg --pkgversion="5: $ (date +%Y%m%d%H%M)-git" --backup=no \ --deldoc=yes --fstrans=no --default
- hash x264 ffmpeg ffplay ffprobe
复制代码
Install qt-faststart (optional)
6. This is a useful tool if you're showing your H.264 MP4 videos on the web. It relocates some data in the video to allow playback to begin before the file is completely downloaded. Usage: qt-faststart input.mp4 output.mp4.
- cd ~/ffmpegmake tools/qt-faststartsudo checkinstall --pkgname=qt-faststart --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \ --deldoc=yes --fstrans=no --default install -D -m755 tools/qt-faststart \ /usr/local/bin/qt-faststart
复制代码
Adding lavf support to x264 (optional)
7. This allows x264 to accept just about any input that FFmpeg can handle and is useful if you want to directly use x264.
- cd ~/x264make distclean./configure --enable-staticmakesudo checkinstall --pkgname=x264 --pkgversion="3: $(./version.sh | \ awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \ --fstrans=no --default
复制代码
That's it for installation. You can keep the x264, libvpx, and ffmpeg directories in your home directory if you plan on updating later. See Updating FFmpeg and x264 below for more details.
Using FFmpeg and x264
The easiest method for high quality video encoding is by using the libx264 presets. See x264 --fullhelp for more info on these options.
One-pass CRF (Constant Rate Factor) using the slow preset. One-pass CRF is good for general encoding and is what I use most often. Adjust -crf to change the quality. Lower numbers mean higher quality and a larger output file size. A sane range is 18 to 28.
Code:
ffmpeg -i input -acodec libfaac -aq 100 -vcodec libx264 -preset slow -crf 22 \ -threads 0 output.mp4
One-pass CRF (Constant Rate Factor) using the medium preset, animation tuning, baseline profile, and level 3.0:
Code:
ffmpeg -i input -acodec libfaac -aq 100 -vcodec libx264 -preset medium \ -tune animation -profile baseline -level 3.0 -crf 20 -threads 0 output.mp4
Two-Pass encode using the fast preset. Two-pass encoding is usually used when you want a specific output file size.
Code:
ffmpeg -i input -pass 1 -vcodec libx264 -preset fast -b 512k -threads 0 \ -f mp4 -an -y /dev/null && ffmpeg -i input.avi -pass 2 -acodec libfaac -ab 128k \ -ac 2 -vcodec libx264 -preset fast -b 512k -threads 0 output.mp4
Updating FFmpeg and x264
Development of FFmpeg and x264 is active and an occasional update can give you new features and bug fixes. First, remove some packages and then update the dependencies:
Code:
sudo apt-get remove ffmpeg x264 libx264-dev libvpx-devsudo apt-get updatesudo apt-get install build-essential git checkinstall yasm texi2html \ libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev \ libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev \ libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
Update x264:
Code:
cd ~/x264make distcleangit pull
Now compile x264 as shown earlier in the guide starting with the x264 ./configure line. Update libvpx:
Code:
cd ~/libvpxmake cleangit pull
Now compile libvpx as shown earlier in the guide starting with the libvpx ./configure line. Update FFmpeg:
Code:
cd ~/ffmpegmake distcleangit pull
Finish the installation starting with the FFmpeg ./configure line.
Reverting Changes Made by This Guide
To remove FFmpeg/x264 and other packages added for this guide:
Code:
sudo apt-get autoremove x264 ffmpeg qt-faststart build-essential git checkinstall \ yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libsdl1.2-dev \ libtheora-dev libva-dev libvdpau-dev libvorbis-dev libvpx libx11-dev libxfixes-dev \ libxvidcore-dev zlib1g-dev
Issues
Check here if you get one of these error messages: "ffplay: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_gcd" or "ffmpeg: error while loading shared libraries: libavformat.so.52: cannot open shared object file: No such file or directory".
If you get any strange errors, especially if you compile with --enable-shared, run
sudo ldconfig
after installing. |
评分
-
查看全部评分
|