首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法获得RTSP流-不匹配

无法获得RTSP流-不匹配
EN

Stack Overflow用户
提问于 2016-10-24 23:23:08
回答 1查看 2.9K关注 0票数 2

我正在使用Raspberry Pi3,我正在尝试通过我的无线IP摄像头获取RTSP流,但是我得到了这个错误:

代码语言:javascript
复制
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.

我使用的RTSP链接是: rtsp://192.168.1.230:554/onvif1 1

或与用户:pwd是:

rtsp://2512398:123@192.168.1.230:554/onvif1 1

它在我的alprd.conf中是这样的:

代码语言:javascript
复制
; 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

我可以使用VLC连接(在我的计算机和RPI中),但当我在.conf文件中使用它时,为了使用命令alprd -f开始检查车牌,我得到了这个错误:/

我真的是一个编程新手,所以请不要说得太具体,因为我可能不懂哈哈。

谢谢你们!爱你们都<3

EN

回答 1

Stack Overflow用户

发布于 2018-05-31 07:25:00

OpenCV 3.4.1中,可以将env变量OPENCV_FFMPEG_CAPTURE_OPTIONS更改为"rtsp_transport;0“。

在cap_ffmpeg_impl.hpp中考虑到了这个env。

代码语言:javascript
复制
#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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40229086

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档