Avidemux Forum

Avidemux => Windows => Topic started by: datarecovery.com on January 07, 2023, 05:38:14 PM

Title: Need to create a batch file to trim black screen from end of mp4
Post by: datarecovery.com on January 07, 2023, 05:38:14 PM
Hello there,
I am fairly new to automating avimux using a batch file. I am tasked with trimming variable-length black from the end of mp4 videos. This happens when I digitize a video and forget to set the timer properly. The batch would have to instruct avimux to detect a black screen of more than 5 minutes. If that happens, then the video should be trimmed leaving 3 seconds of black. I'm not sure where to start or even if this is possible using Avimux. Any suggestions would be appreciated!
Title: Re: Need to create a batch file to trim black screen from end of mp4
Post by: eumagga0x2a on January 07, 2023, 11:23:20 PM
This is not possible with Avidemux without at least adding a method to seek to black frames to the tinyPy scripting interface. While the latter is trivial (please see the patch tinypy-add-method-to-seek-to-black-frames.txt), further modifications would be needed to make it work in an acceptable manner. The current implementation of ADM_Composer::seekBlackFrame(int count) would open a popup with a progress indicator on each GUI_PrevBlackFrame() or GUI_NextBlackFrame() call.

Implementing the whole logic low-level in gui_blackframes.cpp (https://github.com/mean00/avidemux2/blob/master/avidemux/common/gui_blackframes.cpp) (a global function added there must be declared in gtkgui.h header file) in a custom Avidemux build might be a much better approach.