AviSource
Raffriff42 (Talk | contribs) (Undo revision 5756 by Raffriff42 (talk)) |
Raffriff42 (Talk | contribs) (Undo revision 5753 by Raffriff42 (talk)) |
||
Line 1: | Line 1: | ||
− | {{Template:Func4Def|AviSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC])|OpenDMLSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC])|AviFileSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC])|WavSource(string filename [, ... ])}} | + | {{Template:Func4Def|AviSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC], [int vtrack = 0], [int atrack = 0])|OpenDMLSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC], [int vtrack = 0], [int atrack = 0])|AviFileSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC], [int vtrack = 0], [int atrack = 0])|WavSource(string filename [, ... ])}} |
'''AviSource''' takes as argument one or more file name in quotes, and reads in the file(s) using either the Video-for-Windows "[[AVI|AVIFile]]" interface, or AviSynth's built-in OpenDML code (taken from [[VirtualDub]]). This filter can read any file for which there's an [[AVI|AVIFile]] handler. This includes not only [[AVI]] files but also [[WAV]] files, [[AVS]] (AviSynth script) files, and VDR ([[VirtualDub]] [[frameserver]]) files. If you give multiple filenames as arguments, the clips will be spliced together with [[Splice|UnalignedSplice]]. | '''AviSource''' takes as argument one or more file name in quotes, and reads in the file(s) using either the Video-for-Windows "[[AVI|AVIFile]]" interface, or AviSynth's built-in OpenDML code (taken from [[VirtualDub]]). This filter can read any file for which there's an [[AVI|AVIFile]] handler. This includes not only [[AVI]] files but also [[WAV]] files, [[AVS]] (AviSynth script) files, and VDR ([[VirtualDub]] [[frameserver]]) files. If you give multiple filenames as arguments, the clips will be spliced together with [[Splice|UnalignedSplice]]. | ||
Line 11: | Line 11: | ||
All parameters are optional. | All parameters are optional. | ||
:;audio (default true) | :;audio (default true) | ||
− | ::When set to true it will load the | + | ::When set to true it will load the audio stream (as specified by the atrack parameter) if present. When set to false, it will not load any audio streams. |
:;pixel_type | :;pixel_type | ||
Line 26: | Line 26: | ||
:;fourCC | :;fourCC | ||
::Forces use of a different codec than the default taken from the [[FourCC]] of the video stream. | ::Forces use of a different codec than the default taken from the [[FourCC]] of the video stream. | ||
+ | |||
+ | :;vtrack (default 0) | ||
+ | ::When vtrack is specified it will load the vtrack videostream (where we start counting at zero). When the videostream is not found, an error will be returned. | ||
+ | |||
+ | :;atrack (default 0) | ||
+ | ::When atrack is specified it will load the atrack audiostream (where we start counting at zero). When the audiostream is not found, no audio will be loaded. | ||
===== Helpful hints ===== | ===== Helpful hints ===== | ||
Line 82: | Line 88: | ||
# opens the second video and second audio stream of a clip | # opens the second video and second audio stream of a clip | ||
− | AviSource("D:\Projects\test_multi10.avi") | + | AviSource("D:\Projects\test_multi10.avi", vtrack=1, atrack=1) |
===== Windows7 users ===== | ===== Windows7 users ===== |
Revision as of 01:47, 16 June 2015
AviSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC], [int vtrack = 0], [int atrack = 0])
OpenDMLSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC], [int vtrack = 0], [int atrack = 0])
AviFileSource(string filename [, ... ], [bool audio = true], [string pixel_type = "FULL"], [string fourCC], [int vtrack = 0], [int atrack = 0])
WavSource(string filename [, ... ])
AviSource takes as argument one or more file name in quotes, and reads in the file(s) using either the Video-for-Windows "AVIFile" interface, or AviSynth's built-in OpenDML code (taken from VirtualDub). This filter can read any file for which there's an AVIFile handler. This includes not only AVI files but also WAV files, AVS (AviSynth script) files, and VDR (VirtualDub frameserver) files. If you give multiple filenames as arguments, the clips will be spliced together with UnalignedSplice.
The AviSource filter examines the file to determine its type and passes it to either the AVIFile handler or the OpenDML handler as appropriate. In case you have trouble with one or the other handler, you can also use the OpenDMLSource and AviFileSource filters, which force the use of one or the other handler. Either handler can read ordinary (< 2GB) AVI files, but only the OpenDML handler can read larger AVI files, and only the AVIFile handler can read other file types like WAV, VDR and AVS. There is built-in support for ACM (Audio Compression Manager) audio (e.g. mp3-AVIs).
WavSource can be used to open a WAV file, or the audio stream from an AVI file. This can be used, for example, if your video stream is damaged or its compression method is not supported on your system.
Contents |
Parameters
All parameters are optional.
- audio (default true)
- When set to true it will load the audio stream (as specified by the atrack parameter) if present. When set to false, it will not load any audio streams.
- This parameter has no effect if the video is in an uncompressed format, because no decompressor will be used in that case.
- Adding a '+' to the start of the pixel_type for planar formats assumes the lines are padded DWORD aligned in memory instead of packed. This can correct skew or tearing of the decoded video. E.g AviSource("...", pixel_type="+YV12"). This problem shows up when the width of the picture is not divisible by 4.
- fourCC
- Forces use of a different codec than the default taken from the FourCC of the video stream.
- vtrack (default 0)
- When vtrack is specified it will load the vtrack videostream (where we start counting at zero). When the videostream is not found, an error will be returned.
- atrack (default 0)
- When atrack is specified it will load the atrack audiostream (where we start counting at zero). When the audiostream is not found, no audio will be loaded.
Helpful hints
- There is a limit of (about 50) AviSource calls in script. See discussion.
- Sometimes the colors will be distorted when loading a DivX clip in AviSynth v2.5 (the chroma channels U and V are swapped), due to a bug in DivX (5.02 and older). You can use SwapUV to correct it.
- From v2.53 AVISource can also open DV type 1 video input (only video, not audio).
- Some MJPEG/DV codecs do not give correct CCIR 601 compliant output when using AVISource. The problem could arise if the input and output color format of the codec are different. For example if the input color format is YUY2, while the output format is RGB, or vice versa. There are two ways to resolve it:
- 1. Force the same output as the input color format. Thus for example (if the input is RGB):
AviSource("file.avi", pixel_type="RGB32")
- 2. Correct it with the filter ColorYUV:
AviSource("file.avi").ColorYUV(levels="PC->TV")
More on codecs
Some reference threads:
Examples
# C programmers note: backslashes are not doubled; forward slashes work too AVISource("d:\capture.avi") AVISource("c:/capture/00.avi") WAVSource("f:\soundtrack.wav") WAVSource("f:/soundtrack.wav")
# the following is the same as AVISource("cap1.avi") + AVISource("cap2.avi"): AVISource("cap1.avi", "cap2.avi")
# disables audio and request RGB32 decompression AVISource("cap.avi", false, "RGB32")
# opens a DV using the Canopus DV Codec AviSource("cap.avi", false, fourCC="CDVC") # opens an avi (for example DivX3) using the XviD Codec AviSource("cap.avi", false, fourCC="XVID")
# splicing two clips where one of them contains no audio. # when splicing the clips must be compatible (have the same video and audio properties): A = AviSource("FileA.avi") B = AviSource("FileB.avi") # No audio stream A ++ AudioDub(B, BlankClip(A))
# opens YV12 where the width is not a multiple of four Avisource("D:\Projects\test.avi", pixel_type="+YV12")
# opens the second video and second audio stream of a clip AviSource("D:\Projects\test_multi10.avi", vtrack=1, atrack=1)
Windows7 users
WavSource under Windows 7 is unable to load WAV files with 32-bit IEEE Float samples having the WAVEFORMAT structure. Guess they screwed something up in AVIFileSource. You can use ffmpeg to rewrite the header to an extensible format (just do a stream copy, -a:copy, it always writes extensible headers).
Changes
v2.60 | Added new color formats, "AUTO" and "FULL". |
Added multiple video and audio stream support | |
Add '+' to pixel_type for padded planar support. | |
v2.55 | Added fourCC option. |