尝试仅将 RTSP 流中的元数据保存到文件中
我正在尝试从IP摄像头访问并保存元数据流。
到目前为止,我已经设法保存了元数据:
openRTSP -b 400000 -K -t rtsp://username:[email protected]:5554/live/ch1
这将创建一个元数据文件application-vnd.onvif.metadata-2
(下面的示例),但是这也会流式传输视频文件并将其保存到:当前目录中的Video-H264-1 。 我很想不流式传输视频数据,因为我没有用,带宽是多个流的问题。
元数据示例
user@server:~# tail -n 1 application-VND.ONVIF.METADATA-2
<tt:MetadataStream xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"><tt:VideoAnalytics><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39242"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.949999988079071" top="0.0" right="0.981249988079071" bottom="0.251800000667572"/><tt:CenterOfGravity x="0.965624988079071" y="0.125900000333786"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.47999998927116394</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39283"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.21143999695777893" top="0.2988300025463104" right="0.33105000853538513" bottom="0.9925199747085571"/><tt:CenterOfGravity x="0.27124500274658203" y="0.6456749886274338"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.4699999988079071</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39287"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.20412999391555786" top="0.28610000014305115" right="0.33774998784065247" bottom="0.6600499749183655"/><tt:CenterOfGravity x="0.27093999087810516" y="0.4730749875307083"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.23000000417232513</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39288"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.6440899968147278" top="0.0" right="0.7041800022125244" bottom="0.19472000002861023"/><tt:CenterOfGravity x="0.6741349995136261" y="0.09736000001430511"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.18000000715255737</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39289"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.29583001136779785" top="0.30309998989105225" right="0.4729200005531311" bottom="0.7376400232315063"/><tt:CenterOfGravity x="0.3843750059604645" y="0.5203700065612793"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.18000000715255737</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame></tt:VideoAnalytics></tt:MetadataStream>
几乎可用的
user@server:~# openRTSP -b 400000 -K -t rtsp://username:[email protected]:5554/live/ch1
stdout:
Created new TCP socket 3 for connection
Connecting to 192.168.2.4, port 5554 on socket 3...
...remote connection opened
Sending request: OPTIONS rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 2
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Received 115 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
Sending request: DESCRIBE rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 3
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Accept: application/sdp
Received 156 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 401 Unauthorized
CSeq: 3
WWW-Authenticate: Digest realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a"
Resending...
Sending request: DESCRIBE rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 4
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="6b90e55e0af2db247e4ea2c674e58b38"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Accept: application/sdp
Received 592 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 4
Content-Base: rtsp://username:[email protected]:5554/live/ch1
Content-Type: application/sdp
Content-Length: 447
v=0
o=- 1 1 IN IP4 192.168.2.4
s=Media Server
t=0 0
a=type:broadcast
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z0IAKpY1QPAET8s3BQEFAg==,aM48gA==
a=control:rtsp://username:[email protected]:5554/live/ch1/video
m=application 0 RTP/AVP 97
a=rtpmap:97 VND.ONVIF.METADATA/8000
a=control:rtsp://username:[email protected]:5554/live/ch1/meta
Opened URL "rtsp://username:[email protected]:5554/live/ch1", returning a SDP description:
v=0
o=- 1 1 IN IP4 192.168.2.4
s=Media Server
t=0 0
a=type:broadcast
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z0IAKpY1QPAET8s3BQEFAg==,aM48gA==
a=control:rtsp://username:[email protected]:5554/live/ch1/video
m=application 0 RTP/AVP 97
a=rtpmap:97 VND.ONVIF.METADATA/8000
a=control:rtsp://username:[email protected]:5554/live/ch1/meta
Created receiver for "video/H264" subsession (client ports 41390-41391)
Created receiver for "application/VND.ONVIF.METADATA" subsession (client ports 54122-54123)
Sending request: SETUP rtsp://username:[email protected]:5554/live/ch1/video RTSP/1.0
CSeq: 5
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="a7a7d51269283cd92b37e41dd8889109"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Received 128 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 5
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Session: 05EB326D3901E880B71E1370F83E85;timeout=60
Setup "video/H264" subsession (client ports 41390-41391)
Sending request: SETUP rtsp://username:[email protected]:5554/live/ch1/meta RTSP/1.0
CSeq: 6
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="a7a7d51269283cd92b37e41dd8889109"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
Session: 05EB326D3901E880B71E1370F83E85
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 6
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
Session: 05EB326D3901E880B71E1370F83E85;timeout=60
Setup "application/VND.ONVIF.METADATA" subsession (client ports 54122-54123)
Created output file: "video-H264-1"
Created output file: "application-VND.ONVIF.METADATA-2"
Sending request: PLAY rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 7
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="b7bf5ee1ed4dab7afcb85bede5e7e785"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Session: 05EB326D3901E880B71E1370F83E85
Range: npt=0.000-
Received a complete PLAY response:
RTSP/1.0 200 OK
CSeq: 7
Session: 05EB326D3901E880B71E1370F83E85
Range: clock=20220402T065513.225Z-
RTP-Info: url=rtsp://username:[email protected]:5554/live/ch1/video?;seq=29232;rtptime=2063989750,url=rtsp://username:[email protected]:5554/live/ch1/meta?;seq=29232;rtptime=2070061960
Started playing session
Receiving streamed data (signal with "kill -HUP 492099" or "kill -USR1 492099" to terminate)...
^C
流发现了
user@server:~# gst-discoverer-1.0 -v -t 60 rtsp://username:[email protected]:5554/live/ch3
Done discovering rtsp://username:[email protected]:5554/live/ch1
Analyzing URI timed out
Topology:
container: application/rtsp
unknown: application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, packetization-mode=(string)1, profile-level-id=(string)64001F, sprop-parameter-sets=(string)"Z0IAKpY1QPAET8s3BQEFAg\=\=\,aM48gA\=\=", a-type=(string)broadcast, npt-start=(guint64)23571980000000, play-speed=(double)1, play-scale=(double)1, ssrc=(uint)1304347240
video: video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0142002affe100106742002a963540f0044fcb370501050201000468ce3c80, level=(string)4.2, profile=(string)baseline, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
Tags:
video codec: H.264 (Baseline Profile)
Codec:
video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0142002affe100106742002a963540f0044fcb370501050201000468ce3c80, level=(string)4.2, profile=(string)baseline, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
Additional info:
None
Stream ID: b71011accfcd9e6ac1d42a60b4611071674cf9321b63a6b8cc4a6b480fca3e9f/0/video:0:0:RTP:AVP:96
Width: 1920
Height: 1080
Depth: 24
Frame rate: 0/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0
Properties:
Duration: 99:99:99.999999999
Seekable: no
Live: yes
Tags:
video codec: H.264 (Baseline Profile)
此处的信息,我只能访问元数据吗?
我尝试过的其他事情。
gst-launch-1.0 rtspsrc location=rtsp://username:[email protected]:5554/live/ch3 ! application/x-rtp, media=application ! fakesink dump=true >> cap.xml
这将创建具有一些编码的元数据的Cap.xml文件。我相信这也流了视频数据,因此编码不是理想的。它也倾向于定期死亡。
cap.xml样本
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://username:[email protected]:5554/live/ch3
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.
Additional debug info:
gstrtspsrc.c(5768): gst_rtspsrc_reconnect (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive any UDP packets for 5.0000 seconds, maybe your firewall is blocking it. Retrying using a tcp connection.
00000000 (0x7f85bc009cf0): 80 e1 72 31 84 de b4 2e 5e 65 1d 2c 3c 74 74 3a ..r1....^e.,<tt:
00000010 (0x7f85bc009d00): 4d 65 74 61 64 61 74 61 53 74 72 65 61 6d 20 78 MetadataStream x
00000020 (0x7f85bc009d10): 6d 6c 6e 73 3a 74 74 3d 22 68 74 74 70 3a 2f 2f mlns:tt="http://
00000030 (0x7f85bc009d20): 77 77 77 2e 6f 6e 76 69 66 2e 6f 72 67 2f 76 65 www.onvif.org/ve
00000040 (0x7f85bc009d30): 72 31 30 2f 73 63 68 65 6d 61 22 20 78 6d 6c 6e r10/schema" xmln
00000050 (0x7f85bc009d40): 73 3a 77 73 6e 74 3d 22 68 74 74 70 3a 2f 2f 64 s:wsnt="http://d
00000060 (0x7f85bc009d50): 6f 63 73 2e 6f 61 73 69 73 2d 6f 70 65 6e 2e 6f ocs.oasis-open.o
00000070 (0x7f85bc009d60): 72 67 2f 77 73 6e 2f 62 2d 32 22 3e 3c 74 74 3a rg/wsn/b-2"><tt:
00000080 (0x7f85bc009d70): 56 69 64 65 6f 41 6e 61 6c 79 74 69 63 73 3e 3c VideoAnalytics><
00000090 (0x7f85bc009d80): 74 74 3a 46 72 61 6d 65 20 55 74 63 54 69 6d 65 tt:Frame UtcTime
000000a0 (0x7f85bc009d90): 3d 22 32 30 32 32 2d 30 34 2d 30 32 54 30 37 3a ="2022-04-02T07:
000000b0 (0x7f85bc009da0): 32 34 3a 34 31 2e 36 33 30 30 30 30 22 3e 3c 74 24:41.630000"><t
000000c0 (0x7f85bc009db0): 74 3a 54 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e t:Transformation
000000d0 (0x7f85bc009dc0): 3e 3c 74 74 3a 54 72 61 6e 73 6c 61 74 65 20 78 ><tt:Translate x
000000e0 (0x7f85bc009dd0): 3d 22 2d 31 2e 30 22 20 79 3d 22 31 2e 30 22 2f ="-1.0" y="1.0"/
000000f0 (0x7f85bc009de0): 3e 3c 74 74 3a 53 63 61 6c 65 20 78 3d 22 32 2e ><tt:Scale x="2.
00000100 (0x7f85bc009df0): 30 22 20 79 3d 22 2d 32 2e 30 22 2f 3e 3c 2f 74 0" y="-2.0"/></t
00000110 (0x7f85bc009e00): 74 3a 54 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e t:Transformation
00000120 (0x7f85bc009e10): 3e 3c 74 74 3a 4f 62 6a 65 63 74 20 4f 62 6a 65 ><tt:Object Obje
00000130 (0x7f85bc009e20): 63 74 49 64 3d 22 32 30 30 39 34 33 22 3e 3c 74 ctId="200943"><t
00000140 (0x7f85bc009e30): 74 3a 41 70 70 65 61 72 61 6e 63 65 3e 3c 74 74 t:Appearance><tt
00000150 (0x7f85bc009e40): 3a 53 68 61 70 65 3e 3c 74 74 3a 42 6f 75 6e 64 :Shape><tt:Bound
00000160 (0x7f85bc009e50): 69 6e 67 42 6f 78 20 6c 65 66 74 3d 22 30 2e 32 ingBox left="0.2
00000170 (0x7f85bc009e60): 39 33 30 34 39 39 39 31 31 33 30 38 32 38 38 36 9304999113082886
00000180 (0x7f85bc009e70): 22 20 74 6f 70 3d 22 30 2e 38 30 33 34 36 30 30 " top="0.8034600
00000190 (0x7f85bc009e80): 30 31 39 34 35 34 39 35 36 22 20 72 69 67 68 74 019454956" right
000001a0 (0x7f85bc009e90): 3d 22 30 2e 33 37 30 36 36 30 30 30 36 39 39 39 ="0.370660006999
000001b0 (0x7f85bc009ea0): 39 36 39 35 22 20 62 6f 74 74 6f 6d 3d 22 30 2e 9695" bottom="0.
000001c0 (0x7f85bc009eb0): 39 38 31 36 37 30 30 32 32 30 31 30 38 30 33 32 9816700220108032
000001d0 (0x7f85bc009ec0): 22 2f 3e 3c 74 74 3a 43 65 6e 74 65 72 4f 66 47 "/><tt:CenterOfG
000001e0 (0x7f85bc009ed0): 72 61 76 69 74 79 20 78 3d 22 30 2e 33 33 31 38 ravity x="0.3318
000001f0 (0x7f85bc009ee0): 35 34 39 39 39 30 36 35 33 39 39 31 37 22 20 79 5499906539917" y
00000200 (0x7f85bc009ef0): 3d 22 30 2e 38 39 32 35 36 35 30 31 31 39 37 38 ="0.892565011978
00000210 (0x7f85bc009f00): 31 34 39 34 22 2f 3e 3c 2f 74 74 3a 53 68 61 70 1494"/></tt:Shap
00000220 (0x7f85bc009f10): 65 3e 3c 74 74 3a 43 6c 61 73 73 3e 3c 74 74 3a e><tt:Class><tt:
00000230 (0x7f85bc009f20): 43 6c 61 73 73 43 61 6e 64 69 64 61 74 65 3e 3c ClassCandidate><
00000240 (0x7f85bc009f30): 74 74 3a 54 79 70 65 3e 50 65 72 73 6f 6e 3c 2f tt:Type>Person</
00000250 (0x7f85bc009f40): 74 74 3a 54 79 70 65 3e 3c 74 74 3a 4c 69 6b 65 tt:Type><tt:Like
00000260 (0x7f85bc009f50): 6c 69 68 6f 6f 64 3e 30 2e 31 37 30 30 30 30 30 lihood>0.1700000
00000270 (0x7f85bc009f60): 30 31 37 38 38 31 33 39 33 34 3c 2f 74 74 3a 4c 0178813934</tt:L
00000280 (0x7f85bc009f70): 69 6b 65 6c 69 68 6f 6f 64 3e 3c 2f 74 74 3a 43 ikelihood></tt:C
00000290 (0x7f85bc009f80): 6c 61 73 73 43 61 6e 64 69 64 61 74 65 3e 3c 2f lassCandidate></
000002a0 (0x7f85bc009f90): 74 74 3a 43 6c 61 73 73 3e 3c 2f 74 74 3a 41 70 tt:Class></tt:Ap
000002b0 (0x7f85bc009fa0): 70 65 61 72 61 6e 63 65 3e 3c 2f 74 74 3a 4f 62 pearance></tt:Ob
000002c0 (0x7f85bc009fb0): 6a 65 63 74 3e 3c 2f 74 74 3a 46 72 61 6d 65 3e ject></tt:Frame>
000002d0 (0x7f85bc009fc0): 3c 2f 74 74 3a 56 69 64 65 6f 41 6e 61 6c 79 74 </tt:VideoAnalyt
000002e0 (0x7f85bc009fd0): 69 63 73 3e 3c 2f 74 74 3a 4d 65 74 61 64 61 74 ics></tt:Metadat
000002f0 (0x7f85bc009fe0): 61 53 74 72 65 61 6d 3e 0d 0a 0d 0a 00 aStream>.....
00000000 (0x7f85d8077450): 80 e1 72 32 84 de b4 2e 5e 65 1d 2c 3c 74 74 3a ..r2....^e.,<tt:
I'm attempting to access and save the metadata stream from an IP camera.
So far I have managed to save the metadata with:
openRTSP -b 400000 -K -t rtsp://username:[email protected]:5554/live/ch1
This creates a metadata file application-VND.ONVIF.METADATA-2
(sample below) however this also streams the video file and saves it to: video-H264-1
in the current directory.
I would much prefer not to stream the video data as I have no use for it and bandwidth is an issue with multiple streams.
Metadata Sample
user@server:~# tail -n 1 application-VND.ONVIF.METADATA-2
<tt:MetadataStream xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"><tt:VideoAnalytics><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39242"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.949999988079071" top="0.0" right="0.981249988079071" bottom="0.251800000667572"/><tt:CenterOfGravity x="0.965624988079071" y="0.125900000333786"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.47999998927116394</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39283"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.21143999695777893" top="0.2988300025463104" right="0.33105000853538513" bottom="0.9925199747085571"/><tt:CenterOfGravity x="0.27124500274658203" y="0.6456749886274338"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.4699999988079071</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39287"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.20412999391555786" top="0.28610000014305115" right="0.33774998784065247" bottom="0.6600499749183655"/><tt:CenterOfGravity x="0.27093999087810516" y="0.4730749875307083"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.23000000417232513</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39288"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.6440899968147278" top="0.0" right="0.7041800022125244" bottom="0.19472000002861023"/><tt:CenterOfGravity x="0.6741349995136261" y="0.09736000001430511"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.18000000715255737</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame><tt:Frame UtcTime="2022-04-02T06:55:13.577000"><tt:Transformation><tt:Translate x="-1.0" y="1.0"/><tt:Scale x="2.0" y="-2.0"/></tt:Transformation><tt:Object ObjectId="39289"><tt:Appearance><tt:Shape><tt:BoundingBox left="0.29583001136779785" top="0.30309998989105225" right="0.4729200005531311" bottom="0.7376400232315063"/><tt:CenterOfGravity x="0.3843750059604645" y="0.5203700065612793"/></tt:Shape><tt:Class><tt:ClassCandidate><tt:Type>Person</tt:Type><tt:Likelihood>0.18000000715255737</tt:Likelihood></tt:ClassCandidate></tt:Class></tt:Appearance></tt:Object></tt:Frame></tt:VideoAnalytics></tt:MetadataStream>
Almost usable
user@server:~# openRTSP -b 400000 -K -t rtsp://username:[email protected]:5554/live/ch1
STDOUT:
Created new TCP socket 3 for connection
Connecting to 192.168.2.4, port 5554 on socket 3...
...remote connection opened
Sending request: OPTIONS rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 2
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Received 115 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
Sending request: DESCRIBE rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 3
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Accept: application/sdp
Received 156 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 401 Unauthorized
CSeq: 3
WWW-Authenticate: Digest realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a"
Resending...
Sending request: DESCRIBE rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 4
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="6b90e55e0af2db247e4ea2c674e58b38"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Accept: application/sdp
Received 592 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 4
Content-Base: rtsp://username:[email protected]:5554/live/ch1
Content-Type: application/sdp
Content-Length: 447
v=0
o=- 1 1 IN IP4 192.168.2.4
s=Media Server
t=0 0
a=type:broadcast
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z0IAKpY1QPAET8s3BQEFAg==,aM48gA==
a=control:rtsp://username:[email protected]:5554/live/ch1/video
m=application 0 RTP/AVP 97
a=rtpmap:97 VND.ONVIF.METADATA/8000
a=control:rtsp://username:[email protected]:5554/live/ch1/meta
Opened URL "rtsp://username:[email protected]:5554/live/ch1", returning a SDP description:
v=0
o=- 1 1 IN IP4 192.168.2.4
s=Media Server
t=0 0
a=type:broadcast
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z0IAKpY1QPAET8s3BQEFAg==,aM48gA==
a=control:rtsp://username:[email protected]:5554/live/ch1/video
m=application 0 RTP/AVP 97
a=rtpmap:97 VND.ONVIF.METADATA/8000
a=control:rtsp://username:[email protected]:5554/live/ch1/meta
Created receiver for "video/H264" subsession (client ports 41390-41391)
Created receiver for "application/VND.ONVIF.METADATA" subsession (client ports 54122-54123)
Sending request: SETUP rtsp://username:[email protected]:5554/live/ch1/video RTSP/1.0
CSeq: 5
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="a7a7d51269283cd92b37e41dd8889109"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Received 128 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 5
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Session: 05EB326D3901E880B71E1370F83E85;timeout=60
Setup "video/H264" subsession (client ports 41390-41391)
Sending request: SETUP rtsp://username:[email protected]:5554/live/ch1/meta RTSP/1.0
CSeq: 6
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="a7a7d51269283cd92b37e41dd8889109"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
Session: 05EB326D3901E880B71E1370F83E85
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 6
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
Session: 05EB326D3901E880B71E1370F83E85;timeout=60
Setup "application/VND.ONVIF.METADATA" subsession (client ports 54122-54123)
Created output file: "video-H264-1"
Created output file: "application-VND.ONVIF.METADATA-2"
Sending request: PLAY rtsp://username:[email protected]:5554/live/ch1 RTSP/1.0
CSeq: 7
Authorization: Digest username="username", realm="ITX_VABOX", nonce="6247f394ff1fb1c1acaa90dcfec31e506cf149052cad069b41fb45a9b913e69a", uri="rtsp://username:[email protected]:5554/live/ch1", response="b7bf5ee1ed4dab7afcb85bede5e7e785"
User-Agent: openRTSP (LIVE555 Streaming Media v2020.01.19)
Session: 05EB326D3901E880B71E1370F83E85
Range: npt=0.000-
Received a complete PLAY response:
RTSP/1.0 200 OK
CSeq: 7
Session: 05EB326D3901E880B71E1370F83E85
Range: clock=20220402T065513.225Z-
RTP-Info: url=rtsp://username:[email protected]:5554/live/ch1/video?;seq=29232;rtptime=2063989750,url=rtsp://username:[email protected]:5554/live/ch1/meta?;seq=29232;rtptime=2070061960
Started playing session
Receiving streamed data (signal with "kill -HUP 492099" or "kill -USR1 492099" to terminate)...
^C
Stream Discovery
user@server:~# gst-discoverer-1.0 -v -t 60 rtsp://username:[email protected]:5554/live/ch3
Done discovering rtsp://username:[email protected]:5554/live/ch1
Analyzing URI timed out
Topology:
container: application/rtsp
unknown: application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, packetization-mode=(string)1, profile-level-id=(string)64001F, sprop-parameter-sets=(string)"Z0IAKpY1QPAET8s3BQEFAg\=\=\,aM48gA\=\=", a-type=(string)broadcast, npt-start=(guint64)23571980000000, play-speed=(double)1, play-scale=(double)1, ssrc=(uint)1304347240
video: video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0142002affe100106742002a963540f0044fcb370501050201000468ce3c80, level=(string)4.2, profile=(string)baseline, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
Tags:
video codec: H.264 (Baseline Profile)
Codec:
video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0142002affe100106742002a963540f0044fcb370501050201000468ce3c80, level=(string)4.2, profile=(string)baseline, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
Additional info:
None
Stream ID: b71011accfcd9e6ac1d42a60b4611071674cf9321b63a6b8cc4a6b480fca3e9f/0/video:0:0:RTP:AVP:96
Width: 1920
Height: 1080
Depth: 24
Frame rate: 0/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0
Properties:
Duration: 99:99:99.999999999
Seekable: no
Live: yes
Tags:
video codec: H.264 (Baseline Profile)
Given the information here is there any way I access only the metadata?
Other things I've tried.
gst-launch-1.0 rtspsrc location=rtsp://username:[email protected]:5554/live/ch3 ! application/x-rtp, media=application ! fakesink dump=true >> cap.xml
This creates cap.xml file with somewhat encoded metadata. I believe this also streams the video data so that and the encoding is not ideal. It also tends to die periodically.
cap.xml sample
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://username:[email protected]:5554/live/ch3
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.
Additional debug info:
gstrtspsrc.c(5768): gst_rtspsrc_reconnect (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive any UDP packets for 5.0000 seconds, maybe your firewall is blocking it. Retrying using a tcp connection.
00000000 (0x7f85bc009cf0): 80 e1 72 31 84 de b4 2e 5e 65 1d 2c 3c 74 74 3a ..r1....^e.,<tt:
00000010 (0x7f85bc009d00): 4d 65 74 61 64 61 74 61 53 74 72 65 61 6d 20 78 MetadataStream x
00000020 (0x7f85bc009d10): 6d 6c 6e 73 3a 74 74 3d 22 68 74 74 70 3a 2f 2f mlns:tt="http://
00000030 (0x7f85bc009d20): 77 77 77 2e 6f 6e 76 69 66 2e 6f 72 67 2f 76 65 www.onvif.org/ve
00000040 (0x7f85bc009d30): 72 31 30 2f 73 63 68 65 6d 61 22 20 78 6d 6c 6e r10/schema" xmln
00000050 (0x7f85bc009d40): 73 3a 77 73 6e 74 3d 22 68 74 74 70 3a 2f 2f 64 s:wsnt="http://d
00000060 (0x7f85bc009d50): 6f 63 73 2e 6f 61 73 69 73 2d 6f 70 65 6e 2e 6f ocs.oasis-open.o
00000070 (0x7f85bc009d60): 72 67 2f 77 73 6e 2f 62 2d 32 22 3e 3c 74 74 3a rg/wsn/b-2"><tt:
00000080 (0x7f85bc009d70): 56 69 64 65 6f 41 6e 61 6c 79 74 69 63 73 3e 3c VideoAnalytics><
00000090 (0x7f85bc009d80): 74 74 3a 46 72 61 6d 65 20 55 74 63 54 69 6d 65 tt:Frame UtcTime
000000a0 (0x7f85bc009d90): 3d 22 32 30 32 32 2d 30 34 2d 30 32 54 30 37 3a ="2022-04-02T07:
000000b0 (0x7f85bc009da0): 32 34 3a 34 31 2e 36 33 30 30 30 30 22 3e 3c 74 24:41.630000"><t
000000c0 (0x7f85bc009db0): 74 3a 54 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e t:Transformation
000000d0 (0x7f85bc009dc0): 3e 3c 74 74 3a 54 72 61 6e 73 6c 61 74 65 20 78 ><tt:Translate x
000000e0 (0x7f85bc009dd0): 3d 22 2d 31 2e 30 22 20 79 3d 22 31 2e 30 22 2f ="-1.0" y="1.0"/
000000f0 (0x7f85bc009de0): 3e 3c 74 74 3a 53 63 61 6c 65 20 78 3d 22 32 2e ><tt:Scale x="2.
00000100 (0x7f85bc009df0): 30 22 20 79 3d 22 2d 32 2e 30 22 2f 3e 3c 2f 74 0" y="-2.0"/></t
00000110 (0x7f85bc009e00): 74 3a 54 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e t:Transformation
00000120 (0x7f85bc009e10): 3e 3c 74 74 3a 4f 62 6a 65 63 74 20 4f 62 6a 65 ><tt:Object Obje
00000130 (0x7f85bc009e20): 63 74 49 64 3d 22 32 30 30 39 34 33 22 3e 3c 74 ctId="200943"><t
00000140 (0x7f85bc009e30): 74 3a 41 70 70 65 61 72 61 6e 63 65 3e 3c 74 74 t:Appearance><tt
00000150 (0x7f85bc009e40): 3a 53 68 61 70 65 3e 3c 74 74 3a 42 6f 75 6e 64 :Shape><tt:Bound
00000160 (0x7f85bc009e50): 69 6e 67 42 6f 78 20 6c 65 66 74 3d 22 30 2e 32 ingBox left="0.2
00000170 (0x7f85bc009e60): 39 33 30 34 39 39 39 31 31 33 30 38 32 38 38 36 9304999113082886
00000180 (0x7f85bc009e70): 22 20 74 6f 70 3d 22 30 2e 38 30 33 34 36 30 30 " top="0.8034600
00000190 (0x7f85bc009e80): 30 31 39 34 35 34 39 35 36 22 20 72 69 67 68 74 019454956" right
000001a0 (0x7f85bc009e90): 3d 22 30 2e 33 37 30 36 36 30 30 30 36 39 39 39 ="0.370660006999
000001b0 (0x7f85bc009ea0): 39 36 39 35 22 20 62 6f 74 74 6f 6d 3d 22 30 2e 9695" bottom="0.
000001c0 (0x7f85bc009eb0): 39 38 31 36 37 30 30 32 32 30 31 30 38 30 33 32 9816700220108032
000001d0 (0x7f85bc009ec0): 22 2f 3e 3c 74 74 3a 43 65 6e 74 65 72 4f 66 47 "/><tt:CenterOfG
000001e0 (0x7f85bc009ed0): 72 61 76 69 74 79 20 78 3d 22 30 2e 33 33 31 38 ravity x="0.3318
000001f0 (0x7f85bc009ee0): 35 34 39 39 39 30 36 35 33 39 39 31 37 22 20 79 5499906539917" y
00000200 (0x7f85bc009ef0): 3d 22 30 2e 38 39 32 35 36 35 30 31 31 39 37 38 ="0.892565011978
00000210 (0x7f85bc009f00): 31 34 39 34 22 2f 3e 3c 2f 74 74 3a 53 68 61 70 1494"/></tt:Shap
00000220 (0x7f85bc009f10): 65 3e 3c 74 74 3a 43 6c 61 73 73 3e 3c 74 74 3a e><tt:Class><tt:
00000230 (0x7f85bc009f20): 43 6c 61 73 73 43 61 6e 64 69 64 61 74 65 3e 3c ClassCandidate><
00000240 (0x7f85bc009f30): 74 74 3a 54 79 70 65 3e 50 65 72 73 6f 6e 3c 2f tt:Type>Person</
00000250 (0x7f85bc009f40): 74 74 3a 54 79 70 65 3e 3c 74 74 3a 4c 69 6b 65 tt:Type><tt:Like
00000260 (0x7f85bc009f50): 6c 69 68 6f 6f 64 3e 30 2e 31 37 30 30 30 30 30 lihood>0.1700000
00000270 (0x7f85bc009f60): 30 31 37 38 38 31 33 39 33 34 3c 2f 74 74 3a 4c 0178813934</tt:L
00000280 (0x7f85bc009f70): 69 6b 65 6c 69 68 6f 6f 64 3e 3c 2f 74 74 3a 43 ikelihood></tt:C
00000290 (0x7f85bc009f80): 6c 61 73 73 43 61 6e 64 69 64 61 74 65 3e 3c 2f lassCandidate></
000002a0 (0x7f85bc009f90): 74 74 3a 43 6c 61 73 73 3e 3c 2f 74 74 3a 41 70 tt:Class></tt:Ap
000002b0 (0x7f85bc009fa0): 70 65 61 72 61 6e 63 65 3e 3c 2f 74 74 3a 4f 62 pearance></tt:Ob
000002c0 (0x7f85bc009fb0): 6a 65 63 74 3e 3c 2f 74 74 3a 46 72 61 6d 65 3e ject></tt:Frame>
000002d0 (0x7f85bc009fc0): 3c 2f 74 74 3a 56 69 64 65 6f 41 6e 61 6c 79 74 </tt:VideoAnalyt
000002e0 (0x7f85bc009fd0): 69 63 73 3e 3c 2f 74 74 3a 4d 65 74 61 64 61 74 ics></tt:Metadat
000002f0 (0x7f85bc009fe0): 61 53 74 72 65 61 6d 3e 0d 0a 0d 0a 00 aStream>.....
00000000 (0x7f85d8077450): 80 e1 72 32 84 de b4 2e 5e 65 1d 2c 3c 74 74 3a ..r2....^e.,<tt:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自此链接:
From this link, as stated in the comments above: