Created
April 23, 2022 22:14
-
-
Save davidruhmann/b0c0bec98bd1b63944a1f6cf294f4ca1 to your computer and use it in GitHub Desktop.
avidemux script - trim first and last keyframes for MP4 (see docs to use MKV container if needed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set "avidemux=C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe" | |
: %%~nf returns the filename without the extension | |
for /F "tokens=*" %%f in ('dir /a-d /b *.mp4') do ( | |
"%avidemux%" --load "%%f" --run trim.py --save "%%~nf_edit.mp4" --quit | |
) | |
exit /b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#PY <- Needed to identify # | |
#--automatically built-- | |
adm = Avidemux() | |
ed = Editor() | |
adm.markerA = ed.getNextKFramePts(-1) | |
adm.videoCodec("Copy") | |
adm.audioClearTracks() | |
adm.setSourceTrackLanguage(0,"eng") | |
if adm.audioTotalTracksCount() <= 0: | |
raise("Cannot add audio track 0, total tracks: " + str(adm.audioTotalTracksCount())) | |
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", "displayWidth=1280", "rotation=0", "clockfreq=0") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment