开发者

Decode (and render) H264 RTP packets

开发者 https://www.devze.com 2023-01-26 09:36 出处:网络
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

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 w开发者_StackOverflow社区orks. 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!


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号