问题
I'm using Raspberry Pi3 and I`m trying to get a RTSP stream through my wireless IP camera, but I'm getting this error:
pi@raspberrypi:~ $ alprd -f
INFO - Running OpenALPR daemon in the foreground.
INFO - Using: /etc/openalpr/alprd.conf for daemon configuration
Missing config value for company_id
Missing config value for pattern
INFO - Using: /home/pi/Database/pictures for storing valid plate images
INFO - country: br -- config file: /etc/openalpr/openalpr.conf
INFO - pattern:
INFO - Stream 1: rtsp://192.168.1.230:554/onvif1
INFO - Starting camera 1
INFO - Video stream connecting...
[rtsp @ 0x71700960] Nonmatching transport in server reply
WARN - Stream rtsp://192.168.1.230:554/onvif1 failed to open.
INFO - Video stream connecting...
[rtsp @ 0x71700840] Nonmatching transport in server reply
WARN - Stream rtsp://192.168.1.230:554/onvif1 failed to open.
INFO - Video stream connecting...
[rtsp @ 0x71700960] Nonmatching transport in server reply
WARN - Stream rtsp://192.168.1.230:554/onvif1 failed to open.
INFO - Video stream connecting...
[rtsp @ 0x71700840] Nonmatching transport in server reply
WARN - Stream rtsp://192.168.1.230:554/onvif1 failed to open.
INFO - Video stream connecting...
[rtsp @ 0x71700960] Nonmatching transport in server reply
WARN - Stream rtsp://192.168.1.230:554/onvif1 failed to open.
INFO - Video stream connecting...
[rtsp @ 0x71700840] Nonmatching transport in server reply
WARN - Stream rtsp://192.168.1.230:554/onvif1 failed to open.
The RTSP link that I´m using is: rtsp://192.168.1.230:554/onvif1
or with the user:pwd is:
rtsp://2512398:123@192.168.1.230:554/onvif1
The way it is in my alprd.conf:
; Declare each stream on a separate line
; each unique stream should be defined as stream = [url]
stream = rtsp://192.168.1.230:554/onvif1
;stream = http://192.168.1.36:8080/video
;stream = http://127.0.0.1/example_second_stream.mjpeg
;stream = webcam
I can connect using VLC (in my computer and RPI) without any problems, but when I use it in my .conf file in order to use the command alprd -f to start checking for license plates I get that error :/
I'm really a novice in programming, so please don't go way too specific because I will probably not understand it hahaha
Thanks guys! Love u all <3
回答1:
I faced a similar problem, try ffplay -rtsp_transport tcp rtsp//:...
if you get same error you need to change opencv ffmpeg_cap_impl.hpp
source, because this param hardcoded.
回答2:
At OpenCV 3.4.1 you can change env variable OPENCV_FFMPEG_CAPTURE_OPTIONS to "rtsp_transport;0".
This env var is taken into account in cap_ffmpeg_impl.hpp.
#if USE_AV_INTERRUPT_CALLBACK
/* interrupt callback */
interrupt_metadata.timeout_after_ms = LIBAVFORMAT_INTERRUPT_OPEN_TIMEOUT_MS;
get_monotonic_time(&interrupt_metadata.value);
ic = avformat_alloc_context();
ic->interrupt_callback.callback = _opencv_ffmpeg_interrupt_callback;
ic->interrupt_callback.opaque = &interrupt_metadata;
#endif
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
#ifndef NO_GETENV
char* options = getenv("OPENCV_FFMPEG_CAPTURE_OPTIONS");
if(options == NULL)
{
av_dict_set(&dict, "rtsp_transport", "tcp", 0);
}
else
{
#if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 ? CALC_FFMPEG_VERSION(52, 17, 100) : CALC_FFMPEG_VERSION(52, 7, 0))
av_dict_parse_string(&dict, options, ";", "|", 0);
#else
av_dict_set(&dict, "rtsp_transport", "tcp", 0);
#endif
}
#else
av_dict_set(&dict, "rtsp_transport", "tcp", 0);
#endif
int err = avformat_open_input(&ic, _filename, NULL, &dict);
#else
int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
#endif
来源:https://stackoverflow.com/questions/40229086/cant-get-rtsp-stream-nonmatching