Newbie : How to Copy Video & Audio folder from MKV to MP4 Script

Started by jonwren, March 24, 2018, 02:09:01 PM

Previous topic - Next topic


eumagga0x2a

Thanks, the log shows that Avidemux crashed because no video had been loaded. The command line doesn't mention a --load option, subsequent call of --run for your project script  leads as expected to a crash.

jonwren

ok what am I doing wrong?
There are 3 MKV Videos inside the folder

Here are my Bat file Settings

set avidemux="C:\Program Files\Avidemux 2.7 - 64 bits\avidemux.exe"
for %%f in (*.mkv) do %avidemux% --load "%%f" --run pui.py --save "%%~nf.mp4" --quit

Here are my Py file Settings

adm = Avidemux()
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True", "forceAspectRatio=False", "aspectRatio=1")

Thanks

eumagga0x2a

I'm not really familiar with Windows cmd.exe scripting. Does loading a file alone work? Leave out --run and --save commands for testing purposes and attach a new admlog.txt, please.

jonwren

Not sure how to do that, I see no out --run and --save commands in the script

eumagga0x2a

Quote from: jonwren on March 25, 2018, 02:38:39 PM

Here are my Bat file Settings

set avidemux="C:\Program Files\Avidemux 2.7 - 64 bits\avidemux.exe"
for %%f in (*.mkv) do %avidemux% --load "%%f" --run pui.py --save "%%~nf.mp4" --quit

Leave the emboldened part of the command line out.

jonwren

The program runs and then disappears and nothing has been done

jonwren

I re-putin the --run pui.py --save "%%~nf.mp4" --quit command
and now am getting this error again

TinyPy: Exception
Exception : (tp_load) cant get filesize
BackTrack: File:py2bc.py,line50

jonwren

This is the py I just tried but same error
TinyPy: Exception
Exception : (tp_load) cant get filesize
BackTrack: File:py2bc.py,line50


#PY  <- Needed to identify #
#--automatically built--
#
# Load all the files in "c:\\tmp\\" with .mkv extension.
# That's it.
#
ext="mkv"
inputFolder="c:\\tmp\\"
#
def convert(filein):
    if(0 == adm.loadVideo("C:\Users\jonwr\Desktop\New folder.mkv"):
        ui.displayError("oops","cannot load "+filein)
        raise
        print("Done")
    # ---------- Inserting project start------------
adm.videoCodec("Copy")
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True", "forceAspectRatio=False", "aspectRatio=1")
# ---------- Inserting project end------------
    adm.save(filein+".converted.mp4") # save the file
    print("Done")

#
# Main
#
ui=Gui()
adm=Avidemux()
#
list=get_folder_content(inputFolder,ext)
if(list is None):
    raise
for i in list:
        convert(i)
print("Done")

eumagga0x2a

Quote from: jonwren on March 25, 2018, 03:03:23 PM
The program runs and then disappears and nothing has been done

I need admlog.txt from that run.


eumagga0x2a

Thanks, it is not from the run with the --load option alone, but it includes useful information. Will look into it.


eumagga0x2a

Could you please try out adding --nogui option before --run but after --load?

(This does not do what one might think. Instead, it prevents dialogs from popping up. The option would not fix the exception but might hide the unpleasant effects)