Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: TheTooleMan on July 16, 2022, 08:26:09 PM

Title: Batch Save Audio Only
Post by: TheTooleMan on July 16, 2022, 08:26:09 PM
I would like to rip the audio from DVD's using a batch process. I'm quite dependent on saving project scripts and reviewing the tinypy code to understand what Avidemux is doing under the hood. Saving audio is not one of the things that is available for saving as a project. Any examples and starting points will be greatly appreciated!

(Not sure this is the best place for a scripting question, but my first try, the Documentation and Tips forum, is definitely the wrong place.)
Title: Re: Batch Save Audio Only
Post by: eumagga0x2a on July 17, 2022, 07:45:49 AM
The method is

adm.saveAudio(0, "path/to/outfile.ext")
where adm is presumed to have been set to Avidemux(). The first argument which should be the index number of the audio track is actually ignored and the first active audio track is used (the one which is played back when previewing video in Avidemux). The only true complication is to identify the correct track if there are multiple audio tracks, which must be set as the first one by clearing audio tracks and adding a single one with adm.audioAddTrack(int trackIndex) and to choose extension based either on the return value of adm.audioEncoding(int trackIndex) when in copy mode or on the selected audio encoder.
Title: Re: Batch Save Audio Only
Post by: TheTooleMan on July 18, 2022, 01:25:48 PM
Thanks for the reply! I will test soon and return with results.