diff options
author | MaZderMind <git@mazdermind.de> | 2016-08-17 13:27:19 +0200 |
---|---|---|
committer | Peter Körner <pkoerner@seibert-media.net> | 2016-09-27 10:00:05 +0200 |
commit | 49188f70b86387f64b40aa8c86ec4633ebf534ad (patch) | |
tree | c457073b1eaa09744d5c08ec0375733a86ff4f0d | |
parent | 93ed7357ff8c255a87c7412ba59f6fe4cbdd91e4 (diff) |
select vaapi-encoder for preview-output depending on config
-rw-r--r-- | voctocore/default-config.ini | 6 | ||||
-rw-r--r-- | 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) |