Skip to content
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

Support live subtitles stream from transport stream #2843

Open
3 tasks done
jadarve opened this issue May 23, 2024 · 0 comments
Open
3 tasks done

Support live subtitles stream from transport stream #2843

jadarve opened this issue May 23, 2024 · 0 comments

Comments

@jadarve
Copy link

jadarve commented May 23, 2024

Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

Detailed guidelines: https://gpac.io/bug-reporting/

I'm trying to transmit live subtitles from our transcoder to GPAC using Transport Stream. Our transcoder does not support MP4 Text Stream, and from what I have read of GPAC's code, it does not support demuxing it either.

Instead of implementing the whole spec, which at the moment is overkill for my use case, I tried to mux SRT subtitles as private data in PES packets.

  • The Elementary Stream uses PES packets private data with a registration_descriptor for the SRT format.
    image
    image

  • Each PES packet contains one SRT event (aligned with PES start):

0
00:00:00,000 --> 00:00:01,000
This is the event zero

In GPAC, I managed to demux the stream in this branch: master...jadarve:gpac:NS_ts_subtitles

running a command like:

./bin/gcc/gpac \
  -i test_data/out_subtitle_only.ts \
  txtin \
  -o test_data/subtitles.vtt \
  -graph

prints the following graph:

Filters connected:
fin (src=test_data/out_subtitle_only.ts) (idx=1)
-(PID out_subtitle_only.ts) m2tsdmx (dyn_idx=4)
--(PID P1T2) writeuf (dyn_idx=5)
---(PID P1T2) writegen (dyn_idx=6)
----(PID P1T2) txtin (idx=2)
-----(PID P1T2) tx3g2vtt (dyn_idx=7)
------(PID P1T2) writegen (dyn_idx=8)
-------(PID P1T2) fout (dst=test_data/subtitles.vtt) (idx=3)

However, the generated WebVTT is not what I expected, it looks as:

WEBVTT

90:15:36.023 --> 90:15:39.623
1
01:00:00,000 --> 01:00:00,000
0
00:00:00,000 --> 00:00:00,040
current counter: 00000000000000000000000000000000000000000000000000

where I expected lots of subtitles lines.

This is just an example. My final goal is to be able to mux the TS subtitles into a CMAF track as WebVTT for live streaming. I would like to know if something is already done in that direction (live subtitle muxing), or if the approach I'm taking makes sense, and if you could advise me on how to proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant