#PY <- Needed to identify #
#
ui = Gui()
adm = Avidemux()
ed = Editor()
ext = "mp4"
outputs = ["MKV","MP4","MOV"]
sep = "/"
nbsek = 120
#
# Function to process an individual video
#
def convert(filein,outdir,outidx):
if not adm.loadVideo(filein):
ui.displayError("Oops","cannot load "+filein)
return 0
offset = nbsek * 1000 * 1000
if ed.getVideoDuration() < offset:
ui.displayError("Input too short", "Duration is shorter than " + str(int(nbsek)) + " seconds, skipping \"" + filein + "\"")
return 0
adm.markerA = offset
adm.videoCodec("Copy")
nbTracks = adm.audioTracksCount()
if nbTracks > 0:
adm.audioClearTracks()
for track in range(nbTracks):
adm.audioAddTrack(track)
adm.audioCodec(track, "Copy")
filename = (splitext(filein))[0]
if outidx == 0:
adm.setContainer("MKV", "forceAspectRatio=False", "displayWidth=1280", "displayAspectRatio=2", "addColourInfo=False", "colMatrixCoeff=2", "colRange=0", "colTransfer=2", "colPrimaries=2")
filename += ".mkv"
elif outidx == 1:
adm.setContainer("MP4", "muxerType=0", "optimize=1", "forceAspectRatio=False", "aspectRatio=1", "displayWidth=1280", "rotation=0", "clockfreq=0")
filename += ".mp4"
elif outidx == 2:
adm.setContainer("MOV", "muxerType=0", "optimize=1", "forceAspectRatio=False", "aspectRatio=1", "displayWidth=1280", "rotation=0", "clockfreq=0")
filename += ".mov"
else:
ui.displayError("Error", "Invalid output preset index \"" + str(outidx) + "\"")
return 0
filename = basename(filename)
return adm.save(outdir + sep + filename)
#
# Main
#
# -------- select extension, output format and offset --------
extensions = ["avi","m2ts","mkv","mov","mp4","mpg","ts","vob","webm"]
mxExt = len(extensions)
menuExt = DFMenu("Select extension:")
for entry in range(0, mxExt):
menuExt.addItem(extensions[entry])
mxOut = len(outputs)
menuOut = DFMenu("Select output format:")
for entry in range(0, mxOut):
menuOut.addItem(outputs[entry])
dialOffset = DFInteger("Select output start in seconds:", 0, 600)
dialOffset.value = nbsek
dia = DialogFactory("Configuration")
dia.addControl(menuExt)
dia.addControl(menuOut)
dia.addControl(dialOffset)
if not dia.show():
return
idxExt = menuExt.index
if idxExt < 0 or idxExt >= mxExt:
ui.displayError("Oops", "Internal error: invalid menu index")
return
ext = extensions[idxExt]
idxOut = menuOut.index
if idxOut < 0 or idxOut >= mxOut:
ui.displayError("Oops", "Internal error: invalid menu index")
return
nbsek = dialOffset.value
# -------- select input directory --------
inputFolder = ui.dirSelect("Select source folder")
if inputFolder is None:
ui.displayError("Error", "No source folder selected")
return
# -------- read content --------
list = get_folder_content(inputFolder, ext)
if list is None:
ui.displayError("Oops", "No " + ext + " files found in \"" + inputFolder + "\"")
return
# -------- select output directory --------
outputFolder = ui.dirSelect("Select output folder")
if outputFolder is None:
ui.displayError("Error", "No output folder selected")
return
if(inputFolder == outputFolder):
ui.displayError("Error","Output folder cannot be the same as the input one")
return
# -------- process --------
total = 0
counter = 0
for i in list:
total += 1
counter += convert(i, outputFolder, idxOut)
if not counter:
ui.displayInfo("Warning", "No files converted")
return
if counter == 1:
ui.displayInfo("Finished", "One file out of " + str(total) + " converted")
return
ui.displayInfo("Finished", str(counter) + " files out of " + str(total) + " converted")
Quote from: tropolite on May 14, 2025, 10:56:52 AMIs Windows version of Avidemux no longer being updated? I haven't seen any update since Dec '24.
Quote from: upwithav1 on May 25, 2025, 09:10:03 AMI can confirm 250524 nightly completes libaom av1 + resize with no errors
Quote from: upwithav1 on May 25, 2025, 09:10:03 AMintel av1 still not working