Skip to content

Commit

Permalink
Prevent AttributeError: 'av.audio.codeccontext.AudioCodecContext' obj…
Browse files Browse the repository at this point in the history
…ect has no attribute 'average_rate' if reading audio
  • Loading branch information
mikelgg93 committed Nov 5, 2024
1 parent 96d6c4b commit 1de058b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pupil_labs/dynamic_content_on_rim/video/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def read_video_ts(video_path, audio=False, auto_thread_type=True):
stream = video_container.streams.video[0]
if auto_thread_type:
stream.thread_type = "AUTO"
fps = stream.average_rate # alt base_rate or guessed_rate
fps = (
stream.average_rate if not audio else stream.rate
) # alt base_rate or guessed_rate
nframes = stream.frames
logging.info("Extracting pts...")
pts, dts, ts = (list() for i in range(3))
Expand Down

0 comments on commit 1de058b

Please sign in to comment.