CLI派视频音频转码工具用法小结
Table of Contents
· 2.3.1 crop options(视频剪裁选项说明)
· 2.3.2 pad and filter options
· 3 ffmpeg 用法示例(seehttp://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs for moreexamples)
· See http://ubuntuforums.org/showthread.php?t=786095for configuration of ffmpeg and libx264 on ubuntu 10.04
· -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.
· -ss: 设定剪辑开始时间[支持[hh:mm:ss[.xxx]]格式
· -t: 设定剪辑长度[支持[hh:mm:ss[.xxx]]格式
· -fs: 设定文件大小限制
· -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.
· -crop x:y:width:height: Cropthe input video to x:y:width:height.
· -croptop
· -cropbottom
· -cropleft
· -cropright
· -vf filter_graph
· -vf pad=width:height:x:y:color(这个命令可以给裁剪后的视频增加上下两个pad,形成电影似的效果)
· -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..).
· -scodec codec: force subtitlecodec ('copy' to copy stream).
· -newsubtitle: add a newsubtitle stream to the current output stream.
· -an: disable audio recording.
· -vn: disable video recording.
· -sn: disable subtitlerecording.
· -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
· -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 ………..
· 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.
· 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
· 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