2
votes

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)

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.

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?

3

3 Answers

2
votes

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:

$ gst-launch filesrc location=testh264.rtp
    ! pcapparse
    ! application/x-rtp,media=video,clock-rate=90000,payload=123,encoding-name=H264     
    ! rtph264depay ! ffdec_h264
    ! autovideosink
1
votes

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.

0
votes

I see that this post is old but I had the same problem and here is my pipeline that works (using 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.