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

VideoCapture error: can't find starting number #76

Open
sinabolouki opened this issue Jan 8, 2024 · 1 comment
Open

VideoCapture error: can't find starting number #76

sinabolouki opened this issue Jan 8, 2024 · 1 comment

Comments

@sinabolouki
Copy link

I want to capture a video from a RTSP server using opencv on android. My implementation is like this:

if(!OpenCVLoader.initDebug()) {
    return
}

val cap = VideoCapture()
cap.open("rtsp://10.181.73.158:8086/?camera=world")

I'll get this error running last line:

2024-01-08 16:27:18.944 22957-23040 cv::error()             com.example.birthday                 E  OpenCV(4.5.2) Error: Requested object was not found (could not open directory: /data/app/~~eXkZfablwsElr9gDEsa36A==/com.example.birthday-f_lYz1toHNeSIJMnjZCcuA==/base.apk!/lib/arm64-v8a) in glob_rec, file /home/quickbirdstudios/opencv/opencv/modules/core/src/glob.cpp, line 267
2024-01-08 16:27:19.060 22957-23040 cv::error()             com.example.birthday                 E  OpenCV(4.5.2) Error: Requested object was not found (could not open directory: /data/app/~~eXkZfablwsElr9gDEsa36A==/com.example.birthday-f_lYz1toHNeSIJMnjZCcuA==/base.apk!/lib/arm64-v8a) in glob_rec, file /home/quickbirdstudios/opencv/opencv/modules/core/src/glob.cpp, line 267
2024-01-08 16:27:19.060 22957-23040 cv::error()             com.example.birthday                 E  OpenCV(4.5.2) Error: Requested object was not found (could not open directory: /data/app/~~eXkZfablwsElr9gDEsa36A==/com.example.birthday-f_lYz1toHNeSIJMnjZCcuA==/base.apk!/lib/arm64-v8a) in glob_rec, file /home/quickbirdstudios/opencv/opencv/modules/core/src/glob.cpp, line 267
2024-01-08 16:27:19.060 22957-23040 cv::error()             com.example.birthday                 E  OpenCV(4.5.2) Error: Requested object was not found (could not open directory: /data/app/~~eXkZfablwsElr9gDEsa36A==/com.example.birthday-f_lYz1toHNeSIJMnjZCcuA==/base.apk!/lib/arm64-v8a) in glob_rec, file /home/quickbirdstudios/opencv/opencv/modules/core/src/glob.cpp, line 267
2024-01-08 16:27:19.061 22957-23040 cv::error()             com.example.birthday                 E  OpenCV(4.5.2) Error: Bad argument (CAP_IMAGES: can't find starting number (in the name of file): rtsp://10.181.73.158:8086/?camera=world) in icvExtractPattern, file /home/quickbirdstudios/opencv/opencv/modules/videoio/src/cap_images.cpp, line 253
2024-01-08 16:27:19.061 22957-23040 OpenCV/4.5.2            com.example.birthday                 E  [ERROR:0] global /home/quickbirdstudios/opencv/opencv/modules/videoio/src/cap.cpp (162) open VIDEOIO(CV_IMAGES): raised OpenCV exception:
                                                                                                    
                                                                                                    OpenCV(4.5.2) /home/quickbirdstudios/opencv/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): rtsp://10.181.73.158:8086/?camera=world in function 'icvExtractPattern'
2024-01-08 16:27:19.061 22957-23040 NativeCodec             com.example.birthday                 E  failed to stat file: rtsp://10.181.73.158:8086/?camera=world (No such file or directory)

I also had this error in python, but I could fix it by setting envrionment variable OPENCV_FFMPEG_CAPTURE_OPTIONS to rtsp_transport;0 so in python, my code was like this:

import os

os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;0"

cap = cv2.VideoCapture("rtsp://10.181.73.158:8086/?camera=world")

while cap.isOpened():
    ret, frame = cap.read()
    cv2.imshow('frame', frame)
    if cv2.waitKey(20) & 0xFF == ord('q'):
        break

However, setting envrionment variables in Android seems impossible. Are there any other way I can use to fix this issue?

@tienldbnk
Copy link

tienldbnk commented Aug 4, 2024

image image @sinabolouki There is no expectation of opencv library available to capture video using rtsp url , this made me write c++ and it didn't work , maybe openCV's rtsp doesn't work on android ? that's all i wonder

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