-
Notifications
You must be signed in to change notification settings - Fork 515
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
Specify Initial Sequence Number #270
Comments
I answered my own question by looking at the code. There is no way to change the default of 1 as starting sequence number. Here is a patch that applies to latest version. It adds a new option to control the initial sequence number of the segmenter: diff --git a/packager/app/muxer_flags.cc b/packager/app/muxer_flags.cc
index a18a4e7..888d486 100644
--- a/packager/app/muxer_flags.cc
+++ b/packager/app/muxer_flags.cc
@@ -50,3 +50,7 @@ DEFINE_bool(mp4_use_decoding_timestamp_in_timeline,
"be used when generating media timeline, e.g. timestamps in sidx "
"and mpd. This is to workaround a Chromium bug that decoding "
"timestamp is used in buffered range, https://crbug.com/398130.");
+DEFINE_int32(mp4_sequence_number_initial,
+ 1,
+ "This number allows for the customization of the "
+ "initial sequence_number in the mp4 moof->mfhd.");
\ No newline at end of file
diff --git a/packager/app/muxer_flags.h b/packager/app/muxer_flags.h
index a88a777..a096be4 100644
--- a/packager/app/muxer_flags.h
+++ b/packager/app/muxer_flags.h
@@ -20,5 +20,6 @@ DECLARE_int32(num_subsegments_per_sidx);
DECLARE_string(temp_dir);
DECLARE_bool(mp4_include_pssh_in_stream);
DECLARE_bool(mp4_use_decoding_timestamp_in_timeline);
+DECLARE_int32(mp4_sequence_number_initial);
#endif // APP_MUXER_FLAGS_H_
diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc
index fa7e034..e9d41be 100644
--- a/packager/app/packager_main.cc
+++ b/packager/app/packager_main.cc
@@ -284,6 +284,7 @@ base::Optional<PackagingParams> GetPackagingParams() {
mp4_params.use_decoding_timestamp_in_timeline =
FLAGS_mp4_use_decoding_timestamp_in_timeline;
mp4_params.include_pssh_in_stream = FLAGS_mp4_include_pssh_in_stream;
+ mp4_params.sequence_number_initial = FLAGS_mp4_sequence_number_initial;
packaging_params.output_media_info = FLAGS_output_media_info;
diff --git a/packager/media/formats/mp4/segmenter.cc b/packager/media/formats/mp4/segmenter.cc
index 8e1bb56..dfbf84c 100644
--- a/packager/media/formats/mp4/segmenter.cc
+++ b/packager/media/formats/mp4/segmenter.cc
@@ -84,7 +84,7 @@ Status Segmenter::Initialize(
// Use the reference stream's time scale as movie time scale.
moov_->header.timescale = sidx_->timescale;
- moof_->header.sequence_number = 1;
+ moof_->header.sequence_number = options_.mp4_params.sequence_number_initial;
// Fill in version information.
const std::string version = GetPackagerVersion();
diff --git a/packager/media/public/mp4_output_params.h b/packager/media/public/mp4_output_params.h
index f9b83f1..4c39dd8 100644
--- a/packager/media/public/mp4_output_params.h
+++ b/packager/media/public/mp4_output_params.h
@@ -29,6 +29,7 @@ struct Mp4OutputParams {
/// which is needed to workaround a Chromium bug that decoding timestamp is
/// used in buffered range, https://crbug.com/398130.
bool use_decoding_timestamp_in_timeline = false;
+ int sequence_number_initial = 1;
};
} // namespace shaka |
@sammirata Sorry for the lack of communication. If you would like to contribute to the shaka packager, please follow the instructions in CONTRIBUTING and then provide a pull request. @kqyang Would this be a change we would be willing to accept? |
Yes! I'd hope to have native support for HLS to DASH conversion, but since it is not going to happen soon, @sammirata's method is an effective way to make it work right now. @sammirata Sorry for not getting back to you earlier. As suggested by @vaage, we welcome pull requests. A quick question, are there any clients / players requires the sequence_number to be set properly? I know Chrome does not care about the value. |
To make this issue appear nicer in the list of issues, I am going to rename it and move the description down here.
|
I have submitted a pull request with the patch. This method has been used effectively to generate a valid HLS/fmp4 stream using an HLS/ts as source. |
I have added the "Help Wanted" label since you submitted a pull request. The pull request is #350. |
Here is a sample command line:
packager-linux input=s00015072.ts.25274682549.ts,stream_selector=video,init_segment=video.mp4,segment_template=video2-$Number$.mp4
The text was updated successfully, but these errors were encountered: