FFmpegSource
(→C Plugin: update link) |
(update documentation to coincide with v2.22) |
||
Line 1: | Line 1: | ||
{{FilterCat|External_filters|Plugins|Source_filters}} | {{FilterCat|External_filters|Plugins|Source_filters}} | ||
{{Filter5 | {{Filter5 | ||
− | |1={{Author/Myrsloik}} | + | |1={{Author/Myrsloik}}, et al. |
− | |2=v2. | + | |2=v2.22 |
− | |3=[http://github.com/FFMS/ffms2/releases FFMS2 v2. | + | |3=[http://github.com/FFMS/ffms2/releases FFMS2 v2.22] |
|4=[http://forum.doom9.org/member.php?u=135430 10bithack version] | |4=[http://forum.doom9.org/member.php?u=135430 10bithack version] | ||
|5=[http://github.com/FFMS/ffms2/blob/master/doc/ffms2-avisynth.md User Manual] | |5=[http://github.com/FFMS/ffms2/blob/master/doc/ffms2-avisynth.md User Manual] | ||
Line 15: | Line 15: | ||
<br> | <br> | ||
== Requirements == | == Requirements == | ||
− | * AviSynth 2. | + | * AviSynth 2.6.0 or [http://sourceforge.net/projects/avisynth2/ greater] |
− | * Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]], [[YV12]]<br> | + | * Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]<br> |
:([[High_bit-depth_Support_with_Avisynth#Importing_High_Bit-depth_Video_into_AviSynth|10-bit formats]] are supported with the 10bithack version - see alternate download above) | :([[High_bit-depth_Support_with_Avisynth#Importing_High_Bit-depth_Video_into_AviSynth|10-bit formats]] are supported with the 10bithack version - see alternate download above) | ||
<br> | <br> | ||
Line 67: | Line 67: | ||
{{PluginFilterRow|FFmpegSource|FFVideoSource| | {{PluginFilterRow|FFmpegSource|FFVideoSource| | ||
Opens video. Will invoke indexing of all video tracks (but no audio tracks) if no valid index file is found. | Opens video. Will invoke indexing of all video tracks (but no audio tracks) if no valid index file is found. | ||
− | | [[RGB24]], [[RGB32]], [[YUY2]], [[YV12]] | + | | [[RGB24]], [[RGB32]], [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]] |
+ | }} | ||
+ | {{PluginFilterRow|FFmpegSource|FFmpegSource2| | ||
+ | A convenience function that combines the functionality of <tt>FFVideoSource</tt> and <tt>FFAudioSource</tt>. | ||
+ | | [[RGB24]], [[RGB32]], [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]] | ||
+ | }} | ||
+ | {{PluginFilterRow|FFmpegSource|FFMS2| | ||
+ | A shorter <tt>FFmpegSource2</tt> alias, this feature was added in v2.22 | ||
+ | | [[RGB24]], [[RGB32]], [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]] | ||
+ | }} | ||
+ | {{PluginFilterRow|FFmpegSource|FFImageSource| | ||
+ | A convenience alias for <tt>FFVideoSource</tt>, with the options set optimally for using it as an image reader. Disables caching and seeking for maximum compatiblity. | ||
+ | | [[RGB24]], [[RGB32]], [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]] | ||
}} | }} | ||
{{PluginFilterRow|FFmpegSource|FFSetLogLevel| | {{PluginFilterRow|FFmpegSource|FFSetLogLevel| | ||
Line 82: | Line 94: | ||
}} | }} | ||
{{PluginFilterRowNote| | {{PluginFilterRowNote| | ||
− | '''Note''': the following functions are provided by <tt>[ | + | '''Note''': the following functions are provided by <tt>[http://raw.githubusercontent.com/FFMS/ffms2/master/etc/FFMS2.avsi FFMS2.avsi]</tt> and are not available unless that script has been imported or autoloaded. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}} | }} | ||
{{PluginFilterRow|FFmpegSource|FFFormatTime| | {{PluginFilterRow|FFmpegSource|FFFormatTime| |
Revision as of 03:00, 21 October 2015
Abstract | |
---|---|
Author | Myrsloik, et al. |
Version | v2.22 |
Download | FFMS2 v2.22 |
Alt. Download | 10bithack version |
Documentation | User Manual |
Category | Source filters |
License | MIT / binary is GPLv3 |
Discussion | Doom9 Thread |
Contents |
Description
Opens files using FFmpeg and (almost) nothing else. May be frame accurate on good days. The source is MIT licensed and can be obtained from the GitHub repository. The precompiled binary is GPL3 licensed.
Requirements
- (10-bit formats are supported with the 10bithack version - see alternate download above)
Limitations
- Because of LAVF's demuxer, most raw streams (such as elementary h264 and other mpeg video streams) will fail to work properly.
- FFAudioSource() will have to remake any index implicitly created by FFVideoSource() and therefore code like
AudioDub(FFVideoSource(X), FFAudioSource(X))
will require two indexing passes.
Apart from the time consumed this is harmless. To work around it open the audio first:A = FFAudioSource(X) V = FFVideoSource(X) AudioDub(V, A)
or use FFIndex(), like so:FFIndex(X) AudioDub(FFVideoSource(X), FFAudioSource(X))
. - Interlaced H.264 mostly works these days, but seeking may occasionally result in corruption.
- Transport Streams will not decode reliably without seekmode -1.
- Open-GOP H.264 will sometimes produces corruption when seeking.
Known Issues
- Interlaced H.264 is decoded in an odd way; each field gets its own full-height frame and the fieldrate is reported as the framerate, and furthermore one of the fields (odd or even) may "jump around". To get the correct behavior, you can try setting fpsnum and fpsden so that the framerate is halved (may or may not work). This issue is caused by libavcodec.
Compatibility
Video
- AVI, MKV, MP4, FLV: Frame accurate
- WMV: Frame accurate(?) but avformat seems to pick keyframes relatively far away
- OGM: Frame accurate(?)
- VOB, MPG: Seeking seems to be off by one or two frames now and then
- M2TS, TS: Seeking seems to be off a few frames here and there
- Image files: Most formats can be opened if seekmode=-1 is set, no animation support
Audio
Seeking should be sample-accurate with most codecs in AVI, MKV, MP4 and FLV with two notable exceptions, namely MP3 and AC3 where FFmpeg's decoders seem to be completely broken (with MP3 in particular you can feed the decoder the same encoded data three times in a row and get a different decoded result every time). Still, results should usually be "good enough" for most purposes.
Decoding linearly will almost always work correctly.
Indexing and You
Before FFMS2 can open a file, it must be indexed first so that keyframe/sample positions are known and seeking is easily accomplished. This is done automatically when using FFVideoSource() or FFAudioSource(), but if you want to you can invoke the indexing yourself by calling FFIndex(), or by running ffmsindex.exe. By default the index is written to a file so it can be reused the next time you open the same file, but this behavior can be turned off if desired.
If you wonder why FFMS2 takes so long opening files, the indexing is the answer. If you want a progress report on the indexing, you can use the supplied ffmsindex.exe commandline program.
Function Reference
For complete documentation see the FFMS2 GitHub page.
Filter | Description | Color format | ||
---|---|---|---|---|
FFIndex |
Indexes a number of tracks in a given source file and writes the index file to disk, where it can be picked up and used by FFVideoSource or FFAudioSource. |
|||
FFAudioSource |
Opens audio. Invokes indexing of all tracks if no valid index file is found, or if the requested track isn't present in the index. |
|||
FFVideoSource |
Opens video. Will invoke indexing of all video tracks (but no audio tracks) if no valid index file is found. |
RGB24, RGB32, YUY2, Y8, YV12, YV16, YV24, YV411 | ||
FFmpegSource2 |
A convenience function that combines the functionality of FFVideoSource and FFAudioSource. |
RGB24, RGB32, YUY2, Y8, YV12, YV16, YV24, YV411 | ||
FFMS2 |
A shorter FFmpegSource2 alias, this feature was added in v2.22 |
RGB24, RGB32, YUY2, Y8, YV12, YV16, YV24, YV411 | ||
FFImageSource |
A convenience alias for FFVideoSource, with the options set optimally for using it as an image reader. Disables caching and seeking for maximum compatiblity. |
RGB24, RGB32, YUY2, Y8, YV12, YV16, YV24, YV411 | ||
FFSetLogLevel |
Sets the FFmpeg logging level, i.e. how much diagnostic spam it prints to STDERR. |
|||
FFGetLogLevel |
Returns the current log level, as an integer. |
|||
FFGetVersion |
Returns the FFMS2 version, as a string. |
|||
Note: the following functions are provided by FFMS2.avsi and are not available unless that script has been imported or autoloaded. | ||||
FFFormatTime |
A helper function used to format a time given in milliseconds into a h:mm:ss.ttt string. Used internally by FFInfo. |
|||
FFInfo |
A helper function similar to Avisynth's internal Info() function; shows general information about the current frame. |
Exported AviSynth variables
All variable names are prefixed by the varprefix argument to the respective FFVideoSource or FFAudioSource call that generated them.
FFSAR_NUM, FFSAR_DEN, FFSAR
The playback aspect ratio specified by the container. FFSAR_NUM and FFSAR_DEN make up the rational number of the ratio; FFSAR is only provided for convenience and may not be set in case it cannot be calculated (i.e. if FFSAR_DEN is zero).
FFCROP_LEFT, FFCROP_RIGHT, FFCROP_TOP, FFCROP_BOTTOM
The on-playback cropping specified by the container.
FFCOLOR_SPACE
The colorimetry the input claims to be using. Only meaningful for YUV inputs. The source for this variable is a metadata flag that can arbitrarily be set or manipulated at will by incompetent users or buggy programs without changing the actual video content, so blindly trusting its correctness is not recommended.
The value is exported as a cryptic numerical constant that matches the values in the MPEG-2 specification. You can find the gory details in the FFMS2 API documentation, but the important ones are:
0: RGB (usually indicates the stream isn't actually YUV, but RGB flagged as YUV) 1: ITU-R Rec.709 2: Unknown or unspecified 5 and 6: ITU-R Rec.601
FFCOLOR_RANGE
The color range the input video claims to be using. Much like FFCOLOR_SPACE, the source for this variable is a metadata flag that can freely be set to arbitrary values, so trusting it blindly might not be a good idea.
Note that using SWScale() or the width/height/colorspace parameters to FFVideoSource may under some circumstances change the output color range.
0: Unknown/unspecified 1: Limited range (usually 16-235) 2: Full range (0-255)
FFPICT_TYPE
The picture type of the most recently requested frame as the ASCII number of the character listed below. Use Chr() to convert it to an actual letter in AviSynth. Use after_frame=true in AviSynth's conditional scripting for proper results. Only set when rffmode=0. The FFmpeg source definition of the characters:
I: Intra P: Predicted B: Bi-dir predicted S: S(GMC)-VOP MPEG4 i: Switching Intra p: Switching Predicted b: FF_BI_TYPE (no good explanation available) ?: Unknown
FFVFR_TIME
The actual time of the source frame in milliseconds. Only set when no type of CFR conversion is being done (rffmode and fpsnum left at their defaults). FFCHANNEL_LAYOUT
The audio channel layout of the audio stream. This is exported as a very cryptic integer that is constructed in the same way as the dwChannelMask property of the Windows WAVEFORMATEXTENSIBLE struct. If you don't know what a WAVEFORMATEXTENSIBLE is or what the dwChannelMask does, don't worry about it.
FFVAR_PREFIX
The variable prefix of the last called FFMS source function. Note that this is a global variable.
C Plugin
The C plugin supports the additional planar colorspaces in AviSynth 2.6. Also starting with r940+64 it removes the Matroska demuxer too. This means that the *only* demuxer this build of FFMS2 uses is LAVF. The test this time is whether VP8 (and maybe VP9) bearing WebM files can be used correctly with the LAVF demuxer.
- Discussion - Doom9 Thread
- Download - FFMS2 C-plugin r1072+90
Note: C-plugins must be loaded using LoadCPlugin.
External Links
- Doom9 Forum - FFmpegSource discussion.
- GitHub - Source code repository.
Back to External Filters ←