User Tools

Site Tools


tinypy:avidemux

This is an old revision of the document!


Avidemux Class

Assuming you created an instance with adm=Avidemux()

Loading and saving file

adm.loadVideo('fileName')

Load the video given as parameter

adm.appendVideo('fileName')

Append the video given as parameter

adm.saveVideo('fileName')

Save the video with given name

adm.saveAudio(int track,'fileName')

Save track 'track' as 'fileName'. If an audio codec has been selected for that track, it will used when saving.

adm.audioAddExternal('fileName')

Add fileName to the audioTrack pool. It will take the next number. That track is in the pool of available tracks, not in the active track. Use audioAddTrack() to add it.

adm.setContainer(container, params)

Set the output container with params as parameters (optionnal). Example :

adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280")

Getting Video info about loaded file(s)

adm.getWidth()

Return the width of loaded videos

adm.getHeight()

Return the height of loaded videos

adm.getFps1000()

Return average frame par second multiplied by 1000 So a 25 fps video will return 25000

adm.getVideoCodec()

Return the video codec as a string, for example 'DX50'

Getting Audio info about loaded file(s)

adm.audioTracksCount()

Return the number of active tracks. That include tracks from the video and added external tracks.

adm.audioEncoding(int track)

Return the audio encoding, as an integer for track track. Common value are 85 for MP3 and 0x2000 for AC3.

adm.audioFrequency(int track)

Return the sampling rate of track track. For example 48000 for a 48 Khz track

adm.audioChannels(int track)

Return the sampling rate of track track. For example 48000 for a 48 Khz track

Editing

adm.clearSegments()

Purge previously loaded editing

adm.addSegments(ref,start,duration)

Add a chunk of video from video ref, starting at 'start' micro seconds and for a 'duration' duration. For example :

 adm.addSegment(0, 0, 191668)

Means add the chunk from video 0(the first video) starting from the beginning with a duration of 191 seconds (3mn11) If you dont call clearSegments or addSegments, by default, when adding a video a segment of the whole video is automatically appended.

adm.markerA and adm.markerB

Set/get the marker position. They are in microseconds

Video Codec

adm.setVideoCodec(codecName, params)

Select codec codecName and set params as params. For example

adm.videoCodec("ffMpeg4", "params=2PASSBITRATE=500", "lavcSettings=:version=2:")

Params are a list of key/value pairs. The params will be checked and must be complete, i.e. include ALL parameters.

adm.changeVideoParam:videoCodecChangeParam(codecName, params)

Change only one or several parameters for codecName. For example, you set all parameters using setVideoCodec and afterward only change bitrate

Video Filters

adm.clearVideoFilters()

Delete the filter chain. All filters are removed.

adm.addVideoFilter(filter, couples)

Add the video filter named filter with couples as parameters. These parameters are key/value pair. Example :

adm.addVideoFilter("swscale", "width=640", "height=352", "algo=2", "sourceAR=2", "targetAR=0")

The list of parameters must be complete, it will be rejected otherwise.

Audio Filters

adm.audioResetFilter(int track)

Remove all the filters on track 'track'.

adm.audioSetMiset(track,mixer)

Remix track “track” with mixer. Mixer can be “MONO”,“STEREO”,“3F_2R_LFE” (for 5.1), “DOLBY_PROLOGIC” and “DOLBY_PROLOGIC2”.

adm.audioSetResample(track,frequency)

Resample track “track” to frequency “frequency”. Setting frequency to 0 disables resampling.

adm.audioSetPal2Film(track,onoff)

Enable or disable pal2film audio filter on track “track”.

adm.audioSetFilm2Pal(track,onoff)

Enable or disable film2pal audio filter on track “track”.

adm.audioSetNormalize(track,mode,gain)

Enable or disable normalize audio filter on track “track”. Mode is 0 for none, 1 for automatic and 2 for manual. The gain is 10* the real gain in db. i.e set 30 to get a +3 dB boost

Example

Here is the typical beginning of an avidemux tinyPy project

 adm = Avidemux()
 adm.loadVideo("/work/samples/avi/ac3_5channel.avi")
 adm.clearSegments()
 adm.addSegment(0, 0, 33400000)
 adm.markerA = 0
 adm.markerB = 33400000
tinypy/avidemux.1367050106.txt.gz · Last modified: 2013/04/27 10:08 by fx