How to use the av.VideoFormat function in av

To help you get started, we’ve selected a few av examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikeboers / PyAV / tests / test_codec.py View on Github external
c = Codec('mpeg4', 'w')
        self.assertEqual(c.name, 'mpeg4')
        self.assertEqual(c.long_name, 'MPEG-4 part 2')
        self.assertEqual(c.type, 'video')
        self.assertIn(c.id, (12, 13))
        self.assertTrue(c.is_encoder)
        self.assertFalse(c.is_decoder)

        # audio
        self.assertIsNone(c.audio_formats)
        self.assertIsNone(c.audio_rates)

        # video
        formats = c.video_formats
        self.assertTrue(formats)
        self.assertIsInstance(formats[0], VideoFormat)
        self.assertTrue(any(f.name == 'yuv420p' for f in formats))

        self.assertIsNone(c.frame_rates)
github mikeboers / PyAV / tests / test_videoformat.py View on Github external
def test_yuv420p_inspection(self):
        fmt = VideoFormat('yuv420p', 640, 480)
        self.assertEqual(fmt.name, 'yuv420p')
        self.assertEqual(len(fmt.components), 3)
        self._test_yuv420(fmt)
github mikeboers / PyAV / tests / test_videoformat.py View on Github external
def test_pal8_inspection(self):
        fmt = VideoFormat('pal8', 640, 480)
        self.assertEqual(len(fmt.components), 1)
        self.assertTrue(fmt.has_palette)
github mikeboers / PyAV / tests / test_videoformat.py View on Github external
def test_rgb24_inspection(self):
        fmt = VideoFormat('rgb24', 640, 480)
        self.assertEqual(fmt.name, 'rgb24')
        self.assertEqual(len(fmt.components), 3)
        self.assertFalse(fmt.is_planar)
        self.assertFalse(fmt.has_palette)
        self.assertTrue(fmt.is_rgb)
        self.assertEqual(fmt.chroma_width(), 640)
        self.assertEqual(fmt.chroma_height(), 480)
        self.assertEqual(fmt.chroma_width(1024), 1024)
        self.assertEqual(fmt.chroma_height(1024), 1024)
        for i in range(3):
            comp = fmt.components[i]
            self.assertEqual(comp.plane, 0)
            self.assertEqual(comp.bits, 8)
            self.assertFalse(comp.is_luma)
            self.assertFalse(comp.is_chroma)
            self.assertFalse(comp.is_alpha)
github mikeboers / PyAV / tests / test_videoformat.py View on Github external
def test_yuva420p_inspection(self):
        fmt = VideoFormat('yuva420p', 640, 480)
        self.assertEqual(len(fmt.components), 4)
        self._test_yuv420(fmt)
        self.assertFalse(fmt.components[3].is_chroma)
        self.assertEqual(fmt.components[3].width, 640)
github mikeboers / PyAV / tests / test_codec.py View on Github external
self.assertEqual(c.name, 'mpeg4')
        self.assertEqual(c.long_name, 'MPEG-4 part 2')
        self.assertEqual(c.type, 'video')
        self.assertIn(c.id, (12, 13))
        self.assertTrue(c.is_decoder)
        self.assertFalse(c.is_encoder)

        # audio
        self.assertIsNone(c.audio_formats)
        self.assertIsNone(c.audio_rates)

        # video
        formats = c.video_formats
        self.assertTrue(formats)
        self.assertIsInstance(formats[0], VideoFormat)
        self.assertTrue(any(f.name == 'yuv420p' for f in formats))

        self.assertIsNone(c.frame_rates)
github mikeboers / PyAV / tests / test_videoformat.py View on Github external
def test_gray16be_inspection(self):
        fmt = VideoFormat('gray16be', 640, 480)
        self.assertEqual(fmt.name, 'gray16be')
        self.assertEqual(len(fmt.components), 1)
        self.assertFalse(fmt.is_planar)
        self.assertFalse(fmt.has_palette)
        self.assertFalse(fmt.is_rgb)
        self.assertEqual(fmt.chroma_width(), 640)
        self.assertEqual(fmt.chroma_height(), 480)
        self.assertEqual(fmt.chroma_width(1024), 1024)
        self.assertEqual(fmt.chroma_height(1024), 1024)
        comp = fmt.components[0]
        self.assertEqual(comp.plane, 0)
        self.assertEqual(comp.bits, 16)
        self.assertTrue(comp.is_luma)
        self.assertFalse(comp.is_chroma)
        self.assertEqual(comp.width, 640)
        self.assertEqual(comp.height, 480)