Avatar ·

Python and FFMPEG: Create a video with audio in one pass or otherwise speed up the process

📁 python, numpy, pip

Trying to make friends Python and FFMPEG under Windows.

It is necessary from a set of images and sound paths (stored in the memory of the program as Numpy Array) to make one long video.

I could do this in 2 passes:

  • Then I add to it audio, but I would like more optimal and faster:

& nbsp;

  ffmpeg --y --y --y - - - - - - - - - - - - RAWVIDEO -VCODEC RAWVIDEO -S 1920x1080 -pix_fmt bgr24 -r  5.00  ^ -i pipe:  0  -vcodec libx264 -perset Medium -pix_fmt yuv420p video.avi    

-I create a video

  ffmpeg -–f s16le -acodec pcm_s16le -ar  44100  -ac  1  ^ -i pipe:  0  -i video.avi -c: v h264 -c: a ac3 videoandaudio.avi    

- I add audio.

Can this be done in 1 pass? Those. Somehow it is necessary to transmit videos and audio at the same time, in 2 streams. I thought about Namedpipe, but I did not find information on the Inteet on how to create it in Windows.

PS. Offer technology, better FFMPEG, to solve the problem, if any.