-
Notifications
You must be signed in to change notification settings - Fork 2k
Add MPEG-TS passthrough support to recorder #4669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add MPEG-TS passthrough support to recorder #4669
Conversation
68ac82b to
42d2224
Compare
42d2224 to
becf295
Compare
|
@aler9 I think this is in a stable state now, tests are passing locally and I've had internal reviews. Let me know if you agree with this approach to add the functionality, we know of at least 2 of our customers that were attempting to use MediaMTX in this manner and were being blocked. |
- Detect MPEG-TS format in RTSP streams - Implement passthrough mode to write MPEG-TS packets directly to disk - Initialize necessary writers and buffers for passthrough - Handle segment creation and rotation - Add proper cleanup on close
becf295 to
44d538e
Compare
|
@aler9 Thanks a ton as always for getting 1.13.0 out, your work is incredible! Just adding us as a voice who has tested the PR and would benefit greatly from it getting merged in. |
|
Hello, the problem of this feature is that it creates a shortcut that allows to bypass the server architecture, in which every stream is first converted into a universal format, and then made available to any kind of reader. This PR goes to the benefit of the minority of users that want to read a MPEG-TS stream and store it on disk in MPEG-TS format, leaving out everyone else. |
|
@aler9 I do see where you are coming from, so I spent some time looking at what it would take to get incoming MPEG-TS streams to be a first-class citizen of MediaMTX and unless I am not understanding things well it looks like the current architecture won't play nicely with that. The core issue is that when an MPEG-TS stream arrives as RTP payload type 33, it then needs to be demuxed and the tracks within it then distributed into MediaMTX. This doesn't work well at the So looking at the proposed recording here, I am not sure I see where this wouldn't be a strictly positive improvement to the functionality of MediaMTX, since it doesn't take away from any existing functionality and just adds a bit more for pure MPEG-TS streams. Another consideration I have is that we are dealing with STANAG 4609 conformant streams in my case and other utilities typically do not do well when attempting to containerize into MPEG-TS, this includes tools like GStreamer's This isn't a show stopper if this approach is really not wanted though, just let me know and I will close this PR. One alternative we have used is just using a GStreamer pipeline in the |
The idea here is that MediaMTX does not support recording incoming MPEG-TS streams, but since MPEG-TS doesn't need any transcoding/demuxing/etc to be written to disk we can just keep an eye out for when an incoming RTSP stream is already MPEG-TS and write it directly to disk. This is simple and preserves the internal structure, such as elementary stream ID's, PMT organization, and timestamps.
This requires the incoming stream to be MPEG-TS and the recording format to be set to
mpegts, it does not add support for writing an MPEG-TS stream tofmp4as that would require demuxing, parsing, and re-containerization of any streams that can be put into an MP4 format.Actions taken: