diff options
author | MaZderMind <git@mazdermind.de> | 2016-09-28 21:21:23 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2016-09-28 21:21:23 +0200 |
commit | 12ffd2155cbec3d94e8fc2df32532de016005a5c (patch) | |
tree | 19059647c7ec1c4922caecb9b80d77d4ea254370 /voctocore/lib | |
parent | f13be7d7cddc1085a763b63e4b0db9aeee478277 (diff) | |
parent | 7d206f56eb557585986bd259e32293a81899c853 (diff) |
Merge branch 'previews-vaapi'
Diffstat (limited to 'voctocore/lib')
-rw-r--r-- | voctocore/lib/avpreviewoutput.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/voctocore/lib/avpreviewoutput.py b/voctocore/lib/avpreviewoutput.py index 749249b..4d4f70e 100644 --- a/voctocore/lib/avpreviewoutput.py +++ b/voctocore/lib/avpreviewoutput.py @@ -23,6 +23,30 @@ class AVPreviewOutput(TCPMultiConnection): if Config.getboolean('previews', 'deinterlace'): deinterlace = "deinterlace mode=interlaced !" + venc = 'jpegenc quality=90' + if Config.has_option('previews', 'vaapi'): + try: + encoder = Config.get('previews', 'vaapi') + if Gst.version() < (1, 8): + encoders = { + 'h264': 'vaapiencode_h264 rate-control=cqp init-qp=10 ' + 'max-bframes=0 keyframe-period=60', + 'jpeg': 'vaapiencode_jpeg quality=90' + 'keyframe-period=0', + 'mpeg2': 'vaapiencode_mpeg2 keyframe-period=60', + } + else: + encoders = { + 'h264': 'vaapih264enc rate-control=cqp init-qp=10 ' + 'max-bframes=0 keyframe-period=60', + 'jpeg': 'vaapijpegenc quality=90' + 'keyframe-period=0', + 'mpeg2': 'vaapimpeg2enc keyframe-period=60', + } + venc = encoders[encoder] + except Exception as e: + self.log.error(e) + pipeline = """ intervideosrc channel=video_{channel} ! {vcaps_in} ! @@ -30,7 +54,7 @@ class AVPreviewOutput(TCPMultiConnection): videoscale ! videorate ! {vcaps_out} ! - jpegenc quality=90 ! + {venc} ! queue ! mux. @@ -54,7 +78,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) |