Open vasudevavarun opened 3 years ago
@vasudevavarun You can specify the audio group using hls_group_id
stream descriptor: https://google.github.io/shaka-packager/html/tutorials/hls.html#hls-specific-stream-descriptor-fields, i.e.
./packager-linux-2.4.3 \
'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_2000.mp4,stream=video,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/2000-$Number$.ts,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/2000.m3u8' \
'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_700.mp4,stream=video,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/700-$Number$.ts,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/700.m3u8' \
'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_250.mp4,stream=video,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/250-$Number$.ts,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/250.m3u8' \
'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_2000.mp4,stream=audio,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/128-$Number$.aac,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/128.m3u8,hls_group_id=audio_128' \
'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_250.mp4,stream=audio,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/32-$Number$.aac,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/32.m3u8,hls_group_id=audio_32' \
'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_700.mp4,stream=audio,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/64-$Number$.aac,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/64.m3u8,hls_group_id=audio_64' \
'in=/tmp/Subtitle\ 1.vtt,stream=text,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/$Number$.vtt,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/main.m3u8,hls_group_id=text,hls_name=ENGLISH' \
--hls_master_playlist_output /opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/a.m3u8
I am closing this issue. Feel free to reply if you have more questions.
Hi,
Command:
./packager-linux-2.4.3 \ 'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_2000.mp4,stream=video,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/2000-$Number$.ts,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/2000.m3u8,hls_group_id=audio_128' \ 'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_700.mp4,stream=video,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/700-$Number$.ts,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/700.m3u8,hls_group_id=audio_64' \ 'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_250.mp4,stream=video,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/250-$Number$.ts,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/250.m3u8,hls_group_id=audio_32' \ 'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_2000.mp4,stream=audio,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/128-$Number$.aac,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/128.m3u8,hls_group_id=audio_128' \ 'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_250.mp4,stream=audio,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/32-$Number$.aac,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/32.m3u8,hls_group_id=audio_32' \ 'in=/opt/video/data/amritatv_ott615/bulk_video/dest/mp4/a_2_700.mp4,stream=audio,segment_template=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/64-$Number$.aac,playlist_name=/opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/64.m3u8,hls_group_id=audio_64' \ --hls_master_playlist_output /opt/video/data/amritatv_ott615/bulk_video/dest/hls/a_2/a.m3u8
Expected Behavior:
EXTM3U
Generated with https://github.com/google/shaka-packager version v2.4.3-dd98700-release
EXT-X-MEDIA:TYPE=AUDIO,URI="128.m3u8",GROUP-ID="audio_128",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
EXT-X-MEDIA:TYPE=AUDIO,URI="32.m3u8",GROUP-ID="audio_32",LANGUAGE="en",NAME="stream_2",AUTOSELECT=YES,CHANNELS="2"
EXT-X-MEDIA:TYPE=AUDIO,URI="64.m3u8",GROUP-ID="audio_64",LANGUAGE="en",NAME="stream_4",AUTOSELECT=YES,CHANNELS="2"
EXT-X-STREAM-INF:BANDWIDTH=421558,AVERAGE-BANDWIDTH=408952,CODECS="avc1.42c01f,mp4a.40.2",RESOLUTION=384x288,AUDIO="audio_32"
250.m3u8
EXT-X-STREAM-INF:BANDWIDTH=893814,AVERAGE-BANDWIDTH=865367,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=640x480,AUDIO="audio_64"
700.m3u8
EXT-X-STREAM-INF:BANDWIDTH=2264710,AVERAGE-BANDWIDTH=2189543,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=768x576,AUDIO="audio_128"
2000.m3u8
Result:
EXTM3U
Generated with https://github.com/google/shaka-packager version v2.4.3-dd98700-release
EXT-X-MEDIA:TYPE=AUDIO,URI="128.m3u8",GROUP-ID="audio_128",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
EXT-X-MEDIA:TYPE=AUDIO,URI="32.m3u8",GROUP-ID="audio_32",LANGUAGE="en",NAME="stream_2",AUTOSELECT=YES,CHANNELS="2"
EXT-X-MEDIA:TYPE=AUDIO,URI="64.m3u8",GROUP-ID="audio_64",LANGUAGE="en",NAME="stream_4",AUTOSELECT=YES,CHANNELS="2"
EXT-X-STREAM-INF:BANDWIDTH=421558,AVERAGE-BANDWIDTH=408952,CODECS="avc1.42c01f,mp4a.40.2",RESOLUTION=384x288,AUDIO="audio_128"
250.m3u8
EXT-X-STREAM-INF:BANDWIDTH=893814,AVERAGE-BANDWIDTH=865367,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=640x480,AUDIO="audio_128"
700.m3u8
EXT-X-STREAM-INF:BANDWIDTH=2264710,AVERAGE-BANDWIDTH=2189543,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=768x576,AUDIO="audio_128"
2000.m3u8
EXT-X-STREAM-INF:BANDWIDTH=324107,AVERAGE-BANDWIDTH=312862,CODECS="avc1.42c01f,mp4a.40.2",RESOLUTION=384x288,AUDIO="audio_32"
250.m3u8
EXT-X-STREAM-INF:BANDWIDTH=796363,AVERAGE-BANDWIDTH=769277,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=640x480,AUDIO="audio_32"
700.m3u8
EXT-X-STREAM-INF:BANDWIDTH=2167259,AVERAGE-BANDWIDTH=2093453,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=768x576,AUDIO="audio_32"
2000.m3u8
EXT-X-STREAM-INF:BANDWIDTH=356779,AVERAGE-BANDWIDTH=344903,CODECS="avc1.42c01f,mp4a.40.2",RESOLUTION=384x288,AUDIO="audio_64"
250.m3u8
EXT-X-STREAM-INF:BANDWIDTH=829035,AVERAGE-BANDWIDTH=801318,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=640x480,AUDIO="audio_64"
700.m3u8
EXT-X-STREAM-INF:BANDWIDTH=2199931,AVERAGE-BANDWIDTH=2125494,CODECS="avc1.4d4029,mp4a.40.2",RESOLUTION=768x576,AUDIO="audio_64"
2000.m3u8
The audio should be mapped once to the desired video bitrate.
I see. Shaka packager does not support fixing the audio group for the variant streams right now.
It is possible to add support for it with some simple modifications. Let us know if you are interested in helping us implement it.
I see. Shaka packager does not support fixing the audio group for the variant streams right now.
It is possible to add support for it with some simple modifications. Let us know if you are interested in helping us implement it.
Sure, Please let me know how can I help.
It is trivial if we just want to support fixing the audio group id for the variant stream. Here is a sample change to do that:
https://github.com/google/shaka-packager/blob/master/packager/hls/base/master_playlist.cc#L435
for (const auto& variant : variants) {
if (video_playlists.empty())
break;
content->append("\n");
for (const auto& playlist : video_playlists) {
if (!playlist.group_id().empty() && variant.audio_group_id &&
playlist.group_id() != *variant.audio_group_id) {
continue;
}
BuildStreamInfTag(*playlist, variant, base_url, content);
}
}
The above change supports having one audio group id per variant stream only. We may want to support more than one audio group ids per variant stream.
We should also support text group ids. Ideally there should be separate stream descriptors for audio and text, but that requires more changes.
One possible option is to reuse the same stream descriptor hls_group_id
, but modify it to support both audio and text, and optionally more than one audios and texts, e.g. use ;
to separate the groups and use +
to separate audio and text, something like: hls_group_id=audio1;audio2+text1;text2
. You may use base::SplitString
to split the strings.
@vasudevavarun Does this answer all your questions? Can we close the issue?
@vasudevavarun Please ignore the shaka-bot message above. The issue was not correctly labeled which confused the bot.
Hi @kqyang, I've applied the above patch but receiving the following error on ninja build
ninja: Entering directory
out/Release'
[2/297] CXX obj/hls/base/hls_builder.master_playlist.o
FAILED: obj/hls/base/hls_builder.master_playlist.o
../../packager/third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/hls/base/hls_builder.master_playlist.o.d -DV8_DEPRECATION_WARNINGS -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=317263-2 -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DENABLE_PEPPER_CDMS -DENABLE_NOTIFICATIONS -DUSE_UDEV -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DGFLAGS_DLL_DECL= -DGFLAGS_DLL_DECLARE_FLAG= -DGFLAGS_DLL_DEFINE_FLAG= -DUSE_LIBPCI=1 -DUSE_NSS_CERTS=1 -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -Igen -I../../packager -I../.. -Igen/protoc_out -I../../packager/third_party/protobuf/src -I../../packager/third_party/gflags/gen/posix/include -I../../packager/third_party/gflags/src/src -fstack-protector --param=ssp-buffer-size=4 -Werror -pthread -fno-strict-aliasing -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -fcolor-diagnostics -Wheader-hygiene -Wstring-conversion -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-undefined-var-template -Wno-nonportable-include-path -Wimplicit-fallthrough -m64 -march=x86-64 -O2 -fno-ident -fdata-sections -ffunction-sections -funwind-tables -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -c ../../packager/hls/base/master_playlist.cc -o obj/hls/base/hls_builder.master_playlist.o
../../packager/hls/base/master_playlist.cc:440:15: error: member reference type 'const shaka::hls::MediaPlaylist *const' is a pointer; did you mean to use '->'?
if (!playlist.group_id().empty() && variant.audio_group_id &&
->
../../packager/hls/base/master_playlist.cc:441:19: error: member reference type 'const shaka::hls::MediaPlaylist *const' is a pointer; did you mean to use '->'?
playlist.group_id() != *variant.audio_group_id) {
~~~~~~~~^
->
2 errors generated.
[3/297] LINK mpd_unittest
ninja: build stopped: subcommand failed.
`
Sorry for the typo. Yes, it should be ->
.
Hey, Replacing with '->' solved the compilation issue, By assigning the hls_group_id to different bitrate is working. I've got the following output m3u8.
On the other hand, This modification is generating error when I'm parsing vtt subtitles in the command which was working before, I'm having the following error when parsing subttitles.
terminate called after throwing an instance of 'std::regex_error' what(): regex_error Aborted (core dumped)
On the other hand, This modification is generating error when I'm parsing vtt subtitles in the command which was working before, I'm having the following error when parsing subttitles.
Can you double check that it works before the change? It seems like a different issue.
Hi @kqyang
I realized that the command with vtt subtitles are working with per-compiled binaries that you guys have provided but it is throwing this exception only on my compiled version, That is why it is only giving error there.
I came across this ticket while searching for it and it is exactly what I'm facing. https://github.com/google/shaka-packager/issues/865
@vasudevavarun What is your platform and gcc/clang version?
OS: CentOS Linux release 7.8.2003 GCC: gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
Although, I've also tried with gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC) using "scl enable devtoolset-8" But it is still same.
Can you comment on #865 with the information above and also the VTT file you use? It can help us re-produce the issue. Thanks.
System info
Operating System: Centos 7.4(64bit) Shaka Packager Version: 2.4.3
Issue and steps to reproduce the problem
Packager Command:
What is the expected result?
What happens instead?
I want to associate audio group with desired bitrate. Thanks