make logo scale optional

This commit is contained in:
Jonathan Baecker 2020-05-31 11:47:18 +02:00
parent e3d29c0659
commit e8d1971686
2 changed files with 12 additions and 6 deletions

View File

@ -34,7 +34,9 @@ logging:
pre_compress:
helptext: Settings for the pre-compression. All clips get prepared in that way,
so the input for the final compression is unique. 'aspect' must be a float
number. 'logo' is only used if the path exist. With 'logo_opacity' logo can
number. 'logo' is only used if the path exist. 'logo_scale' scale the logo to
target size, leave it blank when no scaling is needed, format is 'number:number',
for example '100:-1' for proportional scaling. With 'logo_opacity' logo can
become transparent. With 'logo_filter' 'overlay=W-w-12:12' you can modify
the logo position. With 'use_loudnorm' you can activate single pass EBU R128
loudness normalization. 'loud_*' can adjust the loudnorm filter. [Output is
@ -45,7 +47,7 @@ pre_compress:
fps: 25
add_logo: True
logo: "docs/logo.png"
logo_scale: "100:-1"
logo_scale:
logo_opacity: 0.7
logo_filter: "overlay=W-w-12:12"
add_loudnorm: False

View File

@ -19,10 +19,10 @@
import math
import os
import re
from .utils import _pre_comp
# ------------------------------------------------------------------------------
# building filters,
# when is needed add individuell filters to match output format
@ -116,14 +116,18 @@ def overlay_filter(duration, ad, ad_last, ad_next):
when clip before was an ad fade logo in
"""
logo_filter = '[v]null[logo]'
scale_filter = ''
if _pre_comp.add_logo and os.path.isfile(_pre_comp.logo) and not ad:
logo_chain = []
opacity = 'format=rgba,scale={},colorchannelmixer=aa={}'.format(
_pre_comp.logo_scale, _pre_comp.logo_opacity)
if _pre_comp.logo_scale and \
re.match(r'\d+:-?\d+', _pre_comp.logo_scale):
scale_filter = 'scale={},'.format(_pre_comp.logo_scale)
logo_extras = 'format=rgba,{}colorchannelmixer=aa={}'.format(
scale_filter, _pre_comp.logo_opacity)
loop = 'loop=loop=-1:size=1:start=0'
logo_chain.append(
'movie={},{},{}'.format(_pre_comp.logo, loop, opacity))
'movie={},{},{}'.format(_pre_comp.logo, loop, logo_extras))
if ad_last:
logo_chain.append('fade=in:st=0:d=1.0:alpha=1')
if ad_next: