Log in

View Full Version : Batch extracting audio with AVIDemux


Gauze
9th May 2008, 01:47
I have several AVI's that are encoded with DivX (fourcc: DX50) video and MP3 audio that I want to batch convert to a format my phone can handle (MPEG4-SP video, AAC audio, mp4 container). I'm trying to use AVIDemux since it can handle .mp4 outputs. However, I'm having a few problems.

When viewing any of this videos in AVIDemux 2.4.1, the movements are extremely choppy and any outputted video has the same problem. However, if I use avisynth script, the video looks fine. However, when using avisynth script with AVIDemux, I can never get an output file with any audio. Also, the first frame is always a copy of a different frame (usually the last frame I viewed or a dark green frame) instead being a black frame.

Now I pretty sure I can't batch AVIDemux to load avisynth scripts and output them (though I would love to be told otherwise), but I did try to write a few batch files to automate some of the process.

Since for some reason I never had audio, I tried to write a batch file that would copy the audio stream from the AVIs into seperate files using the general syntax:

avidemux_cli.exe --load input.avi --save-raw-audio outputfilename

Out of the 20 or so videos I had, the script I wrote worked for 3 of them...not a really high success rate.

Am I writing the syntax wrong or are there other commands to improve my success rate?

LoRd_MuldeR
9th May 2008, 04:00
Avidemux (or AVSProxy to be precise) doesn't support audio input from Avisynth yet...

Gauze
9th May 2008, 15:31
Yeah, so I was trying to extract the audio from the original avi's directly first.

Then use avisynth to play th video properly in AVIDemux and then finally add on the audio with the fixed video in AVIDemux.

But I can't for the life of me figure why the command I wrote would only extract the mp3 audio stream from 3 of the 20 files I have.

Edit: Well now I'm confused...

When I removed the videos that did have the audio extracted by the script and run the batch file again, some of the videos that didn't have their audio extracted before did this time...I guess I could just keep removing the successful videos from the folder until all of them successfully process...

That or the problem is in my batch file:

for %%f in (*.avi) do f:
videmux_2.4.1_win32
videmux2_cli.exe --load %%f --save-raw-audio %%f.audiEXT >%%f.txt

Is that the problem?

Edit2:

Well comparing the two log files, the only difference was that in the log of the success attempt:

** conf updated **
save-raw-audio-->1
Duration:309576.000000 ms

OVR: 66351142 rel:0 lentogo:0 blocklen 824Grabbed :4176
**PKTZ:READ ERROR
**END OF AUDIO STREAM
EditorPacket:Read failed; retrying (were at seg 0sample 9900288
/ 9906439)
EditorPacket : End of *last* stream

wanted 9906432 samples, goto 0 samples, written 9900288 bytes


In the attempts that failed:

** conf updated **
save-raw-audio-->1
Duration:309576.000000 ms

wanted 9906432 samples, goto 0 samples, written 1152 bytes


Don't know if that helps or anything.

pc_speak
9th May 2008, 23:34
Hi Gauze

I do this.
FOR /F "delims==" %%W in ('dir *.avi /b') do "C:\VidAud\Besweet\BeSweet.exe" -core( -input "%%~nW.avi" -output "%%~nW.mp3" ) -lame( -b 192 )


And explain the delims bit here (http://www.users.on.net/~pcspeak/explain.html)

Hope it helps.
Maybe a small adaptation to use AVIDemux (or use Besweet. :))

foxyshadis
10th May 2008, 11:48
You might also look into using the javascript internally in avidemux to do the opening & extracting, saving you the hassle of working with flaky command lines. (But engendering the hassle of figuring out how to write the script.)

Gauze
11th May 2008, 02:17
So...apparently if I run in batch file in a folder named "Reprocess" it doesn't work...but in a folder named "Process" it does...

I'll try the delim thing next time... ><

Hopefully, I won't be driven insane like this time.