PyAV
PyAV copied to clipboard
av.error.InvalidDataError: [Errno 1094995529] Invalid data found when processing input; last error log: [hevc] PPS id out of range: 6
When I'm trying to open an RTSP stream using PyAV, I encountered an issue. I attempted to open the RTSP stream with the following code:
import time
import av
class YDRtmpThread:
def __init__(self):
self.container = None
self.reconnect()
def start_capture_camera(self):
while True:
try:
if self.fps is None:
time.sleep(1)
self.reconnect()
continue
if self.frames is None:
self.frames = self.container.decode(video=0)
frame = next(self.frames)
img = frame.to_ndarray(format="bgr24")
except Exception as e:
print(e)
self.fps = None
def reconnect(self):
try:
self.frames = None
self.fps = None
rtmpUrl = ""
self.close_container()
options = {"rtsp_transport": "tcp"}
self.container = av.open(rtmpUrl, options=options, timeout=10)
self.container.non_block = True
stream = self.container.streams.video[0]
self.fps = stream.average_rate
print(self.fps)
except Exception as e:
print(e)
def close_container(self):
if self.container:
self.container.close()
self.container = None
if __name__ == "__main__":
yd = YDRtmpThread()
yd.start_capture_camera()
However, I encountered an error: av.error.InvalidDataError: [Errno 1094995529] Invalid data found when processing input; last error log: [hevc] PPS id out of range: 6
This error, when it occurs, seems to lead to an increase in system memory when I attempt to reopen the same RTSP stream. There are indications of memory overflow, possibly resulting in a memory leak.
Can you reproduce this on 11.0.0?