jonghwanhyeon / python-ffmpeg

A python binding for FFmpeg which provides sync and async APIs
MIT License
287 stars 50 forks source link

Support for multiple input streams via pipes #43

Open JohnnyRacer opened 9 months ago

JohnnyRacer commented 9 months ago

Hello, I would like to execute some code to overlay images on a video, this works fine using filepaths, but I would really prefer loading everything via bytes and streaming in the data. I tried the following snippet and got an error : FFmpeg.execute() takes from 1 to 2 positional arguments but 3 were given

overlay = (
    FFmpeg()
    .option("y")
    .input("pipe:0")
    .input("pipe:1")
    .option("filter_complex", "[1:v]format=argb,geq=r='r(X,Y)':a='alpha(X,Y)'[zork];[0:v][zork]overlay")
    .output("test.mp4", vcodec="libx264")
)

overlay = overlay.execute(vid_bytes,image_bytes)

Is there a way to achieve this already or can it be implemented in the future. I would be happy to open a PR and implement if needed.

JohnnyRacer commented 9 months ago

Seems like this could be possible with some shell magic from StackOverflow