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

HLS custom tags #2898

Merged
merged 3 commits into from
Jun 25, 2023
Merged

HLS custom tags #2898

merged 3 commits into from
Jun 25, 2023

Conversation

toots
Copy link
Member

@toots toots commented Feb 14, 2023

This PR adds the ability to define extra tags on HLS playlists. It adds 3 distinct ways of doing it:

  • The extra_tags argument on the operator adds extra tags to the main playlist.
  • The optional extra_tags method on the stream list adds extra tags to the given stream.
  • The return output (of unit) type has a streams method which returns the list of streams with their attributes (encoder, name, bandwidth) and a insert_tag to insert a tag into their playlist
  • Tags inserted via the insert_tag cause the current segment to end. The tag is the written to the playlist and a new segment begins.

Example:

Script:

# Add X-CUSTOM-TAG to the main playlist:
o = output.file.hls(
  extra_tags["X-CUSTOM-TAG"],
 "/tmp/hls",
  [(
    "stream", 
    %ffmpeg(format="mpegts", %audio(codec="aac")).{
        # Adds an extra tag to this stream.
       extra_tags = ["X-CUSTOM-STREAM-TAG"]
    })
  ]
  s
)

# Insert a tag to all streams
list.iter(fun s -> s.insert_tag("X-CUSTOM-STREAM-TAG"), o.streams())

@toots toots changed the title Hls custom tags HLS custom tags Feb 14, 2023
@toots toots force-pushed the hls-custom-tags branch 4 times, most recently from 575cf47 to 37b1376 Compare June 24, 2023 21:43
@toots toots merged commit 7750e49 into main Jun 25, 2023
@toots toots deleted the hls-custom-tags branch June 25, 2023 00:31
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

Successfully merging this pull request may close these issues.

1 participant