SegmentedAviSource
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 |
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.
Notes
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")