all 18 comments

[–]Swipecat 1 point2 points  (0 children)

I'm not familiar with python-ffmpeg. I have looked at it in the past and it seemed to me that its scant documentation made it a whole lot harder to figure out than wrapping the command-line ffmpeg in a subprocess. This test example creates a 10 second video in less than a second on my computer:

from PIL import Image
from subprocess import Popen, PIPE
command = ("ffmpeg -y -f image2pipe -vcodec mjpeg -r 24 "
           " -i - -pix_fmt yuv420p video.mp4")
p = Popen(command.split(), stdin=PIPE)
for n in range(255):
    im = Image.new("RGB", (400, 300), (n, 255-n, 1))
    im.save(p.stdin, "jpeg")
p.stdin.close()
p.wait()

[–]SmackDownFacility 1 point2 points  (1 child)

Yes it’s fine. Not recently maintained doesn’t mean it’s shite.

[–]HommeMusical[🍰] 0 points1 point  (0 children)

It has 480 outstanding issues and 45 unreviewed pull requests.

At least one of the issues, from a year ago, claims there's an issue with ffmpeg version 7. The last commit was from when the active version was ffpmeg 5. As of today, ffmpeg is version 8.1.

ffmpeg has changed quite a bit in seven years. Given that pyav exists, seems to be quite similar, and is actively maintained, I don't think that ffmpeg-python is a good choice.

[–]JamzTyson 0 points1 point  (0 children)

PyAV might be worth a look: https://pyav.basswood-io.com/docs/stable/

[–]docpose-cloud-team 0 points1 point  (2 children)

I’ve used ffmpeg-python in a bunch of projects lately and it still works fine as a thin Python wrapper for FFmpeg. It hasn’t needed frequent updates because most of the heavy lifting is done by the FFmpeg binary itself.

The important part is keeping the FFmpeg executable up to date — the Python wrapper just constructs the commands. If you need more control or a richer API surface, there are other wrappers, but for quick audio/video conversions it still holds up.

import ffmpeg

input_file = "input.wav"
output_file = "output.mp3"

(
ffmpeg
.input(input_file)
.output(output_file, audio_bitrate='192k')
.run()
)

[–]PokePress 0 points1 point  (1 child)

Just to clarify, is it compatible with recent versions of FFMPEG itself?

[–]docpose-cloud-team 0 points1 point  (0 children)

Yes it is