CLI派视频音频转码工具用法小结

CLI派视频音频转码工具用法小结


Table of Contents


·     1 ffmpeg 264编码支持

·     2 ffmpeg 参数选项简要说明

·     2.1 main options

·     2.2 视频剪辑相关参数

·     2.3 video options

·     2.3.1 crop options(视频剪裁选项说明)

·     2.3.2 pad and filter options

·     2.4 audio options

·     2.5 subtitle options

·     2.6 disable options

·     2.7 frames

·     2.8 preset files

·     3 ffmpeg 用法示例(seehttp://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs for moreexamples)

·     4 ffmpeg learning resources

·     5 Related tools

·     5.1 transcode

·     5.2 mencode(from mplayer)

·     6 yamdi给视频增加关键帧

·     7 ffmpegthumbnailer截取视频的thumbnail

·     8 Youku的一些探索


1 ffmpeg 264编码支持


·     See http://ubuntuforums.org/showthread.php?t=786095for configuration of ffmpeg and libx264 on ubuntu 10.04


2 ffmpeg 参数选项简要说明



2.1 main options


·     -i filename: 指定输入文件

·     -y: Overwrite output files

·     -target: Specify target filetype ("vcd", "svcd", "dvd", "dv","dv50", "pal-vcd", "ntsc-svcd", … ). All theformat options (bitrate, codecs, buffer sizes) are then set automatically. Itis one of the most useful options of ffmpeg. It instructs ffmpeg to just"do what it takes" for the target file to be usable.


2.2 视频剪辑相关参数


·     -ss: 设定剪辑开始时间[支持[hh:mm:ss[.xxx]]格式

·     -t: 设定剪辑长度[支持[hh:mm:ss[.xxx]]格式

·     -fs: 设定文件大小限制


2.3 video options


·     -b bitrate: 设定比特率(默认为200kb/s)

·     -r fps: frame rate(默认为25)

·     -s size: set frame size

·     wxh(width x height) or

·     abbreviations(qcif(176x144),vga(640x480), wvga(852x480)

·     -aspect aspect: 设定aspect ratio(4:3, 16:9, 30:9, 1:3 or 1.333,1.777 etc.)

·     -sameq: use same video qualityas source (implies VBR).

·     -vcodec: codec: force videocodec to codec. Use the copy special value to tell that the raw codec data mustbe copied as is.

·     -newvideo: add a new videostream to the current output stream.

·     -pass n 选择处理遍数(1或者2)。两遍编码非常有用。第一遍生成统计信息,第二遍生成精确的请求的码率

·     -map inputstreamid[:syncstreamid]: Set streammapping from input streams to output streams.

·     -itsoffset offset Set the inputtime offset in seconds. "[-]hh:mm:ss[.xxx]" syntax is also supported.This option affects all the input files that follow it.


2.3.1 crop options(视频剪裁选项说明)

·     -crop x:y:width:height: Cropthe input video to x:y:width:height.

·     -croptop

·     -cropbottom

·     -cropleft

·     -cropright


2.3.2 pad and filter options

·     -vf filter_graph

·     -vf pad=width:height:x:y:color(这个命令可以给裁剪后的视频增加上下两个pad,形成电影似的效果)


2.4 audio options


·     -ar freq: set the audiosampling frequency(default=44100Hz)

·     -ab bitrate: 设定比特率(默认为64K)

·     -aq q: set the audio quality

·     -ac channels: set the number ofaudio channels(default=1)

·     -acodec codec: force audiocodec to codec. Use the copy special value to specify that the raw codec datamust be copied as is.

·     -newaudio: add a new audiotrack to the output file. If you want to specify parameters, do so before-newaudio (-acodec, -ab, etc..).


2.5 subtitle options


·     -scodec codec: force subtitlecodec ('copy' to copy stream).

·     -newsubtitle: add a newsubtitle stream to the current output stream.


2.6 disable options


·     -an: disable audio recording.

·     -vn: disable video recording.

·     -sn: disable subtitlerecording.


2.7 frames


·     -dframes number: set the numberof data frames to record

·     -vframes number: set the numberof video frames to record

·     -aframes number: set the numberof audio frames to record


2.8 preset files


·     -vpre

·     -apre

·     -spre

·     -fpre


3 ffmpeg 用法示例(see http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needsfor more examples)


·     Basic Usage: ffmpeg [input options] -i [input file][output options] [output file]

·     Normally the minimum one shouldspecify in an ffmpeg command line would be something like: ffmpeg -i INFILE -acodec ACODEC -ab 96k -vcodec VCODEC -b 500k OUTFILE…replacing the capitalised values as appropriate. When using x264, we need toadd some extra bits as the defaults are bad.

·     Getting infos from a videofile: ffmpeg -i video.avi

·     Turn X images to a videosequence: ffmpeg -f image2 -i image%d.jpgvideo.mpg

·     Turn a video to X images: ffmpeg -i video.mpg image%d.jpg

·     Extracting sound from a video,and save it as Mp3: ffmpeg -isource_video.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3

·     Convert .avi video to .mpg: ffmpeg -i video_origine.avi video_finale.mpg

·     Convert .avi to animatedgif(uncompressed): ffmpeg -ivideo_origine.avi -pix_fmt rgb24 gif_anime.gif

·     Mix a video with a sound file: ffmpeg -i son.wav -i video_origine.avivideo_finale.mpg

·     Compress .avi to VCD mpeg2 NTSCformat: ffmpeg -i video_origine.avi-target ntsc-vcd video_finale.mpg

·     Multi-pass encoding withffmpeg: ffmpeg -i fichierentree -pass 2-passlogfile ffmpeg2pass fichiersortie-2

·     Crop top 30 pixels and bottom30 pixels to get a new video file: ffmpeg-i input_file.flv -croptop 30 -cropbottom 30 -target ntsc-dvd -aspect 16:9output_file.mpg

·     Delaying the audio or the video:ffmpeg -i input1 -itsoffset 00:00:03.5 -iinput2 ………..


4 ffmpeg learning resources


·     Using ffmpeg to manipulate audio andvideo files: you should see this page at first

·     Video/Audio Encoding CheatSheet, then you must know this cheat sheet

·     A FFmpeg TutorialFor Beginners, so so a tutorial after you see the first tutorial

·     Someuseful parameters related to h264 using ffmpeg, to be studied.

·     How to Write a Video Player inLess Than 1000 Lines, deep into the ffmpeg source code

·     Making movies from image filesusing ffmpeg/mencoder, enjoy it.

·     Category:FFmpeg,a wiki about ffmpeg.


5 Related tools



5.1 transcode



5.2 mencode(from mplayer)



6 yamdi给视频增加关键帧


·     Yet Another MetaData Injector, see http://yamdi.sourceforge.net/

·     options:

·     -i: 输入文件

·     -o: 输出文件

·     -x: An XML file with theresulting metadata information.

·     -l: Adds the onLastSecondevent(?).

·     other tools:

·     flvtool2: written by Ruby,slow, need more memory

·     flvmdi: not open source


7 ffmpegthumbnailer截取视频的thumbnail


·     ubuntu: sudo apt-get installffmpegthumbnailer

·     options:

·     -i<s>: input file

·     -o<s>: output file

·     -s<n>: thumbnail size(default: 128)

·     -q<n>: image quality (0 =bad, 10 = best) (default: 8) (only for jpeg)

·     -c<s>: override imageformat (jpeg or png) (default: determined by filename)

·     -t<n|s>: time to seek to(percentage or absolute time hh:mm:ss) (default: 10%)

·     -a: ignore aspect ratio andgenerate square thumbnail

·     -f: create a movie stripoverlay


8 Youku的一些探索


·     Youku网站上的大部分视频都是分段的,一般每段视频在5-10分钟之内

·     目前Youku网上的视频格式大概有三种:

·     高清mp4格式(h264编码)

·     高清flv格式(h264编码)

·     普通flv格式(应该是h263编码)


Author: Lox Freeman <lox@freelox>

Date: 2010-07-22 17:01:00 CST

HTML generated by org-mode 6.21b in emacs23


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值