Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Injecting/Inserting/Adding H.264 SEI

I would like to embed data into an H.264 stream using User data unregistered SEI messages. What is the easiest or proper way to achieve this in GStreamer?

I found this commit. It inserts SEI messages (of another kind) into the H.264 NAL stream by modifying a GstBuffer, employing a GstByteReader to find a NAL start code etc. I find this quite low level and was hoping to find an easier solution, using GstH264Parser.

Ideally, my data would be added to the RAW video frames using GstMeta before encoding. I would then put another element after the encoder to take my GstMeta data and embed it as SEI messages.

like image 398
micha137 Avatar asked Feb 15 '26 00:02

micha137


1 Answers

Using appsrc and funnel element. Generating SEI and injecting it into appsrc. The whole pipeline is as below.

gst-launch-1.0 funnel name=f \
appsrc ! video/x-h264, stream-format=byte-stream, alignment=au ! queue ! f. \
videotestsrc is-live=true ! x264enc ! video/x-h264, stream-format=byte-stream, alignment=au, profile=baseline ! queue ! f. \
f. ! queue ! h264parse ! video/x-h264, stream-format=byte-stream, alignment=nal ! filesink location=dump.h264

Refer: 【GStreamer】基于NTP+SEI的视频流传输时延测量

like image 66
hexray Avatar answered Feb 18 '26 08:02

hexray



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!