mptsd
mptsd copied to clipboard
Feature Request
Could the option be added to mux private PES stream such as Teletext? Yes I know, Its a dead format however, I'd like to use teletext as a way of showing DVDB-T Transmitter status. What would be involved in the code? Time $$?
Hi @SonnyWalkman ,
This tool is to MULTIPLEX several services inside a MPTS. What you request is to mux several streams inside a service. To do that you could use a tool like FFmpeg.
Thanks for adding RTP..
I'll glad to see some work done on mptsd and are to give it another shot over TSduck.
Question? I have a alternate Teletext stream coming in via udp which has it own PTS and PCR. Is mptsd able to multiplex as a source? I assume yes since the PCR is restamped. I'm looking to wrap mptsd in go code called from cmd = exec.Command(args[0], args[1:]...)
Is there an example of the command line?
Hi @SonnyWalkman ,
I repeat: This tool is only an SPTS multiplexer into a MPTS. Therefore, any action inside the SPTS can't be done with this tool.
If you need to "replace" the Teletext pid of a service, then I recomend these options:
- Use the FFmpeg tool to "remux" both. You can input the Service and the Teletext streams, and copy the internal streams (without reencoding). Then you can use the output (in mpeg-ts) as the input of mptsd.
- Use the TSDuck tool to "join" the Service and the Teletext pids, and then "retime" the timestamps of the Teletext pid based on the time of the service. However, I feel this will not be a perfect option. So I recommend then the first one.
I hope this helps.
Hi @lars18th , Yes correct, I understand all inputs into mptsd must be SPTS udp/rtp feeds. Effectively this is what I'm doing.
I'm using outputs from two instances of OBS Studio record output over udp and a combo feed from a separate ffmpeg script which combines pip (side-by-side) of the other two obs studio feeds.. Adding teletext is a service however, I have contemplated on the process of combining it with the combo feed and using the same ffmpeg script for the combo generation?
The teletext is the output from vbit2.exe --format ts => script to push stdout to udp..
ffmpeg unfortunately doesn't like it using:-
ffmpeg -i udp://224.0.0.1:9999 -i udp://224.0.0.6:6666 -map 0:v -map 0:a -map 1:s -c:v copy -c:a copy -c:s copy -f mpegts udp://224.0.0.9:5000
However, I'm going to try vbit2's stdout directly into ffmpeg as "-i" "-" to eliminate another multicast stream and see how it works?
By the way, I've attached a simple mptsd usage by picking apart the usage function in config.c to assist others wanting to give mptsd a try.
What's next with mptsd.. Could the EIT scheduling get some love?
Hi @SonnyWalkman ,
Thank you for the contribution of the PDF usage document. I suggest that you open the Wiki page of the project and upload to it this file.
Regarding your use case, perhaps it has sense to work on it to share the experience. As I understand that's your environment:
OBS (audio/video generator) ---> FFmpeg ---> mptsd ---> DVB?
^
Disk (txt pages) ---> vbit2 -------+
In this scenario my comments:
- The FFmpeg tool requires that all inputs have timestamps. Without them it refuses to mux anything (without a hard hacking). Therefore, the output from the vbit2 tool needs to be
ts
and nottsnpts
as you're doing (https://github.com/peterkvt80/vbit2/wiki/Manual-configuration). - The problem then is to synchronize the AV stream with the TXT stream, because the PTS and PCR marks are completly different. In this case the option inside FFmpegs is to use the
setts
bitstream filter to change/modify the timestamps per stream. The objective is to change the values on both streams to something new but with the same timebase. - I don't have tested this before, but some people suggest to use
-bsf[:spec] setts=dts=DTS+OFFSET/TB:pts=PTS+OFFSET/TB
or-bsf "setts=PTS-STARTPTS;DTS-STARTDTS"
. Please try it (and comment the results).
I hope this helps you.
Hi @SonnyWalkman ,
And if the option of using the setts
filter plugin doesn't work with FFmpeg, then you can also try the svresync
of TSDuck. But in this case the usage will change: You need to compose your TV service with OBS+FFmpeg, and the TXT service with vbit2, then mux them with mptsd (as two independent services), and after use the TSDuck tool with the svresync
filter (plus others) to "transplant" the TXT service inside the TV service. Perhaps quite tricky, so I suggest to first go with the setts
filter in FFmpeg because in fact you're using FFmpeg to generate your service. It will be more robust.
Regards.
Hi @SonnyWalkman ,
FYI, this works in my case using FFmpeg with three inputs (one A/V service and two Radios, all captured from different broadcasts in different frequencies):
ffmpeg \
-thread_queue_size 128 -i <input_1> \
-thread_queue_size 128 -i <input_2> \
-thread_queue_size 128 -i <input_3> \
-map 0 -map -0:s? -map -0:d? -ignore_unknown \
-map 1 -map -1:s? -map -1:d? -ignore_unknown \
-map 2 -map -2:s? -map -2:d? -ignore_unknown \
-c copy -f mpegts udp://224.0.0.9:5000?pkt_size=1316
All is played without troubles from the multicast output. And I can change the audio channel and all tracks (from the original service and from the radios) plays fine.
The reason for the -map 0 -map -0:s? -map -0:d? -ignore_unknown
lines is to remove all TELETEXT and DATA streams. This is necessary because the FFmpeg tool don't want streams without timestamps (private datas, EIT, etc.). And with the Teletext timestamps it has troubles (the "Non-monotonous DTS in output stream" message not currently fixed). So if you need to merge the TELETEXT stream, you'll need to search more for a reliable solution.
Regards.
Hi @lars18th, Thankyou for your assistance with my fascination with Teletext. I've been trying your suggestions and have svresync time stamping the PCR for my teletext stream.
I have tried
ffmpeg \ -thread_queue_size 128 -i <input_1> \ -thread_queue_size 128 -i <input_2> \ -thread_queue_size 128 -i <input_3> \ -map 0 -map -0:s? -map -0:d? -ignore_unknown \ -map 1 -map -1:s? -map -1:d? -ignore_unknown \ -map 2 -map -2:s? -map -2:d? -ignore_unknown \ -c copy -f mpegts udp://224.0.0.9:5000?pkt_size=1316
It works a treat however combine all into one service, I'm looking to have 3 services (HD video and audio) with teletext available to all 3 services. (eventually)
I've successfully have HD video, AAC audio and teletext combined in one service. Service-HD1
Another HD video and AAC audio service Service-HD2 combined using -P merge
however, when analysing the data using -P analyse -i 10 -o output.txt
I see both services however my first service Service-HD1 reports as unknown. Unable to show service name, type etc? Something I'm doing for sure.
I've suspected the video and audio PCR pid's to be conflicting and changed these to make no difference?
I'll build the latest mptsd and have a crack on using it in combination with ffmpeg and tsp. setup two instances of obs studio udp multicast streams with the third stream a ffmpeg stream and see how it goes this weekend.
I've been developing on windows with bat scripts however, mptsd is Linux only and it's time to jump ship over to my Ubuntu and trying it out. I'll combine the teletext transport stream to each service using tsp
SPTS and output each -O ip 224.0.0.X:9999
to mptsd for a steady MPTS
How would I go about the config's to do such with mptsd?
Regarding High precision clock. I'm considering using Pop OS! (by System76) for my final system since it built with Nvidia drivers and supports obs studio out of the box. Basically, gamers and streamer OS. its a flavour of Ubuntu without the bloat.
Hi @lars18th
Thank you for the contribution of the PDF usage document. I suggest that you open the Wiki page of the project and upload to it this file.
Wiki created with a simple overview of mptsd for newbies like myself. Happy to contribute.