Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

av.error.InvalidDataError: [Errno 1094995529] Invalid data found when processing input; last error log: [hevc] PPS id out of range: 6 #110

Open
chercy1 opened this issue Aug 7, 2023 · 0 comments

Comments

@chercy1
Copy link

chercy1 commented Aug 7, 2023

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()
self.__running_flag = True

def start_capture_camera(self):
    while self.__running_flag:
        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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant