Skip to content

Commit

Permalink
Added auto thread type for potential speed improvements, it will depe…
Browse files Browse the repository at this point in the history
…nd on the codec
  • Loading branch information
mikelgg93 committed Oct 13, 2022
1 parent 060a3a5 commit ed84ad4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pupil_labs/dynamic_content_on_rim/video/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def read_video_ts(video_path, audio=False):
stream = video_container.streams.audio[0]
else:
stream = video_container.streams.video[0]
stream.thread_type = "AUTO"
fps = stream.average_rate # alt base_rate or guessed_rate
nframes = stream.frames
logging.info("Extracting pts...")
Expand Down Expand Up @@ -73,6 +74,7 @@ def get_frame(av_container, pts, last_pts, frame, audio=False):
strm = av_container.streams.audio[0]
else:
strm = av_container.streams.video[0]
strm.thread_type = "AUTO"
if last_pts < pts:
try:
for frame in av_container.decode(strm):
Expand Down

2 comments on commit ed84ad4

@mikelgg93
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Results

Same videos using test_decode_thread.py from pyav.

Video test, from PI scene camera

Video:

  • No auto: 20.38s
  • Auto: 5.87s

Audio:

  • No auto: 0.71s
  • Auto: 0.7s

@papr you might be interested

@papr
Copy link
Contributor

@papr papr commented on ed84ad4 Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikelgg93 Nice!

Please sign in to comment.