-
Notifications
You must be signed in to change notification settings - Fork 506
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
Adding dash_only and hls_only parameters #721
Adding dash_only and hls_only parameters #721
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this feature! Please see my comments.
CreateHlsListenersInternal(stream, stream_index, hls_notifier_)) { | ||
combined_listener->AddListener(std::move(listener)); | ||
|
||
if (stream.dash_only || stream.hls_only) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify the code to:
if (stream.dash_only || stream.hls_only) { | |
if (mpd_notifier_ && !stream.hls_only) { | |
... | |
} | |
if (hls_notifier_ && !stream.dash_only) { | |
... | |
} |
packager/packager.h
Outdated
@@ -128,6 +128,11 @@ struct StreamDescriptor { | |||
std::vector<std::string> dash_accessiblities; | |||
/// Optional for DASH output. It defines Role elements of the stream. | |||
std::vector<std::string> dash_roles; | |||
|
|||
/// Optional for DASH output. Set to true if only DASH output is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer rephrasing it as:
/// Set to true to indicate that the stream is for dash only.
similar below.
packager/app/stream_descriptor.cc
Outdated
@@ -206,6 +210,14 @@ base::Optional<StreamDescriptor> ParseStreamDescriptor( | |||
base::SplitString(iter->second, ";", base::TRIM_WHITESPACE, | |||
base::SPLIT_WANT_NONEMPTY); | |||
break; | |||
case kDashOnlyField: | |||
if (iter->second == "true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you ok with using "1" or "0" to be consistent with "skip_encryption" in line 170?
We may also support all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with "1" or "0". Will make the change.
/// Optional for DASH output. Set to true if only DASH output is needed. | ||
bool dash_only = false; | ||
/// Optional for HLS output. Set to true if only HLS output is needed. | ||
bool hls_only = false; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test in packager_test.py?
One option is to modify it from https://github.com/google/shaka-packager/blob/master/packager/app/test/packager_test.py#L652 and use dash_only for audio and use hls_only for video. After writing the test, you can run the below command to generate the golden files for you.
$ ninja -C out/Debug
$ out/Debug/packager_test.py --test_update_golden_files=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add the test. Thanks for the commands.
/// Optional for DASH output. Set to true if only DASH output is needed. | ||
bool dash_only = false; | ||
/// Optional for HLS output. Set to true if only HLS output is needed. | ||
bool hls_only = false; | ||
}; | ||
|
||
class SHAKA_EXPORT Packager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also update https://github.com/google/shaka-packager/blob/master/docs/source/options/dash_options.rst and https://github.com/google/shaka-packager/blob/master/docs/source/options/hls_options.rst?
It will be great if you can add an example to https://raw.githubusercontent.com/google/shaka-packager/master/docs/source/tutorials/dash_hls_example.rst too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes have updated the mentioned files. Please review and let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. LGTM with a few more style nits.
Also, you are welcomed to add your name / your company name to https://github.com/google/shaka-packager/blob/master/AUTHORS and https://github.com/google/shaka-packager/blob/master/CONTRIBUTORS if you haven't.
docs/source/options/dash_options.rst
Outdated
|
||
--dash_only=0|1 | ||
|
||
Optional. Defaults to 0 if not specified. If it is set to 1, indicates the stream is DASH only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Max 80 characters per line. Same below.
$ packager \ | ||
in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4 \ | ||
in=input_text.vtt,stream=text,output=output_text.vtt \ | ||
in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p.mp4, dash_only=1 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the space between "," and "dash_only" same below.
Hey @kqyang, do you know why Travis CI might have failed for BUILD_TYPE=Debug LIBPACKAGER_TYPE=static_library? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good. One last comment.
As for the Travis build failure, it seems to be an issue in the build bot. I have triggered the rebuild.
|
||
* Output DASH + HLS with dash_only and hls_only options | ||
|
||
$ packager \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update this example to use a practical use case?
For example, HLS requires WebVTT in text format while DASH supports only segmented WebVTT in mp4 format. So that is an excellent use case for the two flags.
$ packager \
'in=h264_baseline_360p_600.mp4,stream=audio,init_segment=audio/init.mp4,segment_template=audio/$Number$.m4s' \
'in=input_text.vtt,stream=text,init_segment=text/init.mp4,segment_template=text/$Number$.m4s',dash_only=true' \
'in=input_text.vtt,stream=text,segment_template=text/$Number$.vtt',hls_only=true' \
'in=h264_baseline_360p_600.mp4,stream=video,init_segment=h264_360p/init.mp4,segment_template=h264_360p/$Number$.m4s' \
'in=h264_main_480p_1000.mp4,stream=video,init_segment=h264_480p/init.mp4,segment_template=h264_480p/$Number$.m4s' \
'in=h264_main_720p_3000.mp4,stream=video,init_segment=h264_720p/init.mp4,segment_template=h264_720p/$Number$.m4s' \
'in=h264_high_1080p_6000.mp4,stream=video,init_segment=h264_1080p/init.mp4,segment_template=h264_1080p/$Number$.m4s' \
--generate_static_live_mpd --mpd_output h264.mpd \
--hls_master_playlist_output h264_master.m3u8
|
||
$ packager \ | ||
'in=h264_baseline_360p_600.mp4,stream=audio,init_segment=audio/init.mp4,segment_template=audio/$Number$.m4s' \ | ||
'in=input_text.vtt,stream=text,init_segment=text/init.mp4,segment_template=text/$Number$.m4s',dash_only=true' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I accidentally included an extra ' after "m4s", can you remove it? Same below.
@sr1990 The PR has been merged. Thanks for the great work on this feature request! |
This PR is related to #651. Adding dash_only=true or hls_only=true will create DASH only or HLS only output.
Example: