News:

--

Main Menu

Batch Script but need to change save location

Started by cxxm00, Today at 04:17:25 PM

Previous topic - Next topic

cxxm00

Working script, but I need to change the output location to a different folder other than the input folder (c:\tmp).

Since it will be saved to a different folder, I want to use the same filename that is being loaded (like in this one), but without the ".edit.mp4"


ext="mp4"
inputFolder="c:\\tmp\\"
#
def convert(filein):
    if(0 == adm.loadVideo(filein)):
        ui.displayError("oops","cannot load "+filein)
        raise
    adm.videoCodec("Copy")
    adm.audioClearTracks()
    adm.setSourceTrackLanguage(0,"und")
    if adm.audioTotalTracksCount() <= 0:
            raise("Cannot add audio track 0, total tracks: " + str(adm.audioTotalTracksCount()))
    adm.audioAddTrack(0)
    adm.audioCodec(0, "Lame")
    adm.audioSetDrc(0, 1)
    adm.audioSetShift(0, 0, 0)
    adm.audioSetNormalize2(0, 2, 150, -30)
    adm.setContainer("MP4", "muxerType=0", "optimize=1", "forceAspectRatio=False", "aspectRatio=1", "displayWidth=1280", "rotation=0", "clockfreq=0")
    adm.save(filein+".edit.mp4")

    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")