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 · 3 comments
Open

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

aradalvand opened this issue Feb 16, 2023 · 3 comments

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
Collaborator

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.

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

3 participants