Broadcasting an MPEG Program Stream (PS) over RTP using GStreamer. I need to ensure that the RTP packets use a specific payload type (96). Below is the pipeline I am using for broadcasting:
You’re using rtpgstpay or rtpmpvpay on the sender, and rtph264depay on the receiver. That can’t work. You need to use compatible payloaders and depayloaders.
Also you’re putting MPEG-2 into the stream (either in MPEG-PS container or plain elementary stream) but try to get H264 out of the stream. They’re different codecs.
I want to broadcast using the MPEG-2 format, not H264. Is this feasible with my current setup, and what would be the best approach to ensure compatibility?
There’s no RTP payloader for MPEG-PS in GStreamer, only a depayloader (rtpmp1sdepay). You’d have to write (and ideally contribute) a payloader for that, or use a different format.
If it’s video only, you could use rtpmpvpay and rtpmpvdepay which would handle a MPEG-2 video elementary stream.
Also, since the file is an MPEG-PS container you should use filesrc ! mpegpsdemux ! mpegvideoparse, just processing it with an mpegvideoparse might somewhat work if you’re lucky and extract bits of the MPEG-2 video elementary stream at least, but you might get other garbage in between or miss out on data, depends a bit on how the file is muxed.
This is not an answer if your question was about streaming MPEG-PS.
Though, if your use case is just streaming the video content with ability to set payload, as workaround you may stream MP2 TS over RTP.
I just made a quick mpeg ps file (using MPEG-2 System Stream) and the following seems working:
Here using dynamic payload 97 instead of static payload 33 for RTP/MP2T.
Here streaming to localhost, for UDP over LAN you may have to use higher latency.