Author Topic: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script  (Read 849 times)

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #15 on: March 25, 2018, 02:19:27 PM »
ok one min

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #16 on: March 25, 2018, 02:24:39 PM »
There you go

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1830
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #17 on: March 25, 2018, 02:34:09 PM »
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

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #18 on: March 25, 2018, 02:38:39 PM »
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

  • Hero Member
  • *****
  • Posts: 1830
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #19 on: March 25, 2018, 02:46:14 PM »
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

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #20 on: March 25, 2018, 02:53:36 PM »
Not sure how to do that, I see no out --run and --save commands in the script

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1830
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #21 on: March 25, 2018, 02:56:38 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

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #22 on: March 25, 2018, 03:03:23 PM »
The program runs and then disappears and nothing has been done

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #23 on: March 25, 2018, 03:08:10 PM »
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

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #24 on: March 25, 2018, 03:12:17 PM »
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

  • Hero Member
  • *****
  • Posts: 1830
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #25 on: March 25, 2018, 03:14:30 PM »
The program runs and then disappears and nothing has been done

I need admlog.txt from that run.

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #26 on: March 25, 2018, 03:18:28 PM »
The program runs and then disappears and nothing has been done

I need admlog.txt from that run.


eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1830
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #27 on: March 25, 2018, 03:37:03 PM »
Thanks, it is not from the run with the --load option alone, but it includes useful information. Will look into it.

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #28 on: March 25, 2018, 03:39:50 PM »
Thank you

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1830
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #29 on: March 25, 2018, 04:23:58 PM »
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)
« Last Edit: March 25, 2018, 04:32:24 PM by eumagga0x2a »