From 96219456f3beb85a3428a6254553beee2e804c03 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 23 Oct 2023 09:34:11 -0700 Subject: [PATCH] python-codecs: fix startup analyze duration and probe size --- plugins/python-codecs/package-lock.json | 4 ++-- plugins/python-codecs/package.json | 2 +- plugins/python-codecs/src/libav.py | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/python-codecs/package-lock.json b/plugins/python-codecs/package-lock.json index b312aaeca..965e5ac19 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.88", + "version": "0.1.89", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@scrypted/python-codecs", - "version": "0.1.88", + "version": "0.1.89", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/python-codecs/package.json b/plugins/python-codecs/package.json index 3406e581d..9abed1b09 100644 --- a/plugins/python-codecs/package.json +++ b/plugins/python-codecs/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/python-codecs", - "version": "0.1.88", + "version": "0.1.89", "description": "Python Codecs for Scrypted", "keywords": [ "scrypted", diff --git a/plugins/python-codecs/src/libav.py b/plugins/python-codecs/src/libav.py index 7a287c247..b2bca2864 100644 --- a/plugins/python-codecs/src/libav.py +++ b/plugins/python-codecs/src/libav.py @@ -21,8 +21,8 @@ async def generateVideoFramesLibav(mediaObject: scrypted_sdk.MediaObject, option # none of this stuff seems to work. might be libav being slow with rtsp. # container.no_buffer = True # container.gen_pts = False - # container.options['-analyzeduration'] = '0' - # container.options['-probesize'] = '500000' + container.options['analyzeduration'] = '0' + container.options['probesize'] = '500000' stream = container.streams.video[0] # stream.codec_context.thread_count = 1 # stream.codec_context.low_delay = True @@ -48,16 +48,23 @@ async def generateVideoFramesLibav(mediaObject: scrypted_sdk.MediaObject, option thread = threading.Thread(target=threadMain) thread.start() + print(time.time()) try: vipsImage: vipsimage.VipsImage = None pilImage: pilimage.PILImage = None mo: scrypted_sdk.MediaObject = None + firstFrame = False while True: frame = await sampleQueue.get() if not frame: break + if not firstFrame: + print('first frame') + print(time.time()) + firstFrame = True + if vipsimage.pyvips: if gray and frame.format.name.startswith('yuv') and frame.planes and len(frame.planes): vips = vipsimage.new_from_memory(memoryview(frame.planes[0]), frame.width, frame.height, 1)