LSMASHSource/LWLibavAudioSource

From Avisynth wiki
Jump to: navigation, search

LWLibavAudioSource uses libavcodec as an audio decoder and libavformat as a demuxer.

  • If audio stream can be coded as lossy, do pre-roll whenever any seek of audio stream.


Syntax and Parameters

LWLibavAudioSource (string source, int "stream_index", bool "cache", bool "av_sync", string "layout", int "rate", string "decoder")


string  source =
The path to the source file; path can be omitted if the source file is in the same directory as the AviSynth script (*.avs).


int  stream_index = -1
The stream index to open in the source file.
The value -1 means trying to get the first detected audio stream.


bool  cache = true
Create the index file (.lwi) to the same directory as the source file if set to true.
The index file avoids parsing all frames in the source file at the next or later access


bool  av_sync = false
Try Audio/Visual synchronization at the first video frame of the video stream activated in the index file if set to true.


string  layout = ""
Output audio channel layout.
If unspecified, audio stream is output to the buffer from the decoder via the resampler at the channel layout
which is the first maximum number of channels in audio stream.
You can specify channel layout by combination of the name of a channel layout with separator (+) as follows.


- The name or mask of a single channel.
FL (0x1) = Front Left
FR (0x2) = Front Right
FC (0x4) = Front Center
LFE (0x8) = Low Frequency Effect
BL (0x10) = Back Left
BR (0x20) = Back Right
FLC (0x40) = Front Left of Center
FRC (0x80) = Front Right of Center
BC (0x100) = Back Center
SL (0x200) = Side Left
SR (0x400) = Side Right
TC (0x800) = Top Center
TFL (0x1000) = Top Front Left
TFC (0x2000) = Top Front Center
TFR (0x4000) = Top Front Right
TBL (0x8000) = Top Back Left
TBC (0x10000) = Top Back Center
TBR (0x20000) = Top Back Right
DL (0x20000000) = Stereo Downmixed Left
DR (0x40000000) = Stereo Downmixed Right
WL (0x80000000) = Wide Left
WR (0x100000000) = Wide Right
SDL (0x200000000) = Surround Direct Left
SDR (0x400000000) = Surround Direct Right
LFE2 (0x800000000) = Low Frequency Effect 2
$ Example: standard ffmpeg based 5.1ch surround layout : FL+FR+FC+LFE+BL+BR = 0x3f


- The name of a usual channel layout.
libav ffmpeg
mono = FC FC
stereo = FL+FR FL+FR
2.1 = FL+FR+LFE FL+FR+LFE
3.0 = FL+FR+FC FL+FR+FC
3.0(back) = FL+FR+BC FL+FR+BC
3.1 = FL+FR+FC+LFE FL+FR+FC+LFE
4.0 = FL+FR+FC+BC FL+FR+FC+BC
quad = FL+FR+BL+BR FL+FR+BL+BR
quad(side) = FL+FR+SL+SR FL+FR+SL+SR
5.0 = FL+FR+FC+SL+SR FL+FR+FC+BL+BR
5.1 = FL+FR+FC+LFE+SL+SR FL+FR+FC+LFE+BL+BR
6.0 = FL+FR+FC+BC+SL+SR FL+FR+FC+BC+SL+SR
6.0(front) = FL+FR+FLC+FRC+SL+SR FL+FR+FLC+FRC+SL+SR
hexagonal = FL+FR+FC+BL+BR+BC FL+FR+FC+BL+BR+BC
6.1 = FL+FR+FC+LFE+BC+SL+SR FL+FR+FC+LFE+BC+SL+SR
6.1(front) = FL+FR+LFE+FLC+FRC+SL+SR FL+FR+LFE+FLC+FRC+SL+SR
7.0 = FL+FR+FC+BL+BR+SL+SR FL+FR+FC+BL+BR+SL+SR
7.0(front) = FL+FR+FC+FLC+FRC+SL+SR FL+FR+FC+FLC+FRC+SL+SR
7.1 = FL+FR+FC+LFE+BL+BR+SL+SR FL+FR+FC+LFE+BL+BR+SL+SR
7.1(wide) = FL+FR+FC+LFE+FLC+FRC+SL+SR FL+FR+FC+LFE+BL+BR+FLC+FRC
7.1(wide-side) = N/A FL+FR+FC+LFE+FLC+FRC+SL+SR
octagonal = FL+FR+FC+BL+BR+BC+SL+SR FL+FR+FC+BL+BR+BC+SL+SR
downmix = DL+DR DL+DR


- Number of channels.
libav ffmpeg
1 = FC FC
2 = FL+FR FL+FR
3 = FL+FR+FC FL+FR+LFE
4 = FL+FR+BL+BR FL+FR+FC+BC
5 = FL+FR+FC+SL+SR FL+FR+FC+BL+BR
6 = FL+FR+FC+LFE+SL+SR FL+FR+FC+LFE+BL+BR
7 = FL+FR+FC+LFE+BC+SL+SR FL+FR+FC+LFE+BC+SL+SR
8 = FL+FR+FC+LFE+BL+BR+SL+SR FL+FR+FC+LFE+BL+BR+SL+SR
Note: the above listed notations are the present things.
In the future, they might be changed.


int  rate = 0
Audio sampling rate or sampling frequency in units of Hz.
The value 0 means audio stream is output to the buffer via the resampler at the maximum sampling rate in audio stream.
Otherwise, audio stream is output to the buffer via the resampler at specified sampling rate.


string  decoder = ""
Same as 'decoder' of LSMASHVideoSource.


Examples

LWLibavAudioSource with default settings:

LWLibavAudioSource(source="source.m2t2", stream_index=-1, cache=true, 
\     av_sync=false, layout="", rate=0, decoder="")




Back to LSMASHSource

Personal tools