November 26, 2020, 07:24:17 am

News:

--


Script mkv/ac3 to acc/mp4

Started by Monkeyk, April 14, 2012, 11:33:12 am

Previous topic - Next topic

Monkeyk

I love Avidemux but iam having one problem.
I trief alot of scripts  (bat) but i cant seem to get it to work.

Input: MKV AC3 5.1
Output: MP4 ACC stereo.

I want to copy the video part but re-encode the sound to mp3 or ACC stereo.
I can convert the video files with mp3 but cant get it to stereo.

Do any of u guys know how to script this (.bat)



Monkeyk

Thanks,

I tried making a script with those links but as a nOOb i cant seem to get it right :(

Jan Gruuthuse

You do have a batch file processing the video files converting to mp3?
the section: "Combination of command-line and JS scripting"
QuoteYou can create scripts quite easily by yourself. You can apply needed settings via GUI and then use File → Save Project Asââ,¬Â¦ to create text file that contains all settings. Then you can open that file in text editor and copy+paste needed stuff to new script (or replaces parts of other script).

Load same kind of video you want to convert in batch in avidemux
Set all parameters in Video, Audio and Output Format that you need for successful conversion and save the project something.js as described above. Edit that something.js
Remove lines where video is loaded and the markers are set.
You should have something similar as in the example.

This batch file uses the project you edited above.
set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe"
for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run something.js --save "%%f.avi" --quit

replace bolded (*.mp4) by the video container you're processing.
replace bolded  --save "%%f.avi" by video container you want to save.

What works, what not, what happens ...

Monkeyk

April 15, 2012, 06:16:23 pm #4 Last Edit: April 15, 2012, 06:18:18 pm by Monkeyk
Hey jan thanks for the reply.

This is what i got, ive done this the way u told me (save as .js)
The strange thing is it doesnt show audio settings (i selected mp3 + stereo as filter)
It wil start converting but gives an error that the movie has more audio channels.
Ive i do the samething manually it works perfect but through the batch/js it doesnt....


//AD  <- Needed to identify//
//--automatically built--
//--Project: C:\Users\xbmc\Desktop\test.js

var app = new Avidemux();

//** Video **
// 01 videos source
app.load("C:/Users/xbmc/Desktop/Test-AC3.mkv");
//01 segments
app.clearSegments();
app.addSegment(0,0,28832);
app.markerA=0;
app.markerB=28831;

//** Postproc **
app.video.setPostProc(3,3,0);

app.video.fps1000 = 23976;

//** Filters **

//** Video Codec conf **

Jan Gruuthuse

Before you save a project you need to set
in Audio: MP3(lame) and now in Filters: Window: Audio Filters: Mixer: Stereo
in Format: the wanted container format: MKV
//AD  <- Needed to identify//
//--automatically built--
//--Project: C:\Users\xbmc\Desktop\test.js

var app = new Avidemux();

//** Video **
// 01 videos source
app.load("C:/Users/xbmc/Desktop/Test-AC3.mkv");
//01 segments
app.clearSegments();
app.addSegment(0,0,4997);
app.markerA=0;
app.markerB=4996;

//** Postproc **
app.video.setPostProc(3,3,0);

app.video.fps1000 = 23976;

//** Filters **

//** Video Codec conf **
app.video.codec("Copy", "CQ=0", "0 ");

//** Audio **
app.audio.reset();
app.audio.codec("Lame",128,20,"80 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00 ");
app.audio.normalizeMode=0;
app.audio.normalizeValue=0;
app.audio.delay=0;
app.audio.mixer="STEREO";
app.audio.scanVbr();
app.setContainer("MATROSKA");
setSuccess(1);
//app.Exit();

//End of script


Remove these:
app.load("C:/Users/xbmc/Desktop/Test-AC3.mkv");
app.addSegment(0,0,28832);
app.markerA=0;
app.markerB=28831;


Monkeyk

April 16, 2012, 08:12:52 am #6 Last Edit: April 16, 2012, 08:18:34 am by Monkeyk
Jan,

I made a script that works but when i play it the speed (frame rate) isnt correct.
Its playing really fast instead of the normal speed.
If i delete the segment part and leave the "app.clearSegments();" it doesnt do anything.
so i deleted that part and it will convert but with the speed problem

The strange thing is if i set all the audio options in avidemux and save the project as a JS file nothing of the audio filters i set is there...

//AD  <- Needed to identify//
//--automatically built--
//--Project: C:\Users\xbmc\Desktop\test.js

var app = new Avidemux();

//** Video **
// 01 videos source

//01 segments


//** Postproc **
app.video.setPostProc(3,3,0);
app.video.fps1000 = 23976;


//** Filters **
//** Video Codec conf **
app.video.codec("Copy", "CQ=0", "0 ");


//** Audio **
app.audio.reset();
app.audio.codec("Lame",128,20,"80 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00 ");
app.audio.normalizeMode=0;
app.audio.normalizeValue=0;
app.audio.delay=0;
app.audio.mixer="STEREO";
app.audio.scanVbr();
app.setContainer("MATROSKA");
setSuccess(1);
//app.Exit();
//End of script

Jan Gruuthuse

Quote from: Monkeyk on April 16, 2012, 08:12:52 am
If i delete the segment part and leave the "app.clearSegments();" it doesnt do anything.
so i deleted that part and it will convert but with the speed problem

no the "app.clearSegments();" should stay there.

What version of avidemux are you running? 2.54, 2.55 or 2.5.6?
The source video's you use, different sources? Do these have have different frame rates? "app.video.fps1000 = 23976"; could be causing this to?  Don't know if removing this would help?

Monkeyk

iam running 2.5.6 all files have different frame rates but the files iam testing with is the same as the one i made the js for!

Jan Gruuthuse

April 17, 2012, 07:17:49 am #9 Last Edit: April 17, 2012, 08:35:00 am by Jan Gruuthuse
Try with 2.6 experimental, since yesterday it has the possibilities to re-encode the existing audiotrack from ac3 5.1 to stereo. Don't know yet if this works from script. See 1st if this works and produces the result you want in the GUI. If that works proceed with batch and save the job. It is somewhat different in operation but it should show itself.
This batch line:
set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe"should be adapted to the new path where 2.6 is installed and the executable is "avidemux3.exe" or somewhat in that nature.
You can find 2.6 Beta Builds  http://avidemux.razorbyte.com.au/ or http://avidemux.org/nightly/
If running on 64-bit windows and you have problems running avidemux try with 32-bit version, some users reported this to solve some issues

Monkeyk

Hey Jan, the 2.6 works and saves the script like it should be.
The only problem iam having is the frame rate which isnt correct....

Iam beginning to think i want something what isnt realistic :(

Jan Gruuthuse

Can you try running mkvclean on a mkv before you process the file with avidemux?
http://www.matroska.org/downloads/mkclean.html
If that did not help, upload a 5 second clip (20MB max) somewhere and provide a link to it. Perhaps someone will have a look at it and tell what the problem could be?