I have a pcap file containing a capture of RTP with H.264 video and SIP with SDP. I would like to be able to extract the video from the RTP stream and save it to a file. (h264video.mkv or something similar)
我有一个pcap文件,其中包含一个用H.264视频捕获的RTP,以及用SDP捕获的SIP。我希望能够从RTP流中提取视频并将其保存到一个文件中。(h264video。mkv或类似的东西)
I have started looking at gstreamer as a possible solution for this but I'm having trouble troubleshooting any of the output I receive from the program.
我已经开始考虑gstreamer作为一个可能的解决方案,但是我无法排除从程序接收到的任何输出的故障。
gst-launch -v filesrc location=testh264.rtp
! application/x-rtp,media=video,clock-rate=90000,payload=123,encoding-name=H264
! rtph264depay
! ffdec_h264
! xvimagesink
Here is an example of something I've tried but I'm not able to get through rtph264depay because the file I'm sending is of invalid format. What can I do to extract the h264 payload from my pcap file for usage with gstreamer/rtph264depay?
这是我尝试过的一个例子,但是我无法通过rtph264depay,因为我发送的文件格式无效。如何从pcap文件中提取h264有效负载以供gstreamer/rtph264depay使用?
3 个解决方案
#1
2
The problem is that pcap file does not contain raw RTP payload, it is somehow formatted (here is how).
You can extract raw data with pcapparse plugin:
问题是pcap文件不包含原始的RTP负载,它以某种方式格式化(如下所示)。可以使用pcapparse插件提取原始数据:
$ gst-launch filesrc location=testh264.rtp
! pcapparse
! application/x-rtp,media=video,clock-rate=90000,payload=123,encoding-name=H264
! rtph264depay ! ffdec_h264
! autovideosink
#2
1
You should have autovideosink available which will automatically select the correct video sink for you. Otherwise, it is probably something like "dshowsink". Try gst-inspect
while grepping it for dshow or directshow and it should tell you what to use.
您应该有autovideosink可用,它将自动为您选择正确的视频接收器。否则,它可能就像“dshowsink”。在为dshow或directshow加油时尝试gst-inspect,它应该告诉您使用什么。
#3
0
I see that this post is old but I had the same problem and here is my pipeline that works (using gstreamer-1.0):
我看到这篇文章很旧,但我也有同样的问题,这是我的流水线(使用gstreamer-1.0):
C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe -m -v filesrc location=C:/Work/log.pcap ! pcapparse src-port=7000 caps="application/x-rtp,media=video,payload=96,clock-rate=90000,encoding-name=H264,profile-level-id=4d0029,sprop-parameter-sets=\"Z00AKeKQFoe2BqwYBBuHiRFQ,aO48gA==\"" ! rtph264depay ! video/x-h264, width=740, height=480, framerate=(fraction)15/1 ! avdec_h264 ! avimux ! filesink location=C:/Work/out.avi
The sprop-parameter-sets I got from the SDP file for the camera that sent the rtp stream.
我从SDP文件中获得的用于发送rtp流的相机的sprop参数集。
#1
2
The problem is that pcap file does not contain raw RTP payload, it is somehow formatted (here is how).
You can extract raw data with pcapparse plugin:
问题是pcap文件不包含原始的RTP负载,它以某种方式格式化(如下所示)。可以使用pcapparse插件提取原始数据:
$ gst-launch filesrc location=testh264.rtp
! pcapparse
! application/x-rtp,media=video,clock-rate=90000,payload=123,encoding-name=H264
! rtph264depay ! ffdec_h264
! autovideosink
#2
1
You should have autovideosink available which will automatically select the correct video sink for you. Otherwise, it is probably something like "dshowsink". Try gst-inspect
while grepping it for dshow or directshow and it should tell you what to use.
您应该有autovideosink可用,它将自动为您选择正确的视频接收器。否则,它可能就像“dshowsink”。在为dshow或directshow加油时尝试gst-inspect,它应该告诉您使用什么。
#3
0
I see that this post is old but I had the same problem and here is my pipeline that works (using gstreamer-1.0):
我看到这篇文章很旧,但我也有同样的问题,这是我的流水线(使用gstreamer-1.0):
C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe -m -v filesrc location=C:/Work/log.pcap ! pcapparse src-port=7000 caps="application/x-rtp,media=video,payload=96,clock-rate=90000,encoding-name=H264,profile-level-id=4d0029,sprop-parameter-sets=\"Z00AKeKQFoe2BqwYBBuHiRFQ,aO48gA==\"" ! rtph264depay ! video/x-h264, width=740, height=480, framerate=(fraction)15/1 ! avdec_h264 ! avimux ! filesink location=C:/Work/out.avi
The sprop-parameter-sets I got from the SDP file for the camera that sent the rtp stream.
我从SDP文件中获得的用于发送rtp流的相机的sprop参数集。