SegmentedAviSource
Raffriff42 (Talk | contribs) m (typo) |
(add link to avs+ documentation) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | <div style="max-width:62em" > | |
− | + | <div {{BlueBox2|40|0|3px solid purple}} > | |
− | + | {{AvsPlusFullname}}<br> | |
+ | Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/segmentedsource.html https://avisynthplus.readthedocs.io] | ||
+ | </div> | ||
+ | |||
+ | '''SegmentedAviSource''' loads up to 100 [[AVI]] files per {{FuncArg|base_filename}} using [[AviSource]] and joins them using [[UnalignedSplice]]. | ||
+ | :If {{FuncArg|base_filename}}="d:\filename.ext", this filter will load the files d:\filename'''.00'''.ext, d:\filename'''.01'''.ext and so on, through d:\filename'''.99'''.ext. Any files in this sequence that don't exist will be skipped. As with [[AviSource]] there is built-in [http://en.wikipedia.org/wiki/Windows_legacy_audio_components#Audio_Compression_Manager ''Audio Compression Manager''] support for decoding compressed audio tracks (MP3, AAC, AC3, etc). | ||
'''SegmentedDirectShowSource''' works the same way, but calling [[DirectShowSource]] in place of [[AviSource]]. | '''SegmentedDirectShowSource''' works the same way, but calling [[DirectShowSource]] in place of [[AviSource]]. | ||
+ | </div> | ||
== Syntax and Parameters == | == Syntax and Parameters == | ||
+ | <div style="max-width:62em" > | ||
{{FuncDefH4|SegmentedAviSource}} | {{FuncDefH4|SegmentedAviSource}} | ||
{{FuncDef | {{FuncDef | ||
Line 66: | Line 73: | ||
:{{Par2|seekzero|bool|false}} | :{{Par2|seekzero|bool|false}} | ||
− | ::If true, restrict backwards seeking only to the beginning, and seeking forwards is done the hard way (by reading all samples). Limited backwards seeking is allowed with non-indexed [http://en.wikipedia.org/wiki/Advanced_Systems_Format ASF]. | + | ::If true, restrict backwards seeking only to the beginning, and seeking forwards is done the hard way (by reading all samples). Limited backwards seeking is allowed with non-indexed [http://en.wikipedia.org/wiki/Advanced_Systems_Format ASF].{{Dubious|Talk:SegmentedAviSource}} |
− | : | + | |
:{{Par2|timeout|int|2000}} | :{{Par2|timeout|int|2000}} | ||
− | ::Set time (in milliseconds) to wait when DirectShow refuses to render. When the timeout period has expired and the frame has not been rendered, AviSynth returns a blank frame and/or silence. Negative {{FuncArg|timeout}} values will result in an error message. | + | ::Set time (in milliseconds) to wait when DirectShow refuses to render. When the timeout period has expired and the frame has not been rendered, AviSynth returns a blank frame and/or silence. Negative {{FuncArg|timeout}} values will result in an error message.{{Dubious|Talk:SegmentedAviSource}} |
− | : | + | |
− | :{{Par2|pixel_type|string| | + | :{{Par2|pixel_type|string|(auto)}} |
− | ::Request a color format from the decompressor. Valid values are | + | ::Request a color format from the decompressor. Valid values are: |
− | : | + | ::{|border="0" |
− | + | |[[YV24]], | |
− | + | |[[YV16]], | |
− | + | |[[YV12]], | |
− | + | |[[I420]], | |
− | + | |NV12, | |
− | + | |[[YUY2]], | |
− | + | |AYUV, | |
− | + | |Y41P, | |
− | + | |[[Y411]], | |
− | + | |ARGB, | |
− | | | + | |[[RGB32]], |
− | + | |[[RGB24]], | |
− | | | + | |[[YUV]], |
− | | | + | |YUVex, |
− | + | |[[RGB]], | |
− | | | + | |AUTO, |
− | + | |FULL | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | | | + | |
− | + | ||
− | | | + | |
− | | | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|} | |} | ||
+ | <div {{NotaBeneWidthIndent|56|5|2px solid blue}} > | ||
+ | By default, upstream DirectShow filters are free to bid all of their supported media types in the order of their choice. A few DirectShow filters get this wrong. The {{FuncArg|pixel_type}} argument limits the acceptable video stream subformats for the [http://en.wikipedia.org/wiki/DirectShow#Architecture IPin negotiation]. Note the graph builder may add a format converter to satisfy your request, so make sure the codec in use can actually decode to your chosen format. The MS format converter is just adequate. The "YUV" and "RGB" pseudo-types restrict the negotiation to all official supported YUV or RGB formats respectively. The "YUVex" also includes YV24, YV16, I420 and NV12 non-standard pixel types. The "AUTO" pseudo-type permits the negotiation to use all relevant official formats, YUV plus RGB. The "FULL" pseudo-type includes the non-standard pixel types in addition to those supported by "AUTO". The full order of preference is YV24, YV16, YV12, I420, NV12, YUY2, AYUV, Y41P, Y411, ARGB, RGB32, RGB24. Many DirectShow filters get this wrong, which is why it is not enabled by default. The option exists so you have enough control to encourage the maximum range of filters to serve your media. (See [http://forum.doom9.org/showthread.php?t=143321 discussion].) | ||
+ | |||
+ | The non-standard pixel types use the following GUID's respectively :- | ||
+ | <div style="font-family:Courier;font-size:85%;margin-left:1em;"> | ||
+ | MEDIASUBTYPE_I420 = {'024I', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};<br> | ||
+ | MEDIASUBTYPE_YV24 = {'42VY', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};<br> | ||
+ | MEDIASUBTYPE_YV16 = {'61VY', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};<br> | ||
+ | MEDIASUBTYPE_NV12 = {'21VN', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}; | ||
+ | </div></div> | ||
+ | |||
::In other words, if {{FuncArg|pixel_type}}="AUTO", it will try to output [[YV24]]; if that isn't possible it tries [[YV16]], and if that isn't possible it tries [[YV12]], etc... | ::In other words, if {{FuncArg|pixel_type}}="AUTO", it will try to output [[YV24]]; if that isn't possible it tries [[YV16]], and if that isn't possible it tries [[YV12]], etc... | ||
− | ::For [[Planar|planar]] color formats, adding a '''<tt>'+'</tt>''' prefix, ''e.g.'' <code>SegmentedDirectShowSource(..., pixel_type="'''+'''YV12")</code>, tells AviSynth the video rows are DWORD aligned in memory instead of packed. '''This can fix skew or tearing of the decoded video''' when the width of the picture is not divisible by 4. | + | ::For [[Planar|planar]] color formats, adding a '''<tt>'+'</tt>''' prefix, ''e.g.'' <code>SegmentedDirectShowSource(..., pixel_type="'''+'''YV12")</code>, tells AviSynth the video rows are DWORD aligned in memory instead of packed. '''This can fix skew or tearing of the decoded video''' with bad codecs when the width of the picture is not divisible by 4. |
− | + | </div> | |
== Notes == | == Notes == | ||
+ | <div style="max-width:62em" > | ||
==== Helpful hints ==== | ==== Helpful hints ==== | ||
*If you get an ''Unrecognized Exception'' while reading a VirtualDub-generated segmented AVI, delete the small final .avi file. | *If you get an ''Unrecognized Exception'' while reading a VirtualDub-generated segmented AVI, delete the small final .avi file. | ||
Line 125: | Line 127: | ||
<div {{BoxWidthIndent|56|3}} > | <div {{BoxWidthIndent|56|3}} > | ||
SegmentedAviSource("F:\t1\cap.avi", "F:\t2\cap.avi", "F:\t3\cap.avi") | SegmentedAviSource("F:\t1\cap.avi", "F:\t2\cap.avi", "F:\t3\cap.avi") | ||
+ | </div> | ||
</div> | </div> | ||
{{FilterCat|Internal filters|Media file filters|Source_filters}} | {{FilterCat|Internal filters|Media file filters|Source_filters}} |
Latest revision as of 06:17, 18 September 2022
AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io
SegmentedAviSource loads up to 100 AVI files per base_filename using AviSource and joins them using UnalignedSplice.
- If base_filename="d:\filename.ext", this filter will load the files d:\filename.00.ext, d:\filename.01.ext and so on, through d:\filename.99.ext. Any files in this sequence that don't exist will be skipped. As with AviSource there is built-in Audio Compression Manager support for decoding compressed audio tracks (MP3, AAC, AC3, etc).
SegmentedDirectShowSource works the same way, but calling DirectShowSource in place of AviSource.
Contents |
[edit] Syntax and Parameters
SegmentedAviSource(string base_filename [, ... ]
[, bool audio, string pixel_type, int vtrack, int atrack ] )
- string base_filename =
- If base_filename="d:\filename.avi", this filter will load the files d:\filename.00.avi, d:\filename.01.avi and so on, through d:\filename.99.avi. Any files in this sequence that don't exist will be skipped.
- bool audio = true
- Enable audio on the resulting clip.
- string pixel_type = "RGB32"
- Request a color format from the decompressor. Allowed values are:
- int vtrack = 0
- Specifies a numbered video track. Track numbers start from zero, and are guaranteed to be continuous (i.e. there must be a track 1 if there is a track 0 and a track 2). If no video stream numbered vtrack exists, an error will be raised.
- int atrack = 0
- Specifies a numbered audio track. Track numbers start from zero, and are guaranteed to be continuous (i.e. there must be a track 1 if there is a track 0 and a track 2). If no audio stream numbered atrack exists, no error will be raised, and no audio will be returned.
SegmentedDirectShowSource(string base_filename [, ... ]
[, float fps, bool seek, bool audio, bool video ]
[,bool convertfps, bool seekzero, int timeout, string pixel_type ] )
- string base_filename =
- If base_filename="d:\filename.mov", this filter will load the files d:\filename.00.mov, d:\filename.01.mov and so on, through d:\filename.99.mov. Any files in this sequence that don't exist will be skipped.
- float fps = 24
- Frames Per Second of the resulting clip.
- bool seek = true
- There is full seeking support available on most file formats. If problems occur, try setting seekzero=true first. If seeking still causes problems, disable seeking completely with seek=false. With seeking disabled and trying to seek backwards, the audio stream returns silence, and the video stream returns the most recently rendered frame. Note the Avisynth cache may provide limited access to the previous few frames, but beyond that the most recently frame rendered will be returned.
- bool audio = true
- Enable audio on the resulting clip.
- bool video = true
- Enable video on the resulting clip.
- bool convertfps = false
- If true, it turns VFR (variable framerate) video into CFR (constant framerate) video by adding frames. This allows you to open VFR video in AviSynth. It is most useful when fps is set to the least common multiple of the component frame rates, e.g. 120 or 119.880.
- bool seekzero = false
- If true, restrict backwards seeking only to the beginning, and seeking forwards is done the hard way (by reading all samples). Limited backwards seeking is allowed with non-indexed ASF.[dubious – discuss]
- int timeout = 2000
- Set time (in milliseconds) to wait when DirectShow refuses to render. When the timeout period has expired and the frame has not been rendered, AviSynth returns a blank frame and/or silence. Negative timeout values will result in an error message.[dubious – discuss]
- string pixel_type = (auto)
- Request a color format from the decompressor. Valid values are:
By default, upstream DirectShow filters are free to bid all of their supported media types in the order of their choice. A few DirectShow filters get this wrong. The pixel_type argument limits the acceptable video stream subformats for the IPin negotiation. Note the graph builder may add a format converter to satisfy your request, so make sure the codec in use can actually decode to your chosen format. The MS format converter is just adequate. The "YUV" and "RGB" pseudo-types restrict the negotiation to all official supported YUV or RGB formats respectively. The "YUVex" also includes YV24, YV16, I420 and NV12 non-standard pixel types. The "AUTO" pseudo-type permits the negotiation to use all relevant official formats, YUV plus RGB. The "FULL" pseudo-type includes the non-standard pixel types in addition to those supported by "AUTO". The full order of preference is YV24, YV16, YV12, I420, NV12, YUY2, AYUV, Y41P, Y411, ARGB, RGB32, RGB24. Many DirectShow filters get this wrong, which is why it is not enabled by default. The option exists so you have enough control to encourage the maximum range of filters to serve your media. (See discussion.)
The non-standard pixel types use the following GUID's respectively :-
MEDIASUBTYPE_I420 = {'024I', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};
MEDIASUBTYPE_YV24 = {'42VY', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};
MEDIASUBTYPE_YV16 = {'61VY', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};
MEDIASUBTYPE_NV12 = {'21VN', 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};
- For planar color formats, adding a '+' prefix, e.g.
SegmentedDirectShowSource(..., pixel_type="+YV12")
, tells AviSynth the video rows are DWORD aligned in memory instead of packed. This can fix skew or tearing of the decoded video with bad codecs when the width of the picture is not divisible by 4.
- For planar color formats, adding a '+' prefix, e.g.
[edit] Notes
[edit] Helpful hints
- If you get an Unrecognized Exception while reading a VirtualDub-generated segmented AVI, delete the small final .avi file.
- If segments are spanned across multiple drives/folders, they can be loaded provided the folders are given in the correct order.
- For example, if you have capture files arrange across several folders like this:
- To load all segments in order, call this:
SegmentedAviSource("F:\t1\cap.avi", "F:\t2\cap.avi", "F:\t3\cap.avi")