Alex Balgavy

Just some stuff about me.

Here's my dotfiles repository.

Check out my blog.

My keys: PGP, SSH

My crypto wallets (BTC, XMR)

how to use ffmpeg in python

Written by John Riselvato - original link

Command line one-liners are great for quick and one off FFMPEG experiences but sooner or later you’re going to want to start building custom applications for efficiency. FFMPEG can be used with almost any programming language with a couple of simple tricks. Some languages might even have libraries of their own to extend FFMPEG natively. Below are a few examples of various languages using FFMPEG:

Python using 3rd party library ffmpy, More information: https://pypi.org/project/ffmpy/

>>> import ffmpy
>>> ff = ffmpy.FFmpeg(
...    inputs={'input.mp4': None},
...    outputs={'output.mp3': None}
... )
>>> ff.run()

Python using os.system

>>> import os
>>> os.system("ffmpeg -i input.mp4 output.mp3")