Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine one image + one audio file to make one video #274

Open
TVart opened this issue Oct 1, 2019 · 4 comments
Open

Combine one image + one audio file to make one video #274

TVart opened this issue Oct 1, 2019 · 4 comments

Comments

@TVart
Copy link

TVart commented Oct 1, 2019

Hi,

I'm looking for creating a video combining 1 image and 1 audio with ffmpeg-python.

Here the command i use to run for this purpose
ffmpeg -loop 1 -i image.jpg -i audio.wav -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4
So couldn't find way to translate it in your framework

Thanks for your help.
Rgds.

@spirulence
Copy link

spirulence commented Oct 28, 2019

@TVart I didn't replicate your specific tuning options, but one general form would be

import ffmpeg


input_still = ffmpeg.input("image.jpg")
input_audio = ffmpeg.input("audio.wav")

(
    ffmpeg
    .concat(input_still, input_audio, v=1, a=1)
    .output("output.mp4")
    .run(overwrite_output=True)
)

@lbshopping
Copy link

@TVart I didn't replicate your specific tuning options, but one general form would be

import ffmpeg


input_still = ffmpeg.input("image.jpg")
input_audio = ffmpeg.input("audio.wav")

(
    ffmpeg
    .concat(input_still, input_audio, v=1, a=1)
    .output("output.mp4")
    .run(overwrite_output=True)
)

Is it possible to use the same syntax with two images instead of one?

@miaohf
Copy link

miaohf commented Jul 29, 2021

If you don't add " loop=1" to it, the image will only in the first frame.
That's not the right format.
some video player will report error and youtube banned it.

good luck.

@TVart
Copy link
Author

TVart commented Sep 23, 2021

Thank you for the trick, now I hav the following situation
A have 3 images and 3 audio tracks
And I need to combine them as following to build my video
1.jpg should take duration of the track 1.mp3 => sequence 1
2.jpg should take duration of the track 2.mp3 => sequence 2
3.jpg should take duration of the track 3.mp3 => sequence 3

So my video is the result of the concatenation of theses 3 sequences in this order
sequence1 + sequence2 + sequence3

Thanks a lot for your support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants