imageio / imageio-ffmpeg

FFMPEG wrapper for Python
BSD 2-Clause "Simplified" License
221 stars 50 forks source link

encode with audio using file path #50

Closed ksmoore17 closed 3 years ago

ksmoore17 commented 3 years ago

Hi I made a simple change to the write_frames method to allow for an audio file to be provided. Is it within scope / would you like a pull request?

https://github.com/pierogis/imageio-ffmpeg/blob/audio/imageio_ffmpeg/_io.py#L377-L386

almarklein commented 3 years ago

Hi, that's interesting. I think it could be useful for others, so if we can add this without complicating the API and/or source too much, it's probably worth it, yes!

ksmoore17 commented 3 years ago

Ok gotcha, I will also add a param to provide the audio codec for output and look into using an audio buffer (like the video) as an alternative to a file.

edit: I checked out how one might do audio input as a buffer alongside the frames pipe. My hope was to send each frame in the same loop as each audio sample (or something) instead of pulling from an audio path. It would probably require mkfifo (unix only) to create a named pipe... It's far easier to just save a wav before encoding the frames.

almarklein commented 3 years ago

Closed by #51