Ask Your Question
0

/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:901

asked 2020-05-05 02:18:01 -0600

updated 2020-05-05 02:30:54 -0600

berak gravatar image

Hi,

I want show ipcamear stream using opencv 4 & python 3.7 .but i am getting the below error.

warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:901)
warning: rtsp://ipaddress/Streaming/Channels/1 (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:902)
Traceback (most recent call last):

Code :

# import the necessary packages
from imutils.video import VideoStream
import numpy as npq
import argparse
import imutils
import time
import cv2
import os

print("[INFO] starting video stream...")
vs = cv2.VideoCapture("rtsp://ipcamera/Streaming/Channels/1")

# loop over the frames from the video stream
count =0.0
while True:
    # print(count)
    count += 1
    ret, frame = vs.read()  
    frame = imutils.resize(frame,width=740)
    cv2.startWindowThread()
    cv2.imshow('Stream IP Camera OpenCV',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

vs.release()
cv2.destroyAllWindows()
edit retag flag offensive close merge delete

Comments

"rtsp://ipcamera/Streaming/Channels/1" -- does not look like a valid url to me

berak gravatar imageberak ( 2020-05-05 02:32:07 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-05-06 06:56:51 -0600

supra56 gravatar image

updated 2020-05-06 07:02:58 -0600

Change this:

vs = cv2.VideoCapture("rtsp://ipcamera/Streaming/Channels/1")

to:

vs = cv2.VideoCapture("rtsp://ipcamera/1")

or if used pc:

vs = cv2.VideoCapture("rtsp://ipcamera/1, cv2.CAP_FFMPEG")

This my src on linux raspberry pi and its should work.

cap = cv2.VideoCapture('rtsp://username:password@IP:port/1')
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-05-05 02:18:01 -0600

Seen: 3,740 times

Last updated: May 06 '20