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

Error while decoding MB #39

Open
CrashLaker opened this issue Dec 24, 2020 · 3 comments
Open

Error while decoding MB #39

CrashLaker opened this issue Dec 24, 2020 · 3 comments

Comments

@CrashLaker
Copy link

CrashLaker commented Dec 24, 2020

Hi all,

I just started playing with this.
I'm just trying to get some consistent images from time to time.
I'm using the streaming_video.py from examples folder but I'm getting a weird behaviour:
image

[h264 @ 0x2bb0580] error while decoding MB 42 54, bytestream -5
[h264 @ 0x2bdf480] error while decoding MB 103 80, bytestream -15
[h264 @ 0x2bb1780] error while decoding MB 87 36, bytestream -5
[h264 @ 0x2bdf480] error while decoding MB 8 32, bytestream -11
[h264 @ 0x2bb1780] error while decoding MB 31 18, bytestream -5
[h264 @ 0x2bb0580] error while decoding MB 41 75, bytestream -9

Also the image is rendered broken sometimes.
How can I solve this?

  7 def non_blocking():
  8     print("calling non-blocking")
  9     def inner_callback(img):
 10         now = int(datetime.datetime.now().timestamp())
 11         cv2.imwrite(f"/path/{now}.png",
 12                     img)
 13         cv2.destroyAllWindows()

Regards,
C.

@CrashLaker
Copy link
Author

this seems to render better snap images

cap = cv2.VideoCapture("rstp://....")
while True:
    ret, frame = cap.read()
    if not ret: continue
    cv2.imwrite(" ", frame)
    time.sleep(2)

@Benehiko
Copy link
Member

Benehiko commented Dec 26, 2020

Interesting, seems to be related to #25 (comment)

Which camera are you using?

Also, we are using the FFMPEG streaming flag, as mentioned here

self.capture = cv2.VideoCapture(self.url, cv2.CAP_FFMPEG)

I have added a comment there in my last commit contemplating the necessity of it. It might be the reason for your streaming issues and @Portscanner. I thought that it might fix the issue opening the stream in its own thread as mentioned in this SO thread.

@ghost
Copy link

ghost commented Dec 27, 2020

Hi
In the meantime I am working without the Reolink API and sometimes I still get the error messages. However, when I restart the camera there are no more errors. It doesn't seem to be a problem with the API, but with the camera (Reolink: RLC-511W).

vs = VideoStream("rtsp://abcde:123456@192.168.178.xx:554//h264Preview_01_sub").start()
time.sleep(2)

while True:
    try:
        frame = vs.read()
        frame = imutils.resize(frame, width=500)
        orig = frame.copy()
        frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        frame = Image.fromarray(frame)
        cv2.imshow("Test", orig)
    except:
        vs = VideoStream("rtsp://abcde:123456@192.168.178.65:554//h264Preview_01_sub").start()
    key = cv2.waitKey(100) & 0xFF
    if key == ord("q"):
        print('')
        break
cv2.destroyAllWindows()
vs.stop()

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

2 participants