Exemple #1
0
    def test_probe(self):
        name = 'test.mp4'
        cmd = command.probe(name, tool=tool)

        self.assertEqual(cmd[:3], [tool, '-v', 'quiet'])
        self.assertIn('-show_format', cmd)
        self.assertIn('-show_streams', cmd)
        self.assertNotIn('-show_packets', cmd)
        self.assertEqual(cmd[-1], name)
Exemple #2
0
    def probe(self, json=False, **kw):
        """ Get the `ffprobe` information in a dict-like object

        :param json: Use the `json` print format. Disabled by default
        :param kw: Other kw arguments to `command.probe` function
        :return: Parsed output in a dict
        """
        if self._probe is None or DEBUG >= 2:
            sout, _ = proc.run_local(command.probe(self.filename, json=json, **kw))
            sout = sout.decode()
            if json:
                self._probe = json.loads(sout)
            else:
                self._probe = parse.probe(sout)
        return self._probe