Ask Your Question
0

Problem opening rtsp stream

asked 2017-07-10 09:05:00 -0600

vhal gravatar image

updated 2017-07-10 09:29:43 -0600

Hello!

I am trying to capture an sdp file with vc2.VideoCapture using Python 2.7.13 and opencv 3.2.0 in win10 using:

cap = cv2.VideoCapture("my_file.sdp")

but cap.isOpened() never becomes true.

The program exits with code 0 and a message:

[rtp @ 07902760] Protocol not on whitelist 'file,crypto'! 
warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:779) 
warning: my_file.sdp (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:780)

The sdp file plays ok from command line with ffplay –protocol_whitelist file,udp,rtp my_file.sdp

(For some unknown reason vlc shows only one frame…)

Any clues on how to proceed?

Thanks in advance, Vagelis

edit retag flag offensive close merge delete

Comments

btw, i have no idea, how you even managed to type this: “my_file.sdp”

you need plain ' or " , opencv only understands ascii !

also, unlikely, that you can use sdp files. try with a proper (stream) url instead.

berak gravatar imageberak ( 2017-07-10 09:22:07 -0600 )edit

Hi berak and thank you for your comment. I have used regular double quotes in my code (I edited accordingly my question above) Also, the same code worked perfectly in my previous intallation of python and ocv on the same system... I don't know why it is not working now... V

vhal gravatar imagevhal ( 2017-07-10 09:34:01 -0600 )edit

2 answers

Sort by » oldest newest most voted
1

answered 2019-10-18 03:05:27 -0600

sheep94lion gravatar image

I found a solution here. It use environment variable OPENCV_FFMPEG_CAPTURE_OPTIONS to pass the whitelist parameters to ffmpeg.

import os

os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "protocol_whitelist;file,rtp,udp"

edit flag offensive delete link more
0

answered 2017-07-11 06:32:23 -0600

vhal gravatar image

Solved (in a sense...)

I uninstalled opencv 3.2.0 and installed 3.1.0 from here.

Rtp video stream captured gracefully with:

cap = cv2.VideoCapture("my_file.sdp")
edit flag offensive delete link more

Comments

Hello vhal ! I faced such problem too. I'm using Raspberry pi, and already tried 3.3.0, 3.3,1 ,3.4.0 versions. but the same problem... What can you suggest ?

devdev gravatar imagedevdev ( 2018-02-15 07:01:36 -0600 )edit

Hi devdev, Did you solve the problem?

otoker gravatar imageotoker ( 2020-04-12 02:35:59 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-07-10 09:05:00 -0600

Seen: 3,858 times

Last updated: Jul 10 '17