News:

--

Main Menu

windows v2.7.5 tinypy - muxer cannot open

Started by leedog99, October 16, 2019, 10:14:37 AM

Previous topic - Next topic

leedog99

When I run a PY script to convert an MVK to MP4, it opens the local MKV file fine, but then get MUXER CANNOT OPEN error. Clicking SAVE works fine.
I have attached my log and script. Im guessing something to do with the error, "...Video has extradata and muxer requires globalHeader, assuming it is done so."
WIN 10 Home

eumagga0x2a

Quote from: leedog99 on October 16, 2019, 10:14:37 AM
Im guessing something to do with the error, "...Video has extradata and muxer requires globalHeader, assuming it is done so."

This is not an error but a general purely informational message, completely unrelated to the problem.

Your script tries to save output to the source file, which obviously can't work. On a non-Windows platform, this would destroy the source file, but file locking on Windows prevents dataloss and the fatal flaw in the script results just in a failure due to inability to write to the specified output (which is here identical with the input).

leedog99

I had this before for the save line:
adm.save(filename)
same MUXER CANNOT OPEN error.

eumagga0x2a

adm.save(filename) would have been wrong too as the basename of $filein needs a directory for save() to succeed, a directory different from $dir (I denote variables here with "$" like in bash scripts for legibility).

It should work with


#PY  <- Needed to identify #

ext = "mkv"
gui = Gui()
adm = Avidemux()

def convert(filein):
    if (0 == adm.loadVideo(filein)):
        gui.displayerror("oops, cannot load " + filein)
        raise
    adm.videoCodec("Copy")
    adm.audioClearTracks()
    adm.setSourceTrackLanguage(0,"eng")
    adm.audioAddTrack(0)
    adm.audioCodec(0, "copy");
    adm.audioSetDrc(0, 0)
    adm.audioSetShift(0, 0, 0)
    adm.setContainer("MP4", "muxerType=0", "optimize=1", "forceAspectRatio=False", "aspectRatio=1", "rotation=0")
    adm.save(filein + ".mp4")
    print("Done")

# Main
InputFolder = gui.dirSelect("Select the Source Folder")
list = get_folder_content(InputFolder,ext)
if(list is None):
    raise
for i in list:
    convert(i)
print("Done")


but, of course, the double extension "mkv.mp4" is not pretty and should be treated as well.

leedog99

I have searched for hours, no luck. Any suggestion on how to remove the .MKV from the file name so the saved name is clean?

eumagga0x2a

You should browse posts by the user "dosdan" here.

A brief internet search points to https://superuser.com/questions/1120795/how-to-batch-remove-a-duplicate-file-extension-in-os as a possible solution.