diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 6d5340bdb4..cec5d39419 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -104,6 +104,24 @@ class PackagerAppTest(unittest.TestCase): self._DiffGold(self.output[2], 'subtitle-english-golden.vtt') self._DiffGold(self.mpd_output, 'bear-640x360-avt-golden.mpd') + def testPackageVp8Webm(self): + self.packager.Package( + self._GetStreams(['video'], + output_format='webm', + test_files=['bear-640x360.webm']), + self._GetFlags()) + self._DiffGold(self.output[0], 'bear-640x360-vp8-golden.webm') + self._DiffGold(self.mpd_output, 'bear-640x360-vp8-webm-golden.mpd') + + def testPackageVp9Webm(self): + self.packager.Package( + self._GetStreams(['video'], + output_format='webm', + test_files=['bear-320x240-vp9.webm']), + self._GetFlags()) + self._DiffGold(self.output[0], 'bear-320x240-vp9-golden.webm') + self._DiffGold(self.mpd_output, 'bear-320x240-vp9-webm-golden.mpd') + def testPackageWithEncryption(self): self.packager.Package( self._GetStreams(['audio', 'video']), @@ -120,6 +138,24 @@ class PackagerAppTest(unittest.TestCase): self._DiffGold(self.output[0], 'bear-640x360-hevc-v-cenc-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-hevc-v-cenc-golden.mpd') + def testPackageVp8Mp4WithEncryption(self): + self.packager.Package( + self._GetStreams(['video'], + output_format='mp4', + test_files=['bear-640x360.webm']), + self._GetFlags(encryption=True)) + self._DiffGold(self.output[0], 'bear-640x360-vp8-cenc-golden.mp4') + self._DiffGold(self.mpd_output, 'bear-640x360-vp8-cenc-golden.mpd') + + def testPackageVp9Mp4WithEncryption(self): + self.packager.Package( + self._GetStreams(['video'], + output_format='mp4', + test_files=['bear-320x240-vp9.webm']), + self._GetFlags(encryption=True)) + self._DiffGold(self.output[0], 'bear-320x240-vp9-cenc-golden.mp4') + self._DiffGold(self.mpd_output, 'bear-320x240-vp9-cenc-golden.mpd') + def testPackageWithEncryptionAndRandomIv(self): self.packager.Package( self._GetStreams(['audio', 'video']), @@ -277,7 +313,11 @@ class PackagerAppTest(unittest.TestCase): self._AssertStreamInfo(self.output[0], 'is_encrypted: true') self._AssertStreamInfo(self.output[1], 'is_encrypted: true') - def _GetStreams(self, stream_descriptors, live=False, test_files=None): + def _GetStreams(self, + stream_descriptors, + output_format='mp4', + live=False, + test_files=None): if test_files is None: test_files = ['bear-640x360.mp4'] streams = [] @@ -299,18 +339,20 @@ class PackagerAppTest(unittest.TestCase): output_prefix)) self.output.append(output_prefix) else: - output = '%s.%s' % (output_prefix, - self._GetExtension(stream_descriptor)) - stream = 'input=%s,stream=%s,output=%s' - streams.append(stream % (test_file, stream_descriptor, output)) + output = '%s.%s' % ( + output_prefix, + self._GetExtension(stream_descriptor, output_format)) + stream = 'input=%s,stream=%s,format=%s,output=%s' + streams.append(stream % + (test_file, stream_descriptor, output_format, output)) self.output.append(output) return streams - def _GetExtension(self, stream_descriptor): + def _GetExtension(self, stream_descriptor, output_format): # TODO(rkuroiwa): Support ttml. if stream_descriptor == 'text': return 'vtt' - return 'mp4' + return output_format def _GetFlags(self, encryption=False, @@ -364,7 +406,8 @@ class PackagerAppTest(unittest.TestCase): def _DiffGold(self, test_output, golden_file_name): golden_file = os.path.join(self.golden_file_dir, golden_file_name) if test_env.options.test_update_golden_files: - if not filecmp.cmp(test_output, golden_file): + if not os.path.exists(golden_file) or not filecmp.cmp(test_output, + golden_file): print 'Updating golden file: ', golden_file_name shutil.copyfile(test_output, golden_file) else: diff --git a/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mp4 b/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mp4 new file mode 100644 index 0000000000..0d8f9a29b5 Binary files /dev/null and b/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mpd b/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mpd new file mode 100644 index 0000000000..9e2d07b1ab --- /dev/null +++ b/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mpd @@ -0,0 +1,18 @@ + + + + + + + + + AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAxMjM0NTY3ODkwMTIzNDU2 + + output_video.mp4 + + + + + + + diff --git a/packager/app/test/testdata/bear-320x240-vp9-golden.webm b/packager/app/test/testdata/bear-320x240-vp9-golden.webm new file mode 100644 index 0000000000..14e818fb6d Binary files /dev/null and b/packager/app/test/testdata/bear-320x240-vp9-golden.webm differ diff --git a/packager/app/test/testdata/bear-320x240-vp9-webm-golden.mpd b/packager/app/test/testdata/bear-320x240-vp9-webm-golden.mpd new file mode 100644 index 0000000000..33ea51e142 --- /dev/null +++ b/packager/app/test/testdata/bear-320x240-vp9-webm-golden.mpd @@ -0,0 +1,14 @@ + + + + + + + output_video.webm + + + + + + + diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4 new file mode 100644 index 0000000000..e28348623b Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd new file mode 100644 index 0000000000..e864825545 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd @@ -0,0 +1,18 @@ + + + + + + + + + AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAxMjM0NTY3ODkwMTIzNDU2 + + output_video.mp4 + + + + + + + diff --git a/packager/app/test/testdata/bear-640x360-vp8-golden.webm b/packager/app/test/testdata/bear-640x360-vp8-golden.webm new file mode 100644 index 0000000000..6acb9f52ed Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-vp8-golden.webm differ diff --git a/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd new file mode 100644 index 0000000000..339f8040b4 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd @@ -0,0 +1,14 @@ + + + + + + + output_video.webm + + + + + + + diff --git a/packager/media/test/data/README b/packager/media/test/data/README index a3caba0137..007ae3fe60 100644 --- a/packager/media/test/data/README +++ b/packager/media/test/data/README @@ -3,6 +3,7 @@ // found in the LICENSE file. bear-320x240.webm - WebM encode of bear.1280x720.mp4 resized to 320x240. +bear-320x240-vp9.webm - Same as above, but with vp9 codec. no_streams.webm - Header, Info, & Tracks element from bear-320x240.webm slightly corrupted so it looks like there are no tracks. nonzero-start-time.webm - Has the same headers as bear-320x240.webm but the first cluster of this file diff --git a/packager/media/test/data/bear-320x240-vp9.webm b/packager/media/test/data/bear-320x240-vp9.webm new file mode 100644 index 0000000000..916d9a1606 Binary files /dev/null and b/packager/media/test/data/bear-320x240-vp9.webm differ diff --git a/packager/media/test/data/bear-vp9-opus.webm b/packager/media/test/data/bear-vp9-opus.webm deleted file mode 100644 index f7812c2603..0000000000 Binary files a/packager/media/test/data/bear-vp9-opus.webm and /dev/null differ diff --git a/packager/media/test/data/bear-vp9.webm b/packager/media/test/data/bear-vp9.webm deleted file mode 100644 index d080589e23..0000000000 Binary files a/packager/media/test/data/bear-vp9.webm and /dev/null differ