Adding check for creating captions with dash_only and hls_only. (#761)

Fix the problems in the previous CL for #651.
This commit is contained in:
sr90 2020-04-29 17:39:12 -07:00 committed by GitHub
parent dba798798b
commit 7aefbeb27f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 158 additions and 5 deletions

View File

@ -16,8 +16,8 @@ playlists as well as DASH manifests.
$ 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=input_text.vtt,stream=text,init_segment=text/init.mp4,segment_template=text/$Number$.m4s,dash_only=1' \
'in=input_text.vtt,stream=text,segment_template=text/$Number$.vtt,hls_only=1' \
'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' \

View File

@ -719,6 +719,29 @@ class PackagerFunctionalTest(PackagerAppTest):
# order of trick play factors gets the same mpd.
self._CheckTestResults('audio-video-with-two-trick-play')
def testDashOnlyAndHlsOnlyWithCaptions(self):
audio_video_streams = self._GetStreams(['audio', 'video'], segmented=True)
dash_text_stream = self._GetStreams(['text'],
test_files=['bear-english.vtt'],
output_format='mp4',
segmented=True,
dash_only=True)
hls_text_stream = self._GetStreams(['text'],
test_files=['bear-english.vtt'],
segmented=True,
hls_only=True)
streams = audio_video_streams + dash_text_stream + hls_text_stream
self.assertPackageSuccess(streams, self._GetFlags(output_dash=True,
output_hls=True))
# Mpd cannot be validated right now since we don't generate deterministic
# mpd with multiple inputs due to thread racing.
# TODO(b/73349711): Generate deterministic mpd or at least validate mpd
# schema.
self._CheckTestResults(
'hls-only-dash-only-captions',
diff_files_policy=DiffFilesPolicy(
allowed_diff_files=['output.mpd'], exact=False))
def testDashOnlyAndHlsOnly(self):
streams = [
self._GetStream('video', hls_only=True),

View File

@ -0,0 +1,8 @@
WEBVTT
STYLE
::cue { color:lime }
00:00:00.000 --> 00:00:00.800
Yup, that's a bear, eh.

View File

@ -0,0 +1,8 @@
WEBVTT
STYLE
::cue { color:lime }
00:00:01.000 --> 00:00:04.700
He 's... um... doing bear-like stuff.

View File

@ -0,0 +1,8 @@
WEBVTT
STYLE
::cue { color:lime }
00:00:01.000 --> 00:00:04.700
He 's... um... doing bear-like stuff.

View File

@ -0,0 +1,8 @@
WEBVTT
STYLE
::cue { color:lime }
00:00:01.000 --> 00:00:04.700
He 's... um... doing bear-like stuff.

View File

@ -0,0 +1,8 @@
WEBVTT
STYLE
::cue { color:lime }
00:00:01.000 --> 00:00:04.700
He 's... um... doing bear-like stuff.

View File

@ -0,0 +1,9 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-MEDIA:TYPE=AUDIO,URI="stream_2.m3u8",GROUP-ID="default-audio-group",NAME="stream_2",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=SUBTITLES,URI="stream_1.m3u8",GROUP-ID="default-text-group",NAME="stream_1",AUTOSELECT=YES
#EXT-X-STREAM-INF:BANDWIDTH=1108051,AVERAGE-BANDWIDTH=1005999,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group",SUBTITLES="default-text-group"
stream_3.m3u8

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-live:2011" minBufferTime="PT2S" type="dynamic" publishTime="some_time" availabilityStartTime="some_time" minimumUpdatePeriod="PT5S" timeShiftBufferDepth="PT1800S">
<Period id="0" start="PT0S">
<AdaptationSet id="0" contentType="text" segmentAlignment="true">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<Representation id="0" bandwidth="2024" codecs="wvtt" mimeType="application/mp4">
<SegmentTemplate timescale="1000" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="1">
<SegmentTimeline>
<S t="0" d="1000" r="4"/>
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
<AdaptationSet id="1" contentType="video" width="640" height="360" frameRate="30000/1001" segmentAlignment="true" par="16:9">
<Representation id="1" bandwidth="974122" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
<SegmentTemplate timescale="30000" initialization="bear-640x360-video-init.mp4" media="bear-640x360-video-$Number$.m4s" startNumber="1">
<SegmentTimeline>
<S t="0" d="30030" r="1"/>
<S t="60060" d="22022"/>
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
<AdaptationSet id="2" contentType="audio" segmentAlignment="true">
<Representation id="2" bandwidth="133929" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentTemplate timescale="44100" initialization="bear-640x360-audio-init.mp4" media="bear-640x360-audio-$Number$.m4s" startNumber="1">
<SegmentTimeline>
<S t="0" d="45056"/>
<S t="45056" d="44032"/>
<S t="89088" d="31744"/>
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
</Period>
</MPD>

View File

@ -0,0 +1,16 @@
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-TARGETDURATION:2
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:1.000,
bear-english-text-1.vtt
#EXTINF:1.000,
bear-english-text-2.vtt
#EXTINF:1.000,
bear-english-text-3.vtt
#EXTINF:1.000,
bear-english-text-4.vtt
#EXTINF:1.000,
bear-english-text-5.vtt
#EXT-X-ENDLIST

View File

@ -0,0 +1,13 @@
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-TARGETDURATION:2
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="bear-640x360-audio-init.mp4"
#EXTINF:1.022,
bear-640x360-audio-1.m4s
#EXTINF:0.998,
bear-640x360-audio-2.m4s
#EXTINF:0.720,
bear-640x360-audio-3.m4s
#EXT-X-ENDLIST

View File

@ -0,0 +1,13 @@
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-TARGETDURATION:2
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="bear-640x360-video-init.mp4"
#EXTINF:1.001,
bear-640x360-video-1.m4s
#EXTINF:1.001,
bear-640x360-video-2.m4s
#EXTINF:0.734,
bear-640x360-video-3.m4s
#EXT-X-ENDLIST

View File

@ -602,7 +602,7 @@ Status CreateTextJobs(
ToMuxerListenerData(stream));
// Check input to ensure that output is possible.
if (hls_listener) {
if (hls_listener && !stream.dash_only) {
if (input_container == CONTAINER_TTML) {
return Status(error::INVALID_ARGUMENT,
"HLS does not support TTML in xml format.");
@ -614,14 +614,15 @@ Status CreateTextJobs(
}
}
if (mpd_notifier && !stream.segment_template.empty()) {
if (mpd_notifier && !stream.segment_template.empty() &&
!stream.hls_only) {
return Status(error::INVALID_ARGUMENT,
"Cannot create text output for MPD with segment output.");
}
// If we are outputting to HLS, then create the HLS test pipeline that
// will create segmented text output.
if (hls_listener) {
if (hls_listener && !stream.dash_only) {
RETURN_IF_ERROR(CreateHlsTextJob(stream, packaging_params,
std::move(hls_listener), sync_points,
job_manager));