ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

Videotoolbox failing: The hardware encoder may be busy, or not supported.

Open skorphil opened this issue 1 year ago • 0 comments

Hi, i'm trying to run this code on Apple m1:

process = (
            ffmpeg
            .input(config.get("src_file"))
            .output(
                config.get("out_file"), 
                **{"c:v": "hevc_videotoolbox", 
                "b:v": 2000000,
                "s": "1280x720",
                "tag:v":"hcv1"}, 
                map_metadata='0'
            )
            .overwrite_output()
            .run(capture_stdout=False, capture_stderr=True)
        )

and ffmpeg returning error:

Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_videotoolbox))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[hevc_videotoolbox @ 0x7fa5bf815000] Error: cannot create compression session: -12908
[hevc_videotoolbox @ 0x7fa5bf815000] Try -allow_sw 1. The hardware encoder may be busy, or not supported.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Any way to fix this? Do i need to install additional packages or what can i do? It works only if i not specify c:v

skorphil avatar Aug 26 '24 18:08 skorphil