Skip to content

Commit

Permalink
python-codecs: fix startup analyze duration and probe size
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Oct 23, 2023
1 parent 0e797c6 commit 9621945
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions plugins/python-codecs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/python-codecs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/python-codecs",
"version": "0.1.88",
"version": "0.1.89",
"description": "Python Codecs for Scrypted",
"keywords": [
"scrypted",
Expand Down
11 changes: 9 additions & 2 deletions plugins/python-codecs/src/libav.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,16 +48,23 @@ def threadMain():
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)
Expand Down

0 comments on commit 9621945

Please sign in to comment.