detectnet 可以直接打开rtsp网络摄像头作为输入源,进行实时视频分析,在监控领域有非常大的应用。
尝试了下打开rtmp流,没有成功,返回说不支持。
从日志输出来看是使用GStreamer。
1 2 3 4 5 6 7 8 9 |
[gstreamer] gstDecoder -- unsupported protocol (rtmp) [gstreamer] supported protocols are: [gstreamer] * file:// [gstreamer] * rtp:// [gstreamer] * rtsp:// [gstreamer] gstDecoder -- failed to build pipeline string [gstreamer] gstDecoder -- failed to create decoder for rtmp://192.168.0.2/live/bbb detectnet: failed to create input stream |
如果是GStreamer,那当然应该支持rtmp才对。打开并修改源码
jetson-inference/utils/codec/gstDecoder.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
else if( uri.protocol == "rtsp" ) { ss << "rtspsrc location=" << uri.string; //ss << " latency=200 drop-on-latency=true"; ss << " ! queue ! "; if( mOptions.codec == videoOptions::CODEC_H264 ) ss << "rtph264depay ! h264parse ! "; else if( mOptions.codec == videoOptions::CODEC_H265 ) ss << "rtph265depay ! h265parse ! "; else if( mOptions.codec == videoOptions::CODEC_VP8 ) ss << "rtpvp8depay ! "; else if( mOptions.codec == videoOptions::CODEC_VP9 ) ss << "rtpvp9depay ! "; else if( mOptions.codec == videoOptions::CODEC_MPEG2 ) ss << "rtpmp2tdepay ! "; // MP2T-ES else if( mOptions.codec == videoOptions::CODEC_MPEG4 ) ss << "rtpmp4vdepay ! "; // rtpmp4gdepay else if( mOptions.codec == videoOptions::CODEC_MJPEG ) ss << "rtpjpegdepay ! "; mOptions.deviceType = videoOptions::DEVICE_IP; } else if( uri.protocol == "rtmp" ) { ss << "rtmpsrc location=" << uri.string; //ss << " latency=200 drop-on-latency=true"; ss << " ! queue ! "; ss << "flvdemux ! "; if( mOptions.codec == videoOptions::CODEC_H264 ) ss << "h264parse ! "; else if( mOptions.codec == videoOptions::CODEC_H265 ) ss << "h265parse ! "; // else if( mOptions.codec == videoOptions::CODEC_VP8 ) // ss << "rtpvp8depay ! "; // else if( mOptions.codec == videoOptions::CODEC_VP9 ) // ss << "rtpvp9depay ! "; // else if( mOptions.codec == videoOptions::CODEC_MPEG2 ) // ss << "rtpmp2tdepay ! "; // MP2T-ES // else if( mOptions.codec == videoOptions::CODEC_MPEG4 ) // ss << "rtpmp4vdepay ! "; // rtpmp4gdepay // else if( mOptions.codec == videoOptions::CODEC_MJPEG ) // ss << "rtpjpegdepay ! "; mOptions.deviceType = videoOptions::DEVICE_IP; } else { LogError(LOG_GSTREAMER "gstDecoder -- unsupported protocol (%s)\n", uri.protocol.c_str()); LogError(LOG_GSTREAMER " supported protocols are:\n"); LogError(LOG_GSTREAMER " * file://\n"); LogError(LOG_GSTREAMER " * rtp://\n"); LogError(LOG_GSTREAMER " * rtsp://\n"); LogError(LOG_GSTREAMER " * rtmp://\n"); return false; } |
RTMP协议本身是不支持H265的,NMS, NMC和NodePlayer.js等通过对flv协议扩展支持了H265,这会在GStreamer原版上改动较大。
因此,下阶段将全力开发NMSv3输出rtsp流。则能直接支持H265,并且Jetson等无需改动即可接入NMS。
原创文章,转载请注明: 转载自贝壳博客
本文链接地址: Jetson 把玩记 三、rtmp直播流物体识别定位