python-codecs: fix startup analyze duration and probe size

This commit is contained in:
Koushik Dutta
2023-10-23 09:34:11 -07:00
parent 0e797c6ac6
commit 96219456f3
3 changed files with 12 additions and 5 deletions

View File

@@ -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"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/python-codecs",
"version": "0.1.88",
"version": "0.1.89",
"description": "Python Codecs for Scrypted",
"keywords": [
"scrypted",

View File

@@ -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)