News:

--

Main Menu

CLI scripting with external wav

Started by Almeida, March 13, 2013, 07:54:22 PM

Previous topic - Next topic

Almeida

Hi everybody!

First: I'm using Avidemux 2.5.6.
I'm trying to use the Avidemux CLI to convert some videos to MP4 in my C# application. But somehow I can't figure out how to do it correctly. I never have sound...

My code looks like this:

string newScript = " --video-codec %videocodec% --video-conf %videobitrate% --audio-process --external-wav %pathToAudio%  --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --force-alt-h264 --load %pathToVideo% --save %outputFile% --quit";

string videocodec   = "x264";
string videobitrate = "2PASSBITRATE=400";
string audiocodec = "Faac";
string audiobitrate = "96";
string outputformat = "MP4";

// edit the template
newScript= a_script.Replace( "%videocodec%",    videocodec      );
newScript= a_script.Replace( "%videobitrate%",  videobitrate    );
newScript= a_script.Replace( "%audiocodec%",    audiocodec      );
newScript= a_script.Replace( "%audiobitrate%",  audiobitrate    );
newScript= a_script.Replace( "%outputformat%",  outputformat    );
newScript= a_script.Replace( "%pathToVideo%, pathToVideo );
newScript= a_script.Replace( "%pathToAudio%, pathToAudio );
newScript= a_script.Replace( "%outputFile%,  outputFile );

Process processToStart = new Process( );
processToStart.StartInfo.FileName  = Properties.Settings.Default.PathToAvidemuxCLI;
processToStart.StartInfo.Arguments = newScript;
processToStart.Start( );



so my call to the Avidemux exe looks like this:

avidemux --video-codec %videocodec% --video-conf %videobitrate% --audio-process --external-wav %pathToAudio%  --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --force-alt-h264 --load %pathToVideo% --save %outputFile% --quit";


It converts the video like I want it to but it always misses the sound.
What am I doing wrong? Do I have to use external-wav differently?

Any help is much appreciated!

Jan Gruuthuse

#1
Use same exe that calls/starts the GUI. You should be able to follow the process. When everything runs fine you could then:
QuoteYou can use ââ,¬â€œnogui option in case you want to suppress all dialogs (it must be first option!)
Off load some instructions from command line by using a save project (tinypy project seems to work best doing this). --run something.py
2.6 example and how to

Almeida

Hey, sorry for the late answer but I had some stuff to deal with.
Anyway thanks for your reply.

Ok, now I'm using the same exe that calls the GUI.

When I'm following your way with calling a script I have the error that I don't have the right segments count. My video will only be a few minutes long.
Can you tell me how to get the right app.addSegment call? I don't know how to get the correct length when I don't know how long the video runs.

I also kept playing with my way and I found out that I have to call the --load function before I can call --external-wav. So now I get an encoded video muxed with my wav audio. But I can't get the audio encoded to AAC.

My call looks like this
avidemux --video-codec %videocodec% --video-conf %videobitrate% --force-alt-h264 --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --load %VideoFileToLoad% --external-wav %AudioFileToLoad% --save %OutputFile% --quit

where do I have to put --audio-codec and --audio-bitrate to get my external wav converted to AAC?

Thanks again for your help.

Jan Gruuthuse

In the Tinypy settings you did edit out these similar lines:
adm.loadVideo("/media/1Processed/Demo/fraps.avi")
adm.clearSegments()
adm.addSegment(0, 0, 12049598)
adm.markerA = 0
adm.markerB = 12049598

This should leave out any set video length or set markers [a ][ b]
And you did load in main menu: audio: the wav file at the track you required before saving tinypy project file?
Don't call command line avidemux version, call avidemux GUI. Some functions are not pickeup by CLI version.
Sorry I'm not that big use in scripting.