Question

I wrote some code that stores on the disk some RTP packets with H264 stream. I would like to be able to extract H264 data from the RTP packets and render that data somewhere to test and see if my code works. How can I do this?

I suppose gstreamer can give me a hand. If I store the packets in a file on the disk, would it be possible using gstreamer to extract, decode and render somewhere? Or to create an h264 video file to play it and see what's inside? Thanks!

Was it helpful?

Solution

Try this to capture RTP stream to file capture.rtp:

gst-launch -v -e \
v4l2src device=/dev/video0 \
    ! x264enc bitrate=200 \
    ! rtph264pay \
    ! filesink location=capture.rtp

and this to decode and render it:

gst-launch -v \
    filesrc location=capture.rtp \
    ! application/x-rtp,media=video,clock-rate=90000,payload=96,encoding-name=H264 \
    ! rtph264depay               \
    ! ffdec_h264                 \
    ! xvimagesink
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top