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

How do I control output folders and file names? #133

Open
aradalvand opened this issue Feb 16, 2023 · 4 comments
Open

How do I control output folders and file names? #133

aradalvand opened this issue Feb 16, 2023 · 4 comments
Labels
component: packager An issue with the packager node flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this priority: P3 Useful but not urgent type: enhancement New feature or request
Milestone

Comments

@aradalvand
Copy link

aradalvand commented Feb 16, 2023

The Overview > Features section in the docs says that Shaka Streamer lets you:

Control output folders and file names

But I couldn't find any relevant options in https://shaka-project.github.io/shaka-streamer/configuration_fields.html.
With Shaka Packager, I used to use playlist_name, and segment_template with placeholders like $Number$ in its value.
How do I achieve the same thing with Shaka Streamer?

@mariocynicys
Copy link
Contributor

These are the options you can play with:

dash_output = configuration.Field(str, default='dash.mpd').cast()
"""Output filename for the DASH manifest, if created."""
hls_output = configuration.Field(str, default='hls.m3u8').cast()
"""Output filename for the HLS master playlist, if created."""
segment_folder = configuration.Field(str, default='').cast()
"""Sub-folder for segment output (or blank for none)."""

But media file names are hard coded to a predefined template:

def get_init_seg_file(self) -> Pipe:
INIT_SEGMENT = {
MediaType.AUDIO: 'audio_{language}_{channels}c_{bitrate}_{codec}_init.{format}',
MediaType.VIDEO: 'video_{resolution_name}_{bitrate}_{codec}_init.{format}',
MediaType.TEXT: 'text_{language}_init.{format}',
}
path_templ = INIT_SEGMENT[self.type].format(**self.features)
return Pipe.create_file_pipe(path_templ, mode='w')
def get_media_seg_file(self) -> Pipe:
MEDIA_SEGMENT = {
MediaType.AUDIO: 'audio_{language}_{channels}c_{bitrate}_{codec}_$Number$.{format}',
MediaType.VIDEO: 'video_{resolution_name}_{bitrate}_{codec}_$Number$.{format}',
MediaType.TEXT: 'text_{language}_$Number$.{format}',
}
path_templ = MEDIA_SEGMENT[self.type].format(**self.features)
return Pipe.create_file_pipe(path_templ, mode='w')
def get_single_seg_file(self) -> Pipe:
SINGLE_SEGMENT = {
MediaType.AUDIO: 'audio_{language}_{channels}c_{bitrate}_{codec}.{format}',
MediaType.VIDEO: 'video_{resolution_name}_{bitrate}_{codec}.{format}',
MediaType.TEXT: 'text_{language}.{format}',
}
path_templ = SINGLE_SEGMENT[self.type].format(**self.features)
return Pipe.create_file_pipe(path_templ, mode='w')

@aradalvand
Copy link
Author

aradalvand commented Feb 16, 2023

Yes but none of those correspond to segment_template or playlist_name in Shaka Packager.
Setting segment_folder just moves all the segments into a single folder; whereas segment_template in Shaka Packager would've allowed you to put the segments of each stream into its own directory.
Likewise, hls_output corresponds to the --hls_master_playlist_output argument in Shaka Packager, which as the name implies determines the name of the master playlist. playlist_name in Shaka Packager on the other hand, specifies the name of the playlist file of an individual stream.

Update: I hadn't read the second part of your answer where you actually did mention this:

But media file names are hard coded to a predefined template:

Well, that's a bummer, I thought I was missing something. That's exactly what I needed :/
Any plans to add the ability to customize this in the future?

@joeyparrish
Copy link
Member

It's not planned, but PRs are welcome. We could maybe move the filename templates into the configuration, with the current templates as default.

@joeyparrish joeyparrish added type: enhancement New feature or request flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this priority: P3 Useful but not urgent component: packager An issue with the packager node labels Oct 22, 2024
@joeyparrish
Copy link
Member

PRs still welcome!

@github-actions github-actions bot added this to the Backlog milestone Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: packager An issue with the packager node flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this priority: P3 Useful but not urgent type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants