IP Camera Jetson tk1

I have been trying to run the same opencv application on tk1, which was working fin on other systems.

But at tk1 it hardly captures any frame from IP camera. Almost all the video is distorted.

and the console displays messages:

[h264 @ 0xxxxx] cabac decode of qscale diff failed at 0 29
[h264 @ 0xxxxx] error while decoding MB 0 29, bytestream (-1)
[h264 @ 0xxxxx] left block unavailable for requested intra mode at 0 19

These numbers 0, 29, 19 etc are different over time in the constantly popping warnings.

Any help will be highly appreciated.

It is unclear if OpenCV makes use of TK1’s hardware video decoder — instead it may be using CPU decoder (ffmpeg). What transport protocol does your IP camera use? If it’s using RTP/RTSP or has V4L2 driver, you may be able to independently verify with gstreamer. Here are some examples:

http://elinux.org/Jetson/H264_Codec#From_the_command_line
http://developer.download.nvidia.com/embedded/L4T/r21_Release_v3.0/L4T_Jetson_TK1_Multimedia_User_Guide_V2.1.pdf

Thanks, Yes it is seems to be using CPU decoder (ffmpeg). My camera supports RTSP and has h.264 and mjpeg video compression.
I want to do it in opencv. What is the right way to pursue that?

Also, It works perfectly using Totem.

Totem uses gstreamer back-end. Are you using mainline OpenCV or OpenCV4Tegra?

I am using OpenCV4Tegra.

Thank you, we are looking into this case, and will let you know when we can offer further advice on your issue.

You are welcome and Thank you for your consideration.
Hope to hear from you soon!

Until then, I would be trying at least something as workaround.
Could you please advise on that?

Since you have Totem working with your camera, and Totem uses gstreamer backend, you could use gstreamer in the meantime. You might find this post relevant: https://devtalk.nvidia.com/default/topic/789337/?comment=4372373. We are continuing to dig into this case to hopefully avoid your headache in the future.

Thanks. Looking forward.

I’m facing the same problem when opening IP camera (RTSP) in OpenCV4Tegra.

One solution I found is to put ffmpeg=OFF when configuring OpenCV and use gstreamer instead. But I had a delay of around 3 seconds in the video output.

Now I’m using OpenCV4Tegra, it uses ffmpeg it seems. The decode error is present. Any help?

Hi,

Thanks for your question.

We will check the latest status of this issue and update to you later.

Hi,

Thank you for your patience.
We tried to open a rtsp video via opencv and doesn’t meet the error you mentioned.

Share our opencv code. It’s a public rtsp server and codec is H264–MPEG-4 AVC.

#include <iostream>
#include <opencv2/highgui.hpp>

int main(void)
{
    cv::VideoCapture cap("rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov");

    if( !cap.isOpened() )
    {
        std::cout << "Not good, open camera failed" << std::endl;
        return 0;
    }

    cv::Mat frame;
    while(true)
    {
        cap >> frame;
        cv::imshow("Frame", frame);
        cv::waitKey(1);
    }
    return 0;
}

Hello Team,

We are facing the same problem at our client site, please see the python code below to read the frames from DVR.

import numpy as np
import cv2

cap = cv2.VideoCapture("rtsp://admin:admin123@xx.xx.xx.xx/h264/ch1/main/av_stream") 
while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

Please see the configurations below

Camera Type - Analog (2)
Resolution - 640p
FPS - 6
Bit rate - 128 kb/s

GPU Details - NVDIA Quadro P400 2GB
CPU Details - i5 7th Generation, 8GB RM
Operating System - Windows 10 Pro

But console shows following messages:

[h264 @ 0xxxxx] cabac decode of qscale diff failed at
[h264 @ 0xxxxx] error while decoding MB 0 29, bytestream (-1)
[h264 @ 0xxxxx] left block unavailable for requested intra mode at


When we process one camera frequency is less and for 2 cameras it’s more. Also, this error starts popping after few hours when application is started and frequency increases which causes inaccurate results. There are no fixed time intervals.
Please help us with some suggestions.
Best regards,
Pranita

Hello Team

I have ip camera and want to read stream from it using opencv.

till now I am able to read frame and display it but suddenly video is stoped/freeze because of pocket loss

Error

h264 @ 0x8f915e0] error while decoding MB 53 20, bytestream -7

My configuration:

ubuntu 16.04
opencv 3.4.3
GPU GTX 1080

code
video_capture = cv2.VideoCapture(“rtsp://user:userhik1@192.168.23.114”)

please any help

Thanks