Always generate video segments from splitmuxsink

Jonas Danielsson jonas.danielsson at spiideo.com
Tue Apr 18 13:40:01 UTC 2023


Hello hackers!

I have a challenge for you!
I want to generate video segments from H264 that arrive over RTSP,
sort of like this:

    udpsrc ! rtpbin ! rtph264depay ! h264parse ! ...

Say, I want 5 seconds segments.
Easy you say! Just use splitmuxsink, something like:

    udpsrc ! rtpbin ! rtph264depay ! h264parse ! splitmuxsink
max-size-time=5000000000

But, then I will add that I want to generate these MP4 segments even
though the source of
this RTP stream restarts, or goes offline, or in another way is flaky.
I always want these segments.

Is there some tricky way of doing this? Some special mp4 way to hook into?
Some dark corner of the h264 spec? Some GStreamer specialité?

So what do I expect to be in them when the source is gone? I am not sure ...
The last frame might be ok, some kind filler frame? sure. Black? I'll take it.

The important part here is I want to always have a N second segment
with a known start-
and stop time. That I can upload to its final destination. I am
substituting a legacy system here so
there are some constraints I need to honor.

And ... I do not want to decode / encode the H264. This is 4k video
and CPU time is money
here.

Do I have any options?
Regards
Jonas


More information about the gstreamer-devel mailing list