• linux 下ffmpeg和mencoder安装


            ffmpeg和mencoder是进行视频转换和视频抽帧的重要开源工具,支持linux和windows环境下的视频转换和视频抽帧操作。本文章记录在linux这两者工具的安装过程。ffmpeg集成视频编码/解码,视频抽帧、视频流采集、视频录制综合的开源视频解决方案。ffmpeg基于linux开发,但是可以很好的在主流的操作系统上运行

    FFmpeg的开发是基于Linux操作系统,但是可以在大多数操作系统中编译和使用。FFmpeg支持MPEG、DivX、MPEG4、AC3、DV、FLV等40多种编码,AVI、MPEG、OGG、Matroska、ASF等90多种解码.TCPMP, VLC, MPlayer等开源播放器都用到了FFmpeg

    • 下载mencoder、ffmpeg

                  http://www.ffmpeg.org/download.html
                  http://www.mplayerhq.hu/design7/dload.html

    • linux安装

                 1、ffmepg编译参数选项

                --help                 显示此帮助信息|print this message
                --log[=FILE|yes|no]     记录测试并输出到config.err文件|log tests and output to FILE [config.err]
                --prefix=PREFIX    安装程序到指定目录(默认/usr/local)|install in PREFIX [/usr/local]
                --libdir=DIR        安装库到指定目录(默认prefix/lib)|install libs in DIR [PREFIX/lib]
                --shlibdir=DIR  指定共享库路径(默认prefix/lib)|install shared libs in DIR [PREFIX/lib]
                --incdir=DIR       指定includes路径(默认prefix/include/ffmpeg)|install includes in DIR[PREFIX/include/ffmpeg]
                --mandir=DIR      指定man page路径(默认prefix/man)install man page in DIR [PREFIX/man]
                --enable-mp3lame   启用mp3编码libmp3lame(默认关闭)enable MP3 encoding via libmp3lame[default=no]
                --enable-libogg 启用ogg支持libogg(默认关闭)enable Ogg support via libogg [default=no] --enable-vorbis      启用Vorbis支持libvorbis(默认关闭)enable Vorbis support via libvorbis [default=no]
                --enable-faad       启用faad支持libfaad(默认关闭)enable FAAD support via libfaad [default=no]
                --enable-faadbin    启用faad运行时链接支持(默认关闭)build FAAD support with runtime linking[default=no]
                --enable-faac 启用faac支持libfaac(默认关闭)enable FAAC support via libfaac [default=no]
                --enable-libgsm     启用GSM支持libgsm(默认关闭)enable GSM support via libgsm [default=no]
                --enable-xvid       启用xvid支持xvidcore(默认关闭)enable XviD support via xvidcore [default=no]
                --enable-x264 启用H.264编码(默认关闭)enable H.264 encoding via x264 [default=no]
                --enable-mingw32   启用MinGW本地/交叉win环境编译|enable MinGW native/cross Windows compile
                --enable-mingwce    启用MinGW本地/交叉winCE环境编译enable MinGW native/cross WinCE compile
                --enable-a52        启用A52支持(默认关闭)enable GPLed A52 support [default=no]
                --enable-a52bin     启用运行时打开liba52.so.0(默认关闭)open liba52.so.0 at runtime [default=no]
                --enable-dts        启用DTS支持(默认关闭)enable GPLed DTS support [default=no]
                --enable-pp         启用后加工支持(默认关闭)enable GPLed postprocessing support [default=no]
                --enable-static      构建静态库(默认启用)build static libraries [default=yes]
                --disable-static     禁止构建静态库(默认关闭)do not build static libraries [default=no]
                --enable-shared     构建共享库(默认关闭)build shared libraries [default=no]
                --disable-shared    禁止构建共享库(默认启用)do not build shared libraries [default=yes]
                --enable-amr_nb    启用amr_nb float音频编解码器|enable amr_nb float audio codec
                --enable-amr_nb-fixed   启用fixed amr_nb codec | use fixed point for amr-nb codec
                --enable-amr_wb   启用amr_wb float音频编解码器|enable amr_wb float audio codec
                --enable-amr_if2     启用amr_wb IF2音频编解码器|enable amr_wb IF2 audio codec
                --enable-sunmlib     启用Sun medialib(默认关闭)| use Sun medialib [default=no]
                --enable-pthreads    启用pthreads(多线程)(默认关闭)use pthreads [default=no]
                --enable-dc1394      启用libdc1394、libraw1394抓取IIDC-1394(默认关闭)enable IIDC-1394 grabbing using libdc1394 and libraw1394 [default=no]
                --enable-swscaler    启用计数器支持?(默认关闭)software scaler support [default=no]
                --enable-avisynth    允许读取AVISynth脚本本件(默认关闭)allow reading AVISynth script files [default=no]
                --enable-gpl       允许使用GPL(默认关闭)allow use of GPL code,the resulting libav* and ffmpeg will be under GPL [default=no] Advanced options (experts only): 高级选项参数(供专业人员使用)
                --source-path=PATH        源码的路径(当前为/root/flv/ffmpeg)| path to source code [/root/flv/ffmpeg]
                --cross-prefix=PREFIX 为编译工具指定路径| use PREFIX for compilation tools []
                --cross-compile          假定使用了交叉编译| assume a cross-compiler is used
                --cc=CC                指定使用何种C编译器(默认gcc)use C compiler CC [gcc]
                --make=MAKE          使用特定的make | use specified make [make]
                --extra-cflags=ECFLAGS   添加ECFLAGS到CFLAGS | add ECFLAGS to CFLAGS []
                --extra-ldflags=ELDFLAGS 添加ELDFLAGS到LDFLAGS(默认-Wl,
                --as-needed)| add ELDFLAGS to LDFLAGS [ -Wl,
                --as-needed]
                --extra-libs=ELIBS       添加ELIBS | add ELIBS []
                --build-suffix=SUFFIX    为专用程序添加后缀suffix for application specific build []
                --arch=ARCH             选择机器架构(默认x86)select architecture [x86]
                --cpu=CPU               选用最低的cpu(影响指令的选择,可以在老CPU上出错)| selects the minimum cpu required (affects instruction selection,may crash on older CPUs)
                --powerpc-perf-enable    启用PPC上面的性能报告(需要启用PMC)enable performance report on PPC (requires enabling PMC)
                --disable-mmx          禁用MMX | disable MMX usage
                --disable-armv5te       禁用armv5te | disable armv5te usage
                --disable-iwmmxt       禁用iwmmxt | disable iwmmxt usage
                --disable-altivec        禁用AltiVec | disable AltiVec usage
                --disable-audio-oss     禁用OSS音频支持(默认启用)disable OSS audio support [default=no]
                --disable-audio-beos     禁用BeOS音频支持(默认启用)disable BeOS audio support [default=no]


    • ffmpeg 安装

                第一步:安装yasm/nasm编译器

                wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
                tar -xvf yasm-1.3.0.tar.gz
                cd yasm-1.3.0
                ./configure
                make
                make install
                make clean


                第二步:安装依赖lib

                     1、lame

                     2、libogg

                     3、libvorbis

                     4、xvidcore

                     5、x264

                     6、libdca

                    7、a52dec

                    8、faac

                    9、amrwb

                    10、amrnb

                    11、yasm

                    12、opencore-amr

                    13、vo-amrwbenc

                    14、vo-aacenc

                    15、essential

                    16、faad2

                    17、libtheora

                    18、libraw1394

                    19、libdc1394

                    20、fribidi

                    21、freeType

                    22、fonconfig

                    23、libass

                    24、openssl

                    25、librtmp

                    26、libspeex

                    27、twolame

                    28、libopus

                    29、libvpx

                    30、libvo-amrwbenc

                    31、libsoxr

                    32、libschroedinger

                    33、libopencore-amrnb

                    34、libopencore-amrwb

                    35、gnutls

                     36、frei0r

                     37、fontconfig

                     安装faac到时候,报错,修改mpeg4ip.h文件,删除大搞126行,可以通过,
                第三步:安装ffmpeg

        ./configure
            --prefix=/usr/local/ffmpeg
            --enable-gpl
            --enable-version3
            --enable-nonfree configure
            --enable-zlib
            --enable-bzlib
            --enable-libfaac
            --enable-libmp3lame
            --enable-libtheora
            --enable-libvo-aacenc
            --enable-libvorbis
            --enable-libx264
            --enable-libxvid
            --enable-pic
            --enable-pthreads
            --enable-libdc1394
            --enable-libass
            --enable-pic
            --enable-openssl
            --enable-libtwolame
            --enable-libspeex
            --enable-librtmp
            --enable-libfreetype
            --enable-mp3lame
            --enable-libgsm
            --enable-memalign-hack
            --enable-libogg
            --enable-libamr-nb
            --enable-libamr-wb
            --enable-liba52
            --enable-liba52bin
            --enable-libfaad
            --enable-libfaadbin
            --enable-pp
            --enable-libopus
            --enable-libvpx
            --enable-libvo-amrwbenc
            --enable-libsoxr
            --enable-libschroedinger
            --enable-libopencore-amrnb
            --enable-libopencore-amrwb
            --enable-gnutls
            --enable-frei0r
            --enable-fontconfig
            --disable-ffserver
            --disable-ffplay
            --enable-shared
    
        make
        make install
        make clean 


                第四步:配置环境变量

                vi /etc/profile
                export FFMPEG_HOME=/usr/local/ffmpeg/
                export PATH=$PATH:$FFMPEG_HOME/bin
                :wq


                第五步:测试是否安装成功

                 ffmpeg –version

                第六步:安装mencoder

                           1、安装过程中完成后执行mencoder命令出现以下错误提示

               mencoder: error while loading shared libraries: libdca.so.0: cannot open shared object file: No such file or directory

                          需要设置环境变量LD_LIBRARY_PATH和LD_RUN_PATH,由于mencoder安装的目录为/usr/local/bin和依赖库为/usrllocal/lib,因此如下设置

               #set default LD_RUN_PATH and LD_LIBRARY_PATH
               export LD_LIBRARY_PATH=/usr/local/lib
               export LD_RUN_PATH=/usr/local/bin
               export PATH=$PATH:$LD_RUN_PATH
               export CLASSPATH=$CLASSPATH:$LD_LIBRARY_PATH
    • ffmpeg参数选项

                 1、通用选项

                -L license
                -h 帮助
                -fromats 显示可用的格式,编解码的,协议的。
                -f fmt 强迫采用格式fmt
                -I filename 输入文件
                -y 覆盖输出文件
                -t duration 设置纪录时间hh:mm:ss[.xxx]格式的记录时间也支持
                -ss position 搜索到指定的时间[-]hh:mm:ss[.xxx]的格式也支持
                -title string 设置标题
                -author string 设置作者
                -copyright string 设置版权
                -comment string 设置评论
                -target type 设置目标文件类型vcd,svcd,dvd) 所有的格式选项(比特率,编解码以及缓冲区大小)自动设置,只需要输入如下的就可以了:ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
                -hq 激活高质量设置
                -itsoffset offset 设置以秒为基准的时间偏移,该选项影响所有后面的输入文件。该偏移被加到输入文件的时戳,定义一个正偏移意味着相应的流被延迟了offset秒。[-]hh:mm:ss[.xxx]的格式也支持

                2、视频选项
                -b bitrate 设置比特率,缺省200kb/s
                -r fps 设置帧频缺省25
                -s size 设置帧大小格式为WXH 缺省160X128.  下面的简写也可以直接使用:Sqcif 128X96 qcif 176X144 cif 252X288 4cif 704X576
                -aspect aspect 设置横纵比4:3 16:9 或1.3333 1.7777
                -croptop size 设置顶部切除带大小像素单位
                -cropbottom size –cropleft size –cropright size -padtop size 设置顶部补齐的大小像素单位
                -padbottom size –padleft size –padright size –padcolor color 设置补齐条颜色 (hex,6个16进制的数,红:绿:兰排列,比如000000代表黑色)
                -vn 不做视频记录
                -bt tolerance 设置视频码率容忍度kbit/s
                -maxrate bitrate设置最大视频码率容忍度
                -minrate bitreate 设置最小视频码率容忍度
                -bufsize size 设置码率控制缓冲区大小
                -vcodec codec 强制使用
                codec编解码方式。如果用copy表示原始编解码数据必须被拷贝。
                -sameq 使用同样视频质量作为源(VBR)
                -pass n 选择处理遍数(1或者2)。两遍编码非常有用。第一遍生成统计信息,第二遍生成精确的请求的码率
                -passlogfile file 选择两遍的纪录文件名为file

                高级视频选项
                -g gop_size 设置图像组大小
                -intra 仅适用帧内编码
                -qscale q 使用固定的视频量化标度(VBR)
                -qmin q 最小视频量化标度(VBR)
                -qmax q 最大视频量化标度(VBR)
                -qdiff q 量化标度间最大偏差(VBR)
                -qblur blur 视频量化标度柔化(VBR)
                -qcomp compression 视频量化标度压缩(VBR)
                -rc_init_cplx complexity 一遍编码的初始复杂度
                -b_qfactor factor 在p和b帧间的qp因子
                -i_qfactor factor 在p和i帧间的qp因子
                -b_qoffset offset 在p和b帧间的qp偏差
                -i_qoffset offset 在p和i帧间的qp偏差
                -rc_eq equation 设置码率控制方程默认tex^qComp
                -rc_override override 特定间隔下的速率控制重载
                -me method 设置运动估计的方法可用方法有zero phods log x1 epzs(缺省) full
                -dct_algo algo 设置dct的算法可用的有0 FF_DCT_AUTO 缺省的DCT 1 FF_DCT_FASTINT 2 FF_DCT_INT 3 FF_DCT_MMX 4 FF_DCT_MLIB 5 FF_DCT_ALTIVEC
                -idct_algo algo 设置idct算法。可用的有0 FF_IDCT_AUTO 缺省的IDCT 1 FF_IDCT_INT 2 FF_IDCT_SIMPLE 3 FF_IDCT_SIMPLEMMX 4 FF_IDCT_LIBMPEG2MMX 5 FF_IDCT_PS2 6 FF_IDCT_MLIB 7 FF_IDCT_ARM 8 FF_IDCT_ALTIVEC 9 FF_IDCT_SH4 10 FF_IDCT_SIMPLEARM
                -er n 设置错误残留为n 1 FF_ER_CAREFULL 缺省2 FF_ER_COMPLIANT 3 FF_ER_AGGRESSIVE 4 FF_ER_VERY_AGGRESSIVE
                -ec bit_mask 设置错误掩蔽为bit_mask,该值为如下值的位掩码1 FF_EC_GUESS_MVS (default=enabled) 2 FF_EC_DEBLOCK (default=enabled)
                -bf frames 使用frames B 帧,支持mpeg1,mpeg2,mpeg4
                -mbd mode 宏块决策0 FF_MB_DECISION_SIMPLE 使用mb_cmp 1 FF_MB_DECISION_BITS 2 FF_MB_DECISION_RD
                -4mv 使用4个运动矢量仅用于mpeg4
                -part 使用数据划分仅用于mpeg4
                -bug param 绕过没有被自动监测到编码器的问题
                -strict strictness 跟标准的严格性
                -aic 使能高级帧内编码h263
                -umv 使能无限运动矢量h263
                -deinterlace 不采用交织方法
                -interlace 强迫交织法编码.仅对mpeg2和mpeg4有效。当你的输入是交织的并且你想要保持交织以最小图像损失的时候采用该选项。可选的方法是不交织,但是损失更大
                -psnr 计算压缩帧的psnr
                -vstats 输出视频编码统计到vstats_hhmmss.log
                -vhook module 插入视频处理模块module 包括了模块名和参数,用空格分开

                3、音频选项
                -ab bitrate 设置音频码率
                -ar freq 设置音频采样率
                -ac channels 设置通道,缺省为1
                -an 不使能音频纪录
                -acodec codec 使用codec编解码

                4、音频/视频捕获选项
                -vd device 设置视频捕获设备。比如/dev/video0
                -vc channel 设置视频捕获通道DV1394专用
                -tvstd standard 设置电视标准NTSC PAL(SECAM)
                -dv1394 设置DV1394捕获
                -av device
                设置音频设备比如/dev/dsp

                高级选项
                -map file:stream 设置输入流映射
                -debug 打印特定调试信息
                -benchmark 为基准测试加入时间
                -hex 倾倒每一个输入包
                -bitexact 仅使用位精确算法用于编解码测试
                -ps size 设置包大小,以bits为单位
                -re 以本地帧频读数据,主要用于模拟捕获设备
                -loop 循环输入流。只工作于图像流,用于ffserver测试

    • ffmpeg H264各种清晰程度对应的码率

                针对H.264,这里有一些常用的码率方案:
                1、画面尺寸1920x1080(真正高清),选择码率为7,000-8,000Kbps。

                2、画面尺寸1280x720(通用高清),选择码率为5,000-6,000Kbps。

                3、画面尺寸640x480(标清),选择码率为1,000-2,000Kbps。

                4、画面尺寸320x240(网络传输),选择码率为300-500Kbps。
                5、画面尺寸176x144(3G),10-15fps的内容选择码率为50-60Kbps,24-30fps的内容选择码率为150-200Kbps

    • mencoder 查看系统的音频编码器和视频编码器
          mencoder -ovc help
    • ffmpeg视频转换

                 1、ffmpeg实现3pg的格式转换

             ffmpeg -y -i test.mpeg -bitexact -vcodec h263 -b 128 -r 15 -s 176x144  -acodec aac -ac 2 -ar 22500 -ab 24 -f 3gp test.3gp 

                      或

             ffmpeg -y -i test.wmv -ac 1 -acodec libamr_nb -ar 8000 -ab 12200 -s 176x144 -b 128 -r 15 test.3gp

                 2、压制H264编码的视频文件

             ffmpeg -threads 4 -i INPUT -r 29.97 -vcodec libx264 -s 480x272 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 24   -bt 256k -refs 1 -coder 0 -me umh -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30   -qmin 10 -qmax 51 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 OUTPUT 
    
    • ffmpeg实现视频抽帧

                1、 截取一张300x200尺寸大小的格式为jpg的一张图片:

             ffmpeg –i test.avi –y –f image2 –t 0.001 –s 300x200 test.jpg  

                        要截取指定时间的图片,如5秒之后的:        

              ffmpeg –i test.avi –y –f image2 –ss 5 –t 0.001 –s 300x200 test.jpg

                其中,-ss后的单位为秒,也可写成:-ss 00:00:05。
              

                2、 把视频的前30帧转换为一个动态的gif图。需要说明的是,转换成功之后,如果用ffplay播放是看不出效果的,建议换成其他图片播放器播放。其转换命令为:

             ffmpeg –i test.avi –vframes 30 –pix_fmt rgb24–y –f gif test.gif 

                      也可以从视频中的第10秒开始截取后面的5秒内容转换为一个无限重播的动态gif图。其命令为:    

             ffmpeg –i test.avi –pix_fmt rgb24 –ss 10 –t 5 –y –f gif test.gif 

                      上面两种动态gif都是只播一次,想让其一直播,可再加一个参数:-loop_output 0

    • ffmpeg实现image和video互换

                  1、多张图片转换成视频

              ffmpeg -f image2 -i image%d.jpg video.mpg 

                  2、视频转换为多张图片

              ffmpeg -i video.mpg image%d.jpg 

                        支持图片格式PGM, PPM, PAM, PGMYUV, JPEG, GIF, PNG, TIFF, SGI.
     

    • ffmpeg实现录制视频/音频

                 ffmpeg只能在linux平台上实现视频/音频的录制。

                1、ffmpeg屏幕录制ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -i ~/test.avi -s 800×600 ~/test-800-600.avi


             ffmpeg -f x11grab -r 25 -s wxga -i :0.0 /tmp/outputFile.mpg 

                      其他相关参数可自行添加。需要说明的是,各个版本的ffmpeg对屏幕录制的命令不一。如果你只想录制一个应用程序窗口或者桌面上的一个固定区域,那么可以指定偏移位置和区域大小。使用xwininfo -frame命令可以完成查找上述参数。
    注:ffmpeg的屏幕录制功能只能在Linux环境下有效。并且在配置时需要添加 –enable-x11grub 指令,默认关闭。 

            ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1024x768 ~/test.avi 

                    其中,-vd x11:0,0 指录制所使用的偏移为 x=0 和 y=0,-s 1024×768 指录制视频的大小为 1024×768。录制的视频文件为 test.avi,将保存到用户主目录中
    如果你只想录制一个应用程序窗口或者桌面上的一个固定区域,那么可以指定偏移位置和区域大小。使用xwininfo -frame命令可以完成查找上述参数。


                2、ffmpeg视频采集 
                     把摄像头的实时视频录制下来,存储为文件

            ffmpeg -f video4linux -s 320x240 -r 10 -i /dev/video0  test.asf

               3、ffmepg音频采集,其命令为: 

            ffmpeg –i /dev/dsp -f oss test.mp3
    • mencoder中文手册

                 这是中文手册地址:http://www.mplayerhq.hu/DOCS/HTML/zh_CN/intro.html

    • mencoder命令操作
    mencoder "E:	emp fileMVI_FF.wmv" -o null -oac mp3lame -lameopts cbr:br=32 -ovc x264 -x264encopts bitrate=600 mp4
    转码后找到得到文件,但无法播放
     "E:Program FilesMPlayermencoder.exe"  -oac mp3lame -lameopts aq=7:cbr:br=96 -srate 32000  -vf scale=720:480,harddup -ovc x264 -ffourcc H264 -x264encopts bitrate=320  -of lavf -lavfopts format=mp4    "E:	emp fileMVI_FF.wmv" -o "E:	emp file	empMVI_FFmp4.mp4"
     
    
     "E:Program FilesMPlayermencoder.exe" -nosound -vf harddup -ovc x264 -ffourcc H264 -x264encopts bitrate=320:pass=1  -of lavf -lavfopts format=mp4    "E:	emp fileMVI_FF.wmv" -o "E:	emp fileMVI_FFmp4.mp4"   
    
    
    "E:Program FilesMPlayermencoder.exe"  -oac mp3lame -lameopts aq=7:cbr:br=96 -srate 32000  -vf harddup -ovc x264 -ffourcc H264 -x264encopts bitrate=320:pass=2  -of lavf -lavfopts format=mp4    "E:	emp fileMVI_FF.wmv" -o "E:	emp file	empMVI_FFmp4.mp4"   
    
    
    
    mencoder  -oac mp3lame -lameopts aq=7:cbr:br=96 -srate 32000  -vf harddup -ovc x264 -ffourcc H264 -x264encopts bitrate=320:pass=2  -of lavf -lavfopts format=mp4    "E:	emp fileMVI_FF.wmv" -o "E:	emp file	empMVI_FFmp4.mp4"   
    
    
    
    mencoder  -oac mp3lame -lameopts aq=7:cbr:br=96 -srate 32000  -vf harddup -ovc x264 -x264encopts bitrate=320:pass=2  -of lavf -lavfopts format=mp4    "E:	emp fileMVI_FF.wmv" -o "E:	emp file	empMVI_FFmp4.mp4" scale=448:-3  
    
    
    mencoder.exe  -oac mp3lame -lameopts aq=7:vbr=2:q=6 -srate 32000  -vf harddup -ovc x264 -ffourcc H264 -x264encopts crf=8  -of lavf -lavfopts format=mp4    "E:	emp fileMVI_FF.wmv" -o "E:	emp fileMVI_FFmp4.mp4"   
    
    
    mencoder.exe  -oac mp3lame -lameopts aq=7:cbr:br=96 -srate 32000  -vf harddup -ovc x264 -x264encopts bitrate=320  -of lavf -lavfopts format=mp4    "E:	emp fileMVI_FF.wmv" -o "E:	emp fileMVI_FFmp4.mp4"   
    
    mplayer   -ss 00:01:23 -vo gif "E:	emp fileMVI_FF.wmv"  
    
    
    mplayer  -vo jpeg MVI_FF.wmv
    
    
     mplayer $s -vf screenshot MVI_FF.wmv
    
    
    
     mplayer -ss 00:00:26 -demuxer lavf -vf screenshot -vo jpeg -lavdopts skiploopfilter=all:skipframe=nonkey -nosound -frames 1 MVI_FF.wmv
    
    
    
    
    
    
    mencoder MVI_FF.wmv -o output.flv -of lavf -oac mp3lame -lameopts abr:br=56 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3
    
    mplayer MVI_FF.wmv -dumpvideo -dumpfile narnia.h264
    
    
       mencoder MVI_FF.wmv -of lavf -oac mp3lame mpeg=4:object=2:raw:br=32 -srate 22050 -ovc x264 -x264encopts global_header:cabac=1:ref=3:deblock=1:me=umh:frameref=5:mixed_refs=1:me_range=32:chroma_me=1: trellis=1:8x8dct:no-chroma-me=0:chroma_qp_offset=-2:nr=0:dct_decimate=1:bframes=4:b_pyramid=0: b_adapt=1:b_bias=0:direct=auto:keyint=250:keyint_min=25:scenecut=40:qp=18:bitrate=256:subq=7: threads=auto -lavdopts er=2 -lavfopts format=mp4 -sws 3 -vf harddup,scale=480:-3 -ofps 24 -idx -o MVI_FF.mp4
    
    mencoder MVI_FF.wmv -o MVI_FF1.mp4 -vf dsize=480:360:2,scale=-8:-8,harddup  -oac faac -faacopts mpeg=4:object=2:raw:br=128 -of lavf -lavfopts format=mp4 -ovc x264 -sws 9 -x264encopts nocabac:level_idc=30:bframes=0:bitrate=512:threads=auto:turbo=1:global_header:threads=auto:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh 
    
    
    mencoder MVI_FF.wmv -oac copy -ovc x264 -x264encopts bitrate=400:level_idc=3.1 -o 2.avi
    
    
    mencoder MVI_FF.wmv -o 2.mp4 -ovc x264 -x264encopts crf=28:vbv_maxrate=1500:nocabac:global_header:frameref=3:threads=auto:bframes=0:subq=6:mixed-refs=0:weightb=0:8x8dct=1:me=umh:partitions=all:qp_step=4:qcomp=0.7:trellis=1:direct_pred=auto -oac mp3lame -lameopts aq=7:cbr:br=96
    
    
    • 安装错误解决

                 1、freeType安装时make出现下面错误

          /usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against `.text’ can not be used when making a shared object; recompile with -fPIC

                 make失败原因是libbz2安装有问题,解决方法为

          vi Makefile
          在文件中找到 
          CC=gcc
          修改为
          CC=gcc -fPIC 
          保存文件并重新安装bz2库
          make clean
          make && make install
          make clean

               2、freeType安装错误二

                

          configure: error: Package requirements (freetype2 >= 9.10.3) were not met:
          No package 'freetype2' found
          <span style="font-size:16px;">Package requirements (freetype2 >= 9.10.3) were not met</span>
          
    

               解决方法:设置环境变量

         export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

              3、lib2xml安装过程中出现错误

         used when making a shared object; recompile with -fPIC
        /usr/local/lib/python2.7/config/libpython2.7.a: could not read symbols: Bad value
        collect2: ld returned 1 exit status
        make[4]: *** [libxml2mod.la] 错误 1
        make[4]: Leaving directory `/home/zouqf/ffmpeg-soft/libxml2-2.9.2/python'
        make[3]: *** [all-recursive] 错误 1
        make[3]: Leaving directory `/home/zouqf/ffmpeg-soft/libxml2-2.9.2/python'
        make[2]: *** [all] 错误 2
        make[2]: Leaving directory `/home/zouqf/ffmpeg-soft/libxml2-2.9.2/python'
        make[1]: *** [all-recursive] 错误 1
        make[1]: Leaving directory `/home/zouqf/ffmpeg-soft/libxml2-2.9.2'
        make: *** [all] 错误 2
    

            解决方法

            第一步安装最新的python

            第二步设置使用--with-pythod参数,因为编译过程中依赖python环境

        ./configure  --with-python=/usr/local/lib/python2.7
    

            4、安装libass错误

            ass_shaper.c:29:19: 错误:hb-ft.h:没有那个文件或目录
            ass_shaper.c: 在函数‘get_hb_font’中:
            ass_shaper.c:377: 错误:隐式声明函数‘hb_ft_font_create’
            ass_shaper.c:377: 警告:赋值时将整数赋给指针,未作类型转换
            make[2]: *** [ass_shaper.lo] 错误 1
            make[2]: Leaving directory `/home/zouqf/ffmpeg-soft/libass-0.12.0/libass'
            make[1]: *** [all-recursive] 错误 1
            make[1]: Leaving directory `/home/zouqf/ffmpeg-soft/libass-0.12.0'
            make: *** [all] 错误 2
    

                 解决方法

            cp /home/zouqf/ffmpeg-soft/harfbuzz-0.9.36/src/hb-ft.h /home/zouqf/ffmpeg-soft/libass-0.12.0/libass/hb-ft.h

            5、错误一

           ERROR: speex not found using pkg-config
    
           If you think configure made a mistake, make sure you are using the latest
           version from Git.  If the latest version fails, report the problem to the
           ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
           Include the log file "config.log" produced by configure as this will help
           solve the problem.

                 这种情况解决步骤如下:

                 a)设定pkg-config环境变量

             export PKG_CONFIG_PATH=/usr/local/pkgconfig:/usr/local/lib/pkgconfig:/usr/share/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig

                  b) 确认speex.pc文件存在于以上路径的其中一个

                  c)如果以上确认无误情况下,重新configure仍然无法通过,需要查看./config.log日志文件,里面有详细的说明错误原因,下面错误二便是其中一种。

               6、错误二

            gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -std=c99 -fomit-frame-pointer -fPIC -pthread -I/usr/local/include -I/usr/include/freetype2 -I/usr/local/include/fribidi -I/usr/local/include/freetype2 -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -L/usr/local/lib -c -o /tmp/ffconf.T9MVHrqS.o /tmp/ffconf.vVfcurs1.c
            gcc -Wl,--as-needed -Wl,-z,noexecstack -I/usr/local/include -L/usr/local/lib -o /tmp/ffconf.gGMUfN37 /tmp/ffconf.T9MVHrqS.o -lspeex -lspeex -L/usr/local/lib -L/usr/local/lib64 -lrtmp -lz -lssl -lcrypto -lmp3lame -L/usr/local/lib -lfreetype -lfaac -L/usr/local/lib -lass -lm -lz -pthread -lrt
            /usr/bin/ld: cannot find -lspeex
            collect2: ld returned 1 exit status

                    这个原因是speex 安装版本与需要的版本不一致,我安装的时候是speex-1.2rc3,实际编译需要的版本是speex-1.2rc1,因此重新安装speex-1.2rc1,并把speex-1.2rc3/include/speex拷贝到/usr/local/include中,否则会提示文件找不到。

               7、错误三

            libavcodec/libxvid.c: In function ‘xvid_encode_init’:
            libavcodec/libxvid.c:371: error: ‘xvid_plugin_lumimasking_t’ undeclared (first use in this function)
            libavcodec/libxvid.c:371: error: (Each undeclared identifier is reported only once
            libavcodec/libxvid.c:371: error: for each function it appears in.)
            libavcodec/libxvid.c:371: error: expected ‘;’ before ‘masking_l’
            libavcodec/libxvid.c:372: error: expected ‘;’ before ‘masking_v’
            libavcodec/libxvid.c:373: error: ‘xvid_plugin_ssim_t’ undeclared (first use in this function)
            libavcodec/libxvid.c:373: error: expected ‘;’ before ‘ssim’
            libavcodec/libxvid.c:374: warning: ISO C90 forbids mixed declarations and code
            libavcodec/libxvid.c:548: error: ‘masking_l’ undeclared (first use in this function)
            libavcodec/libxvid.c:560: error: ‘masking_v’ undeclared (first use in this function)
            libavcodec/libxvid.c:573: error: ‘xvid_plugin_ssim’ undeclared (first use in this function)
            libavcodec/libxvid.c:574: error: ‘ssim’ undeclared (first use in this function)
            make: *** [libavcodec/libxvid.o] Error 1
    

                    xvidcore版本过低,需要xvidcore-1.3.3编译通过

    • 参考资料

            http://www.cnblogs.com/wanghetao/p/3386311.html
            http://blog.csdn.net/luka2008/article/details/38561891
            http://blog.csdn.net/lzj1980/article/details/2561763
            http://blog.csdn.net/ok7758521ok/article/details/1677662
            http://www.cnblogs.com/dennisit/archive/2013/02/16/2913287.html
            http://blog.csdn.net/jimzhai/article/details/7853005
            http://blog.csdn.net/bbplayers/article/details/7006047
            http://wenku.baidu.com/view/1e2f4bb669dc5022aaea00de.html
            http://blog.sina.com.cn/s/blog_71f389090100vub5.html
            http://wenku.baidu.com/view/76daf5699b6648d7c1c7461d.html
            http://wenku.baidu.com/view/7987cd2abd64783e09122b2d.html?re=view
            http://wenku.baidu.com/view/bfc0580cba1aa8114431d913.html
            http://wenku.baidu.com/view/7d3467ee998fcc22bcd10d1f.html
            http://jjhhappy.blog.sohu.com/177769500.html

            http://blog.chinaunix.net/uid-23069658-id-4018842.html

            http://blog.chinaunix.net/uid-23069658-id-4028681.html


  • 相关阅读:
    【Statistics】均值
    【Datastage】在win10安装Datastge 8.7
    【Linux】行首、行尾添加字符串
    【Linux】替换文本中的字符
    【Pyhton 数据分析】通过gensim进行文本相似度分析
    【Python 数据分析】jieba文本挖掘
    异或运算法则
    关于计算机中的《补码》,公式:-n=~n+1 引伸:~n=-n-1
    Base64编码解码
    位运算之——按位与(&)操作——(快速取模算法)
  • 原文地址:https://www.cnblogs.com/wala-wo/p/5119222.html
Copyright © 2020-2023  润新知