Skip to content

Instantly share code, notes, and snippets.

@nikanos
Created October 7, 2018 19:48
Show Gist options
  • Save nikanos/821ff3887af8c9db8e013bdd8cf8a655 to your computer and use it in GitHub Desktop.
Save nikanos/821ff3887af8c9db8e013bdd8cf8a655 to your computer and use it in GitHub Desktop.
Avidemux script - merge mp4 files in a folder
#Avidemux script (works with Avidemux v 2.7.1)
#Merges all the mp4 files of a folder to a "_merged.mkv" file in the same folder
ext="mp4"
inputFolder=""
currentItemIndex=0
#
def loadOrAppend(filein):
if(currentItemIndex==1):
adm.loadVideo(filein)
else:
adm.appendVideo(filein)
#
# Main
#
ui=Gui()
adm=Avidemux()
#
inputFolder=ui.dirSelect("Select the source folder")
if not inputFolder:
raise ValueError("no folder selected")
list=get_folder_content(inputFolder,ext)
if(list is None):
raise ValueError("Could not find files")
for f in list:
currentItemIndex=currentItemIndex+1
loadOrAppend(f)
adm.setSourceTrackLanguage(0,"eng")
adm.save(inputFolder + "\\" + "_merged.mkv")
print("Done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment