From 49188f70b86387f64b40aa8c86ec4633ebf534ad Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Wed, 17 Aug 2016 13:27:19 +0200 Subject: select vaapi-encoder for preview-output depending on config --- voctocore/default-config.ini | 6 +++++- voctocore/lib/avpreviewoutput.py | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/voctocore/default-config.ini b/voctocore/default-config.ini index 31a49ff..8f816d3 100644 --- a/voctocore/default-config.ini +++ b/voctocore/default-config.ini @@ -62,9 +62,13 @@ mix_out=10000 enabled=false deinterlace=false +; use vaapi to encode the previews, can be h264, mpeg2 or jpeg +; not all encoders are available on all CPUs +;vaapi=h264 + ; default to mix-videocaps, only applicable if enabled=true ; you can change the framerate and the width/height, but nothing else -videocaps=video/x-raw,width=1024,height=576,framerate=25/1 +;videocaps=video/x-raw,width=1024,height=576,framerate=25/1 [stream-blanker] enabled=true diff --git a/voctocore/lib/avpreviewoutput.py b/voctocore/lib/avpreviewoutput.py index 749249b..b2e8b4a 100644 --- a/voctocore/lib/avpreviewoutput.py +++ b/voctocore/lib/avpreviewoutput.py @@ -23,6 +23,18 @@ class AVPreviewOutput(TCPMultiConnection): if Config.getboolean('previews', 'deinterlace'): deinterlace = "deinterlace mode=interlaced !" + venc = 'jpegenc quality=90' + try: + encoder = Config.get('previews', 'vaapi') + encoders = { + 'h264': 'vaapih264enc', + 'jpeg': 'vaapijpegenc', + 'mpeg2': 'vaapimpeg2enc', + } + venc = encoders[encoder] + except Exception as e: + self.log.error(e) + pipeline = """ intervideosrc channel=video_{channel} ! {vcaps_in} ! @@ -30,7 +42,7 @@ class AVPreviewOutput(TCPMultiConnection): videoscale ! videorate ! {vcaps_out} ! - jpegenc quality=90 ! + {venc} ! queue ! mux. @@ -54,7 +66,8 @@ class AVPreviewOutput(TCPMultiConnection): acaps=Config.get('mix', 'audiocaps'), vcaps_in=Config.get('mix', 'videocaps'), vcaps_out=vcaps_out, - deinterlace=deinterlace + deinterlace=deinterlace, + venc=venc ) self.log.debug('Creating Output-Pipeline:\n%s', pipeline) -- cgit v1.2.3