Ejemplo n.º 1
0
def main():
    if len(sys.argv) < 2:
        print("Usage: check_video.py <path to video file>", file=sys.stderr)
        sys.exit(1)

    enable_logging()

    video_file = sys.argv[1]
    conf = TranscodeConfig()
    analyzer = VideoFileAnalyzer(conf)
    try:
        asyncio.run(process_video(analyzer, video_file))
    except KeyboardInterrupt:
        pass
Ejemplo n.º 2
0
def main():
    if len(sys.argv) < 2:
        print("Usage: check_video.py <path to video file>", file=sys.stderr)
        sys.exit(1)

    enable_logging()

    video_file = sys.argv[1]
    conf = TranscodeConfig()
    analyzer = VideoFileAnalyzer(conf)
    if sys.version_info < (3, 8) and platform.system() == "Windows":
        # TODO: remove after we move to requiring Python 3.8
        asyncio.set_event_loop(asyncio.ProactorEventLoop())
    try:
        asyncio.run(process_video(analyzer, video_file))
    except KeyboardInterrupt:
        pass
Ejemplo n.º 3
0
    async def asyncSetUp(self):
        await super().asyncSetUp()
        self.conf = TranscodeConfig()
        self.conf.volume_analysis_time = 0  # disable it as the test file isn't very good here
        self.analyzer = VideoFileAnalyzer(self.conf)
        file_ogg = self.make_name("ogg", ".ogg")
        self.video_file_ogg = str(file_ogg)
        if not file_ogg.exists():
            command = f'-i "{self.video_file_name}" -c:v libtheora -q:v 4 -c:a libvorbis -q:a 4 ' \
                      f'-c:s copy -c:d copy "{file_ogg}"'
            with MeasureTime(f"Creating {file_ogg.name}"):
                output, code = await self.analyzer._execute("ffmpeg", command)
                self.assertEqual(code, 0, output)

        file_webm = self.make_name("webm", ".webm")
        self.video_file_webm = str(file_webm)
        if not file_webm.exists():
            command = f'-i "{self.video_file_name}" -c:v libvpx-vp9 -crf 36 -b:v 0 -cpu-used 2 ' \
                      f'-c:a libopus -b:a 128k -c:s copy -c:d copy "{file_webm}"'
            with MeasureTime(f"Creating {file_webm.name}"):
                output, code = await self.analyzer._execute("ffmpeg", command)
                self.assertEqual(code, 0, output)