January 20, 2021, 07:23:44 PM

News:

--


Batch converting - Help please :(

Started by anonanimeguy, March 03, 2016, 09:04:52 PM

Previous topic - Next topic

anonanimeguy

Mods, please relocate if wrong subforum.

Hi guys,

Using Windows 10 and the latest version of Avidemux, I'm trying to convert multiple files from *.mkv to *.mp4 using Mpeg4 AVC (x264) as the video output, copying the original audio output, and with MP4 muxer as the output format.

I'm having difficult putting this all in a *.bat script and getting it to work correctly. Currently I have the following:

set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
set videocodec=Mpeg4 AVC (x264)
set audiocodec=Copy
for %%f in (*.mkv) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load "%%f" --save "%%f.mp4" --quit

It will run but the final converted file(s) is not what I wanted. Can someone help me correct the script?

Thank you!  ;D

Jan Gruuthuse

For all simullar videos. Load one video, make all your required settings in avidemux Graphical User Interface. From avidemux menu GUI: File -> Tinypy Project -> Save As Project (name example: myconversion)

edit myconversion.py and remove references to loaded video and segments:
- delete lines similar to this ones:
Quoteadm.loadVideo("/media/jan/Werk/0xp1000/20160210 1815 - SBS6 HD - MasterChef USA.ts")
adm.clearSegments()
adm.addSegment(0, 0, 5400580000)
adm.markerA = 0
adm.markerB = 5400580000
save project file and call the project file from batch: --run myconversion.py

set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
set videocodec=Mpeg4 AVC (x264)
set audiocodec=Copy
for %%f in (*.mkv) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load "%%f" --run myconversion.py  --save "%%f.mp4" --quit


see if that works

anonanimeguy

It worked, thank you SO very much! I wouldn't have been able to figure all that out on my own! ;D

anonanimeguy

March 04, 2016, 10:32:27 PM #3 Last Edit: March 04, 2016, 10:34:10 PM by anonanimeguy
Another question if you don't mind. Does not using the GUI speed up the conversions? If so, how do I incorporate that into the batch?

Also, is there a way to default each new conversion to being "High" priority?

Jan Gruuthuse

You could try, I've not tested/used for a long time.
QuoteYou can use ââ,¬â€œnogui option in case you want to suppress all dialogs (it must be first option!)

No guarantee this will work. Could be some features are not passed on to avidemux(3)_cli. I doubt if the 3 is there in windows.

QuoteYou can replace avidemux(3) with avidemux(3)_cli if you want to process files without GUI
source: tips

mean

On windows it does not matter much
BTW you can process all the files in a folder using the internal tinypy bindings, there's a sample here
https://github.com/mean00/avidemux2/blob/master/autononreg/py/sample_script/remux_ts_2_ps.py

LordSith77

Quote from: Jan Gruuthuse on March 04, 2016, 02:07:46 PMFor all simullar videos. Load one video, make all your required settings in avidemux Graphical User Interface. From avidemux menu GUI: File -> Tinypy Project -> Save As Project (name example: myconversion)

edit myconversion.py and remove references to loaded video and segments:
- delete lines similar to this ones:
Quote from: undefined[tt]adm.loadVideo("/media/jan/Werk/0xp1000/20160210 1815 - SBS6 HD - MasterChef USA.ts")
adm.clearSegments()
adm.addSegment(0, 0, 5400580000)
adm.markerA = 0
adm.markerB = 5400580000[/tt]
save project file and call the project file from batch: --run myconversion.py

set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
set videocodec=Mpeg4 AVC (x264)
set audiocodec=Copy
for %%f in (*.mkv) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load "%%f" --run myconversion.py  --save "%%f.mp4" --quit

see if that works

I wanted to add to this. I used your script, and it works perfectly. However, each new file was named title.mkv.mp4. So I did a little research, and found the ~nf feature, and tested it out. Then added a new line as well, to delete all the original mkv files. So my script now looks like this:

set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=Mpeg4 AVC (x264)
set audiocodec=Copy
for %%f in (*.mkv) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load "%%f" --run myconversion.py  --save "%%~nf.mp4" --quit

del *.mkv