diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 21c802758d..94447b6c97 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -429,7 +429,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[2], 'subtitle-english-golden.vtt') self._DiffGold(self.mpd_output, 'bear-640x360-avt-golden.mpd') - def testPackageAvcTs(self): + def testPackageAvcAacTs(self): # Currently we only support live packaging for ts. self.assertPackageSuccess( self._GetStreams( @@ -452,6 +452,46 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold( os.path.join(self.tmp_dir, 'video.m3u8'), 'bear-640x360-v-golden.m3u8') + def testPackageAvcAc3Ts(self): + # Currently we only support live packaging for ts. + self.assertPackageSuccess( + self._GetStreams( + ['audio', 'video'], + output_format='ts', + live=True, + hls=True, + test_files=['bear-640x360-ac3.ts']), + self._GetFlags(output_hls=True)) + self._DiffLiveGold(self.output[0], + 'bear-640x360-ac3-golden', + output_format='ts') + self._DiffLiveGold(self.output[1], + 'bear-640x360-v-golden', + output_format='ts') + self._DiffGold(self.hls_master_playlist_output, + 'bear-640x360-av-ac3-master-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'audio.m3u8'), + 'bear-640x360-ac3-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'video.m3u8'), 'bear-640x360-v-golden.m3u8') + + def testPackageAvcAc3TsToMp4(self): + self.assertPackageSuccess( + self._GetStreams( + ['audio', 'video'], hls=True, test_files=['bear-640x360-ac3.ts']), + self._GetFlags(output_hls=True)) + self._DiffGold(self.output[0], 'bear-640x360-ac3-from-ts-golden.mp4') + self._DiffGold(self.output[1], 'bear-640x360-v-from-ts-golden.mp4') + self._DiffGold(self.hls_master_playlist_output, + 'bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'audio.m3u8'), + 'bear-640x360-ac3-ts-to-mp4-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'video.m3u8'), + 'bear-640x360-v-ts-to-mp4-golden.m3u8') + def testPackageAvcTsLivePlaylist(self): self.assertPackageSuccess( self._GetStreams( @@ -806,6 +846,31 @@ class PackagerFunctionalTest(PackagerAppTest): os.path.join(self.tmp_dir, 'video.m3u8'), 'bear-640x360-v-fairplay-enc-golden.m3u8') + def testPackageAvcAc3TsWithEncryption(self): + # Currently we only support live packaging for ts. + self.assertPackageSuccess( + self._GetStreams( + ['audio', 'video'], + output_format='ts', + live=True, + hls=True, + test_files=['bear-640x360-ac3.ts']), + self._GetFlags(encryption=True, output_hls=True)) + self._DiffLiveGold(self.output[0], + 'bear-640x360-ac3-enc-golden', + output_format='ts') + self._DiffLiveGold(self.output[1], + 'bear-640x360-v-enc-golden', + output_format='ts') + self._DiffGold(self.hls_master_playlist_output, + 'bear-640x360-av-ac3-master-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'audio.m3u8'), + 'bear-640x360-ac3-enc-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'video.m3u8'), + 'bear-640x360-v-enc-golden.m3u8') + def testPackageAvcTsWithEncryptionExerciseEmulationPrevention(self): self.encryption_key = 'ad7e9786def9159db6724be06dfcde7a' # Currently we only support live packaging for ts. diff --git a/packager/app/test/testdata/bear-640x360-ac3-enc-golden-1.ts b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-1.ts new file mode 100644 index 0000000000..27da4c3090 Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-1.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-enc-golden-2.ts b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-2.ts new file mode 100644 index 0000000000..b5803febbf Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-2.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-enc-golden-3.ts b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-3.ts new file mode 100644 index 0000000000..39a1002c18 Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-3.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-enc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-ac3-enc-golden.m3u8 new file mode 100644 index 0000000000..b0c2e0ba26 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-ac3-enc-golden.m3u8 @@ -0,0 +1,14 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-TARGETDURATION:2 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:0.975, +output_audio-1.ts +#EXTINF:1.010, +output_audio-2.ts +#EXT-X-DISCONTINUITY +#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",IV=0x3334353637383930,KEYFORMAT="identity" +#EXTINF:0.801, +output_audio-3.ts +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 b/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 new file mode 100644 index 0000000000..3c4ec7a4b0 Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-golden-1.ts b/packager/app/test/testdata/bear-640x360-ac3-golden-1.ts new file mode 100644 index 0000000000..27da4c3090 Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-ac3-golden-1.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-golden-2.ts b/packager/app/test/testdata/bear-640x360-ac3-golden-2.ts new file mode 100644 index 0000000000..b5803febbf Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-ac3-golden-2.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-golden-3.ts b/packager/app/test/testdata/bear-640x360-ac3-golden-3.ts new file mode 100644 index 0000000000..a8de767844 Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-ac3-golden-3.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-golden.m3u8 b/packager/app/test/testdata/bear-640x360-ac3-golden.m3u8 new file mode 100644 index 0000000000..0a45f41b03 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-ac3-golden.m3u8 @@ -0,0 +1,12 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-TARGETDURATION:2 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:0.975, +output_audio-1.ts +#EXTINF:1.010, +output_audio-2.ts +#EXTINF:0.801, +output_audio-3.ts +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-ac3-ts-to-mp4-golden.m3u8 b/packager/app/test/testdata/bear-640x360-ac3-ts-to-mp4-golden.m3u8 new file mode 100644 index 0000000000..98e8e1b9b7 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-ac3-ts-to-mp4-golden.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-TARGETDURATION:2 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="output_audio.mp4",BYTERANGE="726@0" +#EXTINF:0.975, +#EXT-X-BYTERANGE:23728@794 +output_audio.mp4 +#EXTINF:1.010, +#EXT-X-BYTERANGE:24574 +output_audio.mp4 +#EXTINF:0.801, +#EXT-X-BYTERANGE:19510 +output_audio.mp4 +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-av-ac3-master-golden.m3u8 b/packager/app/test/testdata/bear-640x360-av-ac3-master-golden.m3u8 new file mode 100644 index 0000000000..49ce3b577f --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-av-ac3-master-golden.m3u8 @@ -0,0 +1,5 @@ +#EXTM3U +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-MEDIA:TYPE=AUDIO,URI="audio.m3u8",GROUP-ID="audio",NAME="stream_0",CHANNELS="2" +#EXT-X-STREAM-INF:BANDWIDTH=1242861,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,AUDIO="audio" +video.m3u8 diff --git a/packager/app/test/testdata/bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8 b/packager/app/test/testdata/bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8 new file mode 100644 index 0000000000..0e2d846f21 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8 @@ -0,0 +1,5 @@ +#EXTM3U +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-MEDIA:TYPE=AUDIO,URI="audio.m3u8",GROUP-ID="audio",NAME="stream_0",CHANNELS="2" +#EXT-X-STREAM-INF:BANDWIDTH=1168319,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,AUDIO="audio" +video.m3u8 diff --git a/packager/app/test/testdata/bear-640x360-v-from-ts-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-from-ts-golden.mp4 new file mode 100644 index 0000000000..62124d237d Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-v-from-ts-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-v-ts-to-mp4-golden.m3u8 b/packager/app/test/testdata/bear-640x360-v-ts-to-mp4-golden.m3u8 new file mode 100644 index 0000000000..bfd8860da6 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-v-ts-to-mp4-golden.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-TARGETDURATION:2 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="output_video.mp4",BYTERANGE="823@0" +#EXTINF:1.001, +#EXT-X-BYTERANGE:99313@891 +output_video.mp4 +#EXTINF:1.001, +#EXT-X-BYTERANGE:121807 +output_video.mp4 +#EXTINF:0.734, +#EXT-X-BYTERANGE:79662 +output_video.mp4 +#EXT-X-ENDLIST diff --git a/packager/media/test/data/bear-640x360-ac3.ts b/packager/media/test/data/bear-640x360-ac3.ts new file mode 100644 index 0000000000..ef3571de9b Binary files /dev/null and b/packager/media/test/data/bear-640x360-ac3.ts differ