Python scripting : accessing FFMPEG

Hello,
my understanding is that Blender comes with FFMPEG to allow video encoding.
Is there a way to access this FFMPEG (or FFPROBE) module in the Scripting workspace or the python console ?

Context :
I would like to use FFMPEG/FFPROBE to get metadata and manipulate video clips in Blender VSE.
I’d like to use the built in module to avoid installing packages or reaching to an external module.

This can help?
https://docs.blender.org/api/current/bpy.types.FFmpegSettings.html

Unfortunately all these commands only allow to manage the render output settings (same as those found in the Output panel).
What I ideally would like to do is import ffmpeg in the python console to then call standard ffmpeg methods. But maybe that’s not possible ?

1 Like

So this can works maybe…
$ pip install python-ffmpeg

from ffmpeg import FFmpeg


def main():
    ffmpeg = (
        FFmpeg()
        .option("y")
        .input("input.mp4")
        .output(
            "output.mp4",
            {"codec:v": "libx264"},
            vf="scale=1280:-1",
            preset="veryslow",
            crf=24,
        )
    )

    ffmpeg.execute()


if __name__ == "__main__":
    main()

That would work for sure… but I’m specifically wondering how to use Blender’s FFMPEG to avoid installing package (because it requires internet access and might not be possible in all situations/all systems).

I have a feeling that you will probably install python-ffmpeg, then find it and open it in a python editor.

Then, pick and choose what you need and copy it to your code.

Good Luck.