diff --git a/plugins/python-codecs/package-lock.json b/plugins/python-codecs/package-lock.json index 73f9f93ed..c74091db4 100644 --- a/plugins/python-codecs/package-lock.json +++ b/plugins/python-codecs/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/python-codecs", - "version": "0.1.27", + "version": "0.1.30", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@scrypted/python-codecs", - "version": "0.1.27", + "version": "0.1.30", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/python-codecs/package.json b/plugins/python-codecs/package.json index b62d5bb34..25a3d7278 100644 --- a/plugins/python-codecs/package.json +++ b/plugins/python-codecs/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/python-codecs", - "version": "0.1.27", + "version": "0.1.30", "description": "Python Codecs for Scrypted", "keywords": [ "scrypted", diff --git a/plugins/python-codecs/src/main.py b/plugins/python-codecs/src/main.py index a3611eaee..102f1bec4 100644 --- a/plugins/python-codecs/src/main.py +++ b/plugins/python-codecs/src/main.py @@ -1,3 +1,4 @@ +import traceback import asyncio import scrypted_sdk from scrypted_sdk import Setting, SettingValue @@ -6,6 +7,7 @@ import gstreamer import libav import vipsimage import pilimage +import time Gst = None try: @@ -128,19 +130,29 @@ def create_scrypted_plugin(): class CodecFork: async def generateVideoFramesGstreamer(self, mediaObject: scrypted_sdk.MediaObject, options: scrypted_sdk.VideoFrameGeneratorOptions = None, filter: Any = None, h264Decoder: str = None) -> scrypted_sdk.VideoFrame: + start = time.time() try: async for data in gstreamer.generateVideoFramesGstreamer(mediaObject, options, filter, h264Decoder): yield data + except Exception as e: + traceback.print_exc() + raise finally: + print('gstreamer finished after %s' % (time.time() - start)) import os os._exit(os.EX_OK) pass async def generateVideoFramesLibav(self, mediaObject: scrypted_sdk.MediaObject, options: scrypted_sdk.VideoFrameGeneratorOptions = None, filter: Any = None) -> scrypted_sdk.VideoFrame: + start = time.time() try: async for data in libav.generateVideoFramesLibav(mediaObject, options, filter): yield data + except Exception as e: + traceback.print_exc() + raise finally: + print('libav finished after %s' % (time.time() - start)) import os os._exit(os.EX_OK) pass diff --git a/plugins/python-codecs/src/requirements.txt b/plugins/python-codecs/src/requirements.txt index 768f3225a..5ea5256b2 100644 --- a/plugins/python-codecs/src/requirements.txt +++ b/plugins/python-codecs/src/requirements.txt @@ -1,3 +1,6 @@ +# needed by libav to_ndarray +numpy>=1.16.2 + # gobject instrospection for gstreamer. PyGObject>=3.30.4; sys_platform != 'win32'