Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: nastyphoenix on December 20, 2021, 02:19:58 PM

Title: Scripting a FadeToBlack Filters
Post by: nastyphoenix on December 20, 2021, 02:19:58 PM
Avidemux 2.7.8 with OS Linux Mint 20.04 or/and 20.2
Hello
Everything is in the subject  :)

I have made a small bash in Linux that loads a sequence of AVI files ; the user choose the first and the last video with a "read -p".
My "sequence" is loaded in Avidemux.
I know how to save the file with a .py script or with the CLI but i want to add a Fade To Black filters (and maybe a greyscale).
No matter if the FadeToBlack is added by a .py script or by an Avidemux CLI.

Is it possible ?

Regards

sorry for my poor english i'm french.
Title: Re: Scripting a FadeToBlack Filters
Post by: eumagga0x2a on December 20, 2021, 03:53:04 PM
adm = Avidemux()
ed = Editor()

if not ed.nbSegments():
    return

effectDuration = 3 * 1000 # in ms
videoDuration = ed.getVideoDuration() / 1000 # microseconds --> milliseconds
effectStart = videoDuration
if videoDuration <= effectDuration * 2:
    effectDuration = videoDuration / 2

effectStart -= effectDuration

adm.addVideoFilter("fadeToBlack", "startFade=0", "endFade=" + str(effectDuration), "inOut=True", "toBlack=True")
adm.addVideoFilter("fadeToBlack", "startFade=" + str(effectStart), "endFade=" + str(videoDuration), "inOut=False", "toBlack=True")

adds fade-in and fade-out of max 3 seconds duration to the currently loaded video. The script presumes a current Avidemux 2.8.0 (a nightly so far). It may work with 2.7.8 (untested).

Quote from: nastyphoenix on December 20, 2021, 02:19:58 PMsorry for my poor english i'm french.

https://avidemux.org/smif/index.php/board,2.0.html :-)
Title: Re: Scripting a FadeToBlack Filters
Post by: nastyphoenix on December 20, 2021, 04:54:34 PM
Hi
A very complete answer.
Thanks a lot I will test it as soon as possible.
Title: Re: Scripting a FadeToBlack Filters
Post by: nastyphoenix on December 20, 2021, 05:12:48 PM
It works like a charm.  ;)
You are an Hero.  8)

May I do something else to close this topic ?

THANKS AGAIN
Title: Re: Scripting a FadeToBlack Filters
Post by: eumagga0x2a on December 20, 2021, 08:12:38 PM
Glad that it worked, no need to close the topic.