Aegisub/FFmpegSource/ffmpegsource.html
Fredrik Mellbin e091763052 FFmpegSource 1.19
Originally committed to SVN as r2195.
2008-05-31 09:16:05 +00:00

329 lines
14 KiB
HTML

<html>
<head>
<title>
FFmpegSource Documentation
</title>
</head>
<body>
<h1>FFmpegSource Documentation</h1>
<p>
Opens files using ffmpeg and nothing else. May be frame accurate on good days. The source is BSD licensed and can be obtained from https://spaceboyz.net/svn/aegisub/trunk/FFmpegSource. The precompiled binary is GPL licensed.
</p>
<h2>Compatibility - Video</h2>
<ul>
<li>AVI, MKV, MP4, FLV: Frame accurate</li>
<li>WMV: Frame accurate(?) but avformat seems to pick keyframes relatively far away</li>
<li>OGM: Messed up first frame and seeking produces smearing with seekmode=3, incredibly slow seeking without, remux to mkv or avi</li>
<li>VOB: No rff flags applied, frame accurate?</li>
<li>MPG: Seeking seems to be off by one or two frames now and then</li>
<li>M2TS, TS: Linear access only (seekmode=-1)</li>
<li>Image files: most formats can be opened if seekmode=-1 is set</li>
</ul>
<h2>Compatibility - Audio</h2>
<ul>
<li>Should be sample accurate in all containers with audio cache</li>
<li>Can produce very bad distortions when caching is not used for certain formats like aac</li>
</ul>
<h2>Usage</h2>
<p>
<b>FFmpegSource(string source, int vtrack = -1, int atrack = -2, string timecodes, bool vcache = true, string vcachefile, string acachefile, string pp, int ppquality = 6, int threads = -1, int seekmode = 1)</b><br />
</p>
<p>
Note that the audio cache will always be created when opening files with audio and that it will be huge since it stores all audio as raw signed 16/24/32 bit pcm, unsigned 8 bit pcm or as float, using flac to compress it is also possible to reduce the size by half.
</p>
<p>
<b>FFAudioSource(string source, int atrack = -1, string acachefile, string acachefile2)</b><br />
</p>
<p>
Experimental, may or may not be accurate enough for real usage.
</p>
<p>
<b>FFPP(clip, string pp, int ppquality = 6)</b><br />
Separate postprocessing which also seems to include a few simple deinterlacers
</p>
<p>
<b>SWScale(clip, width = -1, height = -1, resizer = "BICUBIC", colorspace = "")</b><br />
Separate postprocessing which also seems to include a few simple deinterlacers
</p>
<p>
<b>source:</b>
Source file.
</p>
<p>
<b>atrack &amp; vtrack:</b>
Track number as seen by the relevant demuxer, starts from 0, -1 means it will pick the first suitable track and -2 means it's disabled.
</p>
<p>
<b>timecodes:</b>
File to output timecodes to, if the file exists it will be overwritten.
</p>
<p>
<b>vcache:</b>
Write video indexing information to a file for later use. This setting does not control if The video index is loaded which it always is if it exists.
</p>
<p>
<b>vcachefile, acachefile &amp; acachefile2:</b>
Specifies the file to store the index information or raw audio in, if nothing is specified (source).ffv(tracknumber)cache is used for video and (source).ffa(d if FFAudioSource is used)(tracknumber)cache for audio. The second audio cache file is only required/created when not opening matroska files.
</p>
<p>
<b>pp:</b>
See the table below for a full description, an empty string means no processing. It is recommended to avoid the autoq option since it's currently unknown what effect it will have on the processing.
</p>
<p>
<b>ppquality:</b>
The quality to use for the specified postprocessing. Valid values are 0-6 where 0 usually means that no actual processing is done.
</p>
<p>
<b>threads:</b>
Sets the number of decoder threads used. Defaults to the number of cpus reported by windows. Ignored by lavc if the used decoder doesn't implement it.
</p>
<p>
<b>seekmode:</b>
Force how seeking is handled, has no effect on matroska files which always use the equivalent of seekmode=1<br />
<b>-1:</b> linear access without rewind, will throw an error if each successive requested frame number isn't bigger than the last one, only intended for opening images but might work on well with some obscure video format<br />
<b>0:</b> linear access, the definition of slow but should make some formats "usable"<br />
<b>1:</b> safe normal, bases seeking decisions on the reported keyframe positions<br />
<b>2:</b> unsafe normal, same as 1 but no error will be thrown if the exact destination has to be guessed<br />
<b>3:</b> aggressive, seek in the forward direction even if no closer keyframe is known to exist, only useful for testing and containers where avformat doesn't report keyframes properly
</p>
<p>
<b>width &amp; height:</b>
Width and height to resize to. Value below or equal to 0 is the same as specifying the input dimensions.
</p>
<p>
<b>resizer:</b>
Selects the resizer used for resampling the chroma planes and normal resizing. The available methods are: FAST_BILINEAR, BILINEAR, BICUBIC, X, POINT, AREA, BICUBLIN, GAUSS, SINC, LANCZOS and SPLINE.
</p>
<p>
<b>colorspace:</b>
The colorspace to convert to. The names are YV12, YUY2, RGB24, RGB32 and the empty string for same as input.
</p>
<h2>PP string format</h2>
<pre>
Available postprocessing filters:
Filters Options
short long name short long option Description
* * a autoq CPU power dependent enabler
c chrom chrominance filtering enabled
y nochrom chrominance filtering disabled
n noluma luma filtering disabled
hb hdeblock (2 threshold) horizontal deblocking filter
1. difference factor: default=32, higher -> more deblocking
2. flatness threshold: default=39, lower -> more deblocking
the h & v deblocking filters share these
so you can't set different thresholds for h / v
vb vdeblock (2 threshold) vertical deblocking filter
ha hadeblock (2 threshold) horizontal deblocking filter
va vadeblock (2 threshold) vertical deblocking filter
h1 x1hdeblock experimental h deblock filter 1
v1 x1vdeblock experimental v deblock filter 1
dr dering deringing filter
al autolevels automatic brightness / contrast
f fullyrange stretch luminance to (0..255)
lb linblenddeint linear blend deinterlacer
li linipoldeint linear interpolating deinterlace
ci cubicipoldeint cubic interpolating deinterlacer
md mediandeint median deinterlacer
fd ffmpegdeint ffmpeg deinterlacer
l5 lowpass5 FIR lowpass deinterlacer
de default hb:a,vb:a,dr:a
fa fast h1:a,v1:a,dr:a
ac ha:a:128:7,va:a,dr:a
tn tmpnoise (3 threshold) temporal noise reducer
1. <= 2. <= 3. larger -> stronger filtering
fq forceQuant <quantizer> force quantizer
Usage:
<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...
long form example:
vdeblock:autoq/hdeblock:autoq/linblenddeint default,-vdeblock
short form example:
vb:a/hb:a/lb de,-vb
more examples:
tn:64:128:256
</pre>
<h2>Compiling</h2>
<p><b>zlib</b> from http://www.zlib.net/</p>
<p><b>FFmpeg svn</b> from http://ffmpeg.mplayerhq.hu/</p>
<p><b>Required FFmpeg Configuration:</b>
./configure --enable-memalign-hack --enable-gpl --enable-swscale --enable-postproc
<p><b>Suggested Additional Options:</b>
--enable-w32threads --disable-encoders --disable-muxers --enable-small --enable-libfaad --disable-debug</p>
<p>
Note that --enable-w32threads is required for multithreaded decoding to work.
</p>
<h2>Changes</h2>
<ul>
<li>1.19<ul>
<li>Now automatically detects the number of cpus and uses it as the default for the number of decoding threads</li>
<li>Added SWScale filter which can perform colorspace conversions and resizing and has many different resizers to choose from</li>
<li>Now exports the stored cropping values in mkv files in the variables FFCROP_LEFT, FFCROP_RIGHT, FFCROP_TOP and FFCROP_BOTTOM</li>
<li>Updated FFmpeg to rev 13572</li>
</ul></li>
<li>1.18<ul>
<li>Reverted error handling because it broke vc1</li>
</ul></li>
<li>1.17<ul>
<li>Now sets the video SAR (if any) in the variables FFSAR, FFSAR_NUM and FFSAR_DEN when being invoked</li>
<li>Changed error handling slightly in video decoding (most errors are still ignored)</li>
<li>Fixed a bug where the last frame(s) wouldn't be returned properly in h264 with b-frames+pyramid</li>
<li>Updated FFmpeg to rev 12685</li>
</ul></li>
<li>1.16<ul>
<li>Added many new and missing matroska codec ids</li>
<li>Added threads argument to set the number of decoding threads used</li>
<li>Completely removed FLAC cache</li>
<li>Updated FFmpeg to rev 12382</li>
</ul></li>
<li>1.15<ul>
<li>Updated FFmpeg to rev 11518</li>
</ul></li>
<li>1.14<ul>
<li>If the output colorspace is YV12 or YUY2 the width and height may be automatically cropped by one pixel to make it an even number</li>
<li>FLAC cache is disabled because the static FLAC lib doesn't want to link</li>
<li>Added the experimental FFAudioSource which doesn't need a huge uncompressed cache</li>
<li>The plugin is now statically compiled</li>
<li>Updated FFmpeg to rev 11413</li>
</ul></li>
<li>1.13<ul>
<li>Now always sorts the output timecodes so native avc in mkv won't have out of order values</li>
<li>Fixed the missing '# timecode format v2' line in saved timecode files</li>
<li>Now properly handles video files where the output resolution isn't known until a frame has been decoded (seems to fix flv4)</li>
<li>Now throws an error if the video decoder returns zero size video</li>
<li>Added an avsi file for easy autoloading</li>
<li>Updated libFLAC to 1.2.1<li>
<li>Updated FFmpeg to rev 10671 + camtasia swapped colors fix</li>
</ul></li>
<li>1.12<ul>
<li>Now caches the last fully decoded frame to increase the reliability of seekmode=-1 and possibly reduce seeking in other modes</li>
<li>Video that needs to be converted to a suitable output format should now always have correct colors (was reversed in 1.11 and inconsistent in earlier versions)</li>
<li>Added seekmode=-1 which is mostly useful for opening image files very carefully</li>
<li>Now throws an error if the container is unseekable and seekmode=-1 isn't set</li>
<li>Updated FFmpeg to rev 10492 + camtasia swapped colors fix</li>
</ul></li>
<li>1.11<ul>
<li>Now officially uses the MIT license</li>
<li>Much cleaner source</li>
<li>Can be compiled without support for compressing the audio cache with FLAC</li>
<li>Supports more audio formats in matroska</li>
<li>RGB24 output no longer has swapped colors if the video is converted to it for output (there still seems to be some bugs lurking when conversion is done with libswscale)</li>
<li>Fixed an access violation on close when no audio is opened (introduced in 1.10)</li>
<li>Updated FFmpeg to rev 10423</li>
</ul></li>
<li>1.10<ul>
<li>The audio cache compression level is now ignored if the source isn't 16bit and the raw format is used instead</li>
<li>FLAC is now actually initialized properly so the cache actually works for files that aren't stereo (16bit limit still applies)</li>
<li>Now uses proper callbacks for FLAC so it works with larger than 2GB files</li>
<li>Doesn't (over)write the video cache with an empty one in certain cases when avformat is used for the source</li>
</ul></li>
<li>1.9<ul>
<li>Added the possibility to compress the audio cache with FLAC (currently only works with 16bit audio)</li>
<li>Added another planar YUV 4:2:0 format to the supported output formats (fixes certain mov files)</li>
<li>Less memory is now allocated on the stack which makes av_find_stream_info() work for all files (fixes certain mov files)</li>
<li>Updated FFmpeg to rev 10186</li>
</ul></li>
<li>1.8<ul>
<li>Updated FFmpeg to rev 10141</li>
</ul></li>
<li>1.7<ul>
<li>Updated FFmpeg</li>
<li>Fixed error with mkv for codecs without codec private data and the first packet doesn't belong to them</li>
</ul></li>
<li>1.6<ul>
<li>Fixed ac3 and other formats stored in mkv</li>
<li>Skip unnecessary seeking when index information already exists (gif file opening only 3/4 broken now)</li>
<li>Throws an error when the selected audio/video track has no frames/samples</li>
</ul></li>
<li>1.5<ul>
<li>Fixed a bug that made avformat opened files only return audio if only the audio cache needed to be created</li>
<li>Rejects more corrupt cache files</li>
<li>Fixed crash when a 0 byte audio cache file is present</li>
<li>Improved framerate guessing for avformat which now takes takes the duration of the first frame into account</li>
<li>Fixed a bug introduced in 1.4 that would make the number of reported frames too high for files opened with avformat</li>
<li>Fixed mpeg2 and probably some other formats stored in mkv</li>
<li>Fixed issues with large mkv files and large audio cache files</li>
<li>FFmpeg is now compiled with liba52 and faad2</li>
</ul></li>
<li>1.4<ul>
<li>Uses the average framerate for mkv files</li>
<li>Naming scheme of cache files changed to prevent confusion with the default names in files with multiple tracks of the same type</li>
<li>Use mmx optimizations in swscaler when possible</li>
<li>Now uses normal windows linebreaks in all files</li>
<li>Removed FFAudioSource</li>
<li>Merged FFVideoSource and FFAudioRefSource into FFmpegSource</li>
<li>Added postprocessing with libpostproc in FFmpegSource and separately in FFPP</li>
</ul></li>
<li>1.3<ul>
<li>Compiled against ffmpeg rev9620</li>
<li>Added FFAudioRefSource</li>
<li>Added FFAudioSource (has big issues)</li>
<li>Renamed FFmpegSource to FFVideoSource</li>
<li>Adjusted seeking in the forward direction to only be done if the requested frame is more than 10 frames away to reduce unnecessary seeking</li>
<li>Now outputs the last frame properly when there are decoding delays</li>
</ul></li>
<li>1.2<ul>
<li>Compiled against ffmpeg rev9451</li>
<li>Somewhat cleaner source code</li>
<li>Linear access in addition to a few other modes of seeking can now be forced</li>
<li>Can now save the index information to a file which makes subsequent file opening fast</li>
<li>No longer skips indexing for any format</li>
</ul></li>
<li>1.1<ul>
<li>Skip indexing for avi</li>
<li>Prefix all error messages with the plugin name</li>
<li>Can write v2 timecodes to a file</li>
<li>Fixed reported framerate</li>
</ul></li>
</ul>
</body>
</html>