예제 #1
0
    def test_h265_1080p_5_1(self):
        length = 3
        with create_test_video(length=length,
                               video_def=VideoDefinition(
                                   Resolution.HIGH_DEF, VideoCodec.H265,
                                   VideoFileContainer.MKV),
                               audio_defs=[
                                   AudioDefition(AudioCodec.AAC,
                                                 AudioChannelName.SURROUND_5_1)
                               ]) as file:
            metadata = create_metadata_extractor().extract(file.name)
            self.assertEqual(1, len(metadata.video_streams))
            self.assertEqual(1, len(metadata.audio_streams))

            v = metadata.video_streams[0]
            a = metadata.audio_streams[0]

            self.assertEqual(VideoCodec.H265.ffmpeg_codec_name, v.codec)
            self.assertEqual(length, v.duration)
            self.assertEqual(Resolution.HIGH_DEF.width, v.width)
            self.assertEqual(Resolution.HIGH_DEF.height, v.height)

            self.assertEqual(AudioCodec.AAC.ffmpeg_codec_name, a.codec)
            assertAudioLength(length, a.duration)
            self.assertEqual(6, a.channels)
예제 #2
0
    def test_2_files(self):
        with create_test_video(length=5, video_def=MP4_VIDEO_DEF) as first, \
                create_test_video(length=5, video_def=MP4_VIDEO_DEF) as second:
            with NamedTemporaryFile(suffix='.mp4') as output:
                concat_mp4(output.name,
                           files=[first.name, second.name],
                           overwrite=True)
                metadata = create_metadata_extractor().extract(output.name)
                self.assertEqual(1, len(metadata.video_streams))
                self.assertEqual(10, int(metadata.video_streams[0].duration))

                self.assertEqual(1, len(metadata.audio_streams))
                self.assertEqual('aac', metadata.audio_streams[0].codec)
                self.assertEqual(2, metadata.audio_streams[0].channels)
                assertAudioLength(10, metadata.audio_streams[0].duration)
예제 #3
0
    def test_h264_stereo(self):
        length = 5
        with create_test_video(length=length) as file:
            metadata = create_metadata_extractor().extract(file.name)
            self.assertEqual(1, len(metadata.video_streams))
            self.assertEqual(1, len(metadata.audio_streams))

            v = metadata.video_streams[0]
            a = metadata.audio_streams[0]

            self.assertEqual(VideoCodec.H264.ffmpeg_codec_name, v.codec)
            self.assertEqual(length, v.duration)
            self.assertEqual(Resolution.LOW_DEF.width, v.width)
            self.assertEqual(Resolution.LOW_DEF.height, v.height)

            self.assertEqual(AudioCodec.AAC.ffmpeg_codec_name, a.codec)
            assertAudioLength(length, a.duration)
            self.assertEqual(2, a.channels)
예제 #4
0
    def test_mpeg2(self):
        length = 5
        with create_test_video(
                length=length,
                video_def=VideoDefinition(codec=VideoCodec.MPEG2)) as file:
            metadata = create_metadata_extractor().extract(file.name, True)
            self.assertEqual(1, len(metadata.video_streams))
            self.assertEqual(1, len(metadata.audio_streams))
            self.assertFalse(metadata.interlace_report.is_interlaced())

            v = metadata.video_streams[0]
            a = metadata.audio_streams[0]

            self.assertEqual(VideoCodec.MPEG2.ffmpeg_codec_name, v.codec)
            self.assertEqual(length, v.duration)
            self.assertEqual(Resolution.LOW_DEF.width, v.width)
            self.assertEqual(Resolution.LOW_DEF.height, v.height)

            self.assertEqual(AudioCodec.AAC.ffmpeg_codec_name, a.codec)
            assertAudioLength(length, a.duration)
            self.assertEqual(2, a.channels)