diff --git a/ffplayout.conf b/ffplayout.conf index 5abdecbe..38658c06 100644 --- a/ffplayout.conf +++ b/ffplayout.conf @@ -110,23 +110,13 @@ extensions = ["*.mp4"] shuffle = False -; overlay text -; for paramters check ffmpeg doc -; leave textfile blank when you don't need this -; in some systems decimal point is a comma, have this in mind when ffmpeg complains about wrong values +; overlay text in combination with messenger: https://github.com/ffplayout/messenger ; on windows fontfile path need to be like this: C\:/WINDOWS/fonts/DejaVuSans.ttf -; textfile has the same pattern +; in a standard environment the filter drawtext node is: Parsed_drawtext_2 [TEXT] add_text = True -textfile = /media/live.txt -fontsize = 24 -fontcolor = white +bind_address = tcp://127.0.0.1:5555 fontfile = /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf -box = 1 -boxcolor = black@0xbb -boxborderw = 6 -x = w-w/8*mod(t,8*(w+tw)/w) -y = (h-line_h)*0.9 ; the final playout post compression diff --git a/ffplayout.py b/ffplayout.py index ad91c107..7bb8ce4b 100755 --- a/ffplayout.py +++ b/ffplayout.py @@ -212,15 +212,8 @@ def load_config(): _storage.shuffle = cfg.getboolean('STORAGE', 'shuffle') _text.add_text = cfg.getboolean('TEXT', 'add_text') - _text.textfile = cfg.get('TEXT', 'textfile') - _text.fontsize = cfg.get('TEXT', 'fontsize') - _text.fontcolor = cfg.get('TEXT', 'fontcolor') + _text.address = cfg.get('TEXT', 'bind_address') _text.fontfile = cfg.get('TEXT', 'fontfile') - _text.box = cfg.get('TEXT', 'box') - _text.boxcolor = cfg.get('TEXT', 'boxcolor') - _text.boxborderw = cfg.get('TEXT', 'boxborderw') - _text.x = cfg.get('TEXT', 'x') - _text.y = cfg.get('TEXT', 'y') if _init.load: _log.to_file = cfg.getboolean('LOGGING', 'log_to_file') @@ -1587,15 +1580,13 @@ def main(): '-bufsize', '{}k'.format(_pre_comp.v_bufsize) ] + pre_audio_codec() + ['-f', 'mpegts', '-'] - if _text.add_text and os.path.isfile(_text.textfile): - messenger.info('Overlay text file: "{}"'.format(_text.textfile)) + if _text.add_text: + messenger.info('Using drawtext node, listening on address: {}'.format( + _text.address + )) overlay = [ - '-vf', ("drawtext=box={}:boxcolor='{}':boxborderw={}" - ":fontsize={}:fontcolor={}:fontfile='{}':textfile={}" - ":reload=1:x='{}':y='{}'").format( - _text.box, _text.boxcolor, _text.boxborderw, - _text.fontsize, _text.fontcolor, _text.fontfile, - _text.textfile, _text.x, _text.y) + '-vf', "null,zmq=b='{}',drawtext=text='':fontfile='{}'".format( + _text.address.replace(':', '\\:'), _text.fontfile) ] try: