News:

--

Main Menu

batch trimming

Started by myamata, April 17, 2023, 06:36:03 AM

Previous topic - Next topic

myamata

I have some kid cartoons I would like to trim at the beginning and end.
I did some research to do some batch script, found:
https://avidemux.org/smif/index.php?topic=10280.0
https://www.gaelanlloyd.com/blog/batch-processing-video-files-with-avidemux/
https://www.avidemux.org/admWiki/doku.php?id=tutorial:batch_processing

but I failed every time, now everything is mixed!

from Avidemux/projet script/save ; I got this
#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
if not adm.loadVideo("D:/video/dessinanime/S01/anime.mp4"):
    raise("Cannot load D:/video/dessinanime/S01/anime.mp4")
adm.clearSegments()
adm.addSegment(0, 83416, 1464671584)
adm.markerA = 9926583
adm.markerB = 1338712375
adm.setHDRConfig(1, 1, 1, 1, 0)
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"fra")
if adm.audioTotalTracksCount() <= 0:
    raise("Cannot add audio track 0, total tracks: " + str(adm.audioTotalTracksCount()))
adm.audioAddTrack(0)
adm.audioCodec(0, "copy")
adm.audioSetDrc2(0, 0, 1, 0.001, 0.2, 1, 2, -12)
adm.audioSetEq(0, 0, 0, 0, 0, 880, 5000)
adm.audioSetChannelGains(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelDelays(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelRemap(0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8)
adm.audioSetShift(0, 0, 0)
adm.setContainer("MKV", "forceAspectRatio=False", "displayWidth=1280", "displayAspectRatio=2", "addColourInfo=False", "colMatrixCoeff=2", "colRange=0", "colTransfer=2", "colPrimaries=2")

first line should be : set avidemux="C:\Program Files\Avidemux 2.8 VC++ 64bits\avidemux.exe"

then I'm completly lost.

all files in the folder were recorded with the same codec, same size (1920x1080)



eumagga0x2a

Avidemux project script is a subset of Python (tinyPy), interpreted by an internal script engine in Avidemux. A batch script is (if you use Windows) a set of commands interpreted by cmd.exe in Windows. You can launch avidemux.exe (or avidemux_cli.exe, if you don't need OpenGL filters or hardware decoders) from cmd.exe using a batch script and pass the location of the Avidemux project script to avidemux(_cli).exe as the argument for the --run option like your second link states.

jimmyjim

yo, i do this kind of stuff alot but I use powershell + ffmpeg because I don't know any python or much about video files.
I can help if you're still working on this.