mlt_position position = mlt_filter_get_position( filter, frame );
mlt_position length = mlt_filter_get_length2( filter, frame );
double opacity = mlt_properties_anim_get_double( properties, "opacity", position, length );
+ double alpha = mlt_properties_anim_get_double( properties, "alpha", position, length );
mlt_properties_set_double( properties, "movit.parms.vec4.factor[0]", opacity );
mlt_properties_set_double( properties, "movit.parms.vec4.factor[1]", opacity );
mlt_properties_set_double( properties, "movit.parms.vec4.factor[2]", opacity );
- mlt_properties_set_double( properties, "movit.parms.vec4.factor[3]", opacity );
+ mlt_properties_set_double( properties, "movit.parms.vec4.factor[3]", alpha >= 0 ? alpha : opacity );
GlslManager::get_instance()->unlock_service( frame );
*format = mlt_image_glsl;
int error = mlt_frame_get_image( frame, image, format, width, height, writable );
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
glsl->add_ref( properties );
mlt_properties_set( properties, "opacity", arg? arg : "1" );
+ mlt_properties_set_double( properties, "alpha", -1.0 );
filter->process = process;
}
return filter;
the other video. If the video this is applied to already has an alpha channel,
then this preserves that by multiplying the opacity level with the alpha channel.
This filter is especially handy when used in conjunction with movit.overlay.
+ You can also use this to fade a clip from and to black.
parameters:
- identifier: opacity
maximum: 1
default: 1
mutable: yes
+
+ - identifier: alpha
+ title: Alpha
+ description: >
+ When this is less than zero, the alpha component of the Movit mutliply
+ effect follows opacity. Otherwise, you can set this to another value to
+ control the alpha component independently. If you set this to 1, then
+ the opacity parameter can be used to fade to and from black.
+ type: float
+ minimum: -1
+ maximum: 1
+ default: -1
+ mutable: yes