ffmpeg One Liner – Still Photo + Music File = Video File

ffmpeg is one of the most powerful video/audio enoding/decoding/etc tools out there. It’s been around for donkey’s years, and used by amateurs and pros alike.

The main downside is that it’s a command line only tool, so if you’re not willing or able to “get your hands dirty” then probably just do a next on this post. If you want to to try it out, there’s plenty of guides accessible via Google et al which will shine a light on the path for you.

ffmpeg is available for Windows, Linux and Mac. ffmpeg has codecs included for just about every photo/audio/video imaginable. As one comment I spotted online eluded – ffmpeg is very very smart, more than people give it credit for.

My project was to combine a single still photo/image with a music file to produce a video, that’s potentially uploadable to YouTube. Kind of a follow on from my previous post about posting copyright music on YouTube.

So I gathered a 1920×1080 jpg photo file, and an m4a (Apple lossless encoded) file. “Installed” ffmpeg. And this is the one liner that can be used to combine photo+music into video :

c:\bin\ffmpeg\bin\ffmpeg -loop 1 -y -i Classic.Car.DSC00136.jpg -i red.face.m4a -shortest video.mp4

If you don’t know the size of the image file or have no way of cropping/resizing, then you can use this switch in the command line for Width:Height :

-vf scale=1920:1080

Go 4K, 8K or whatever you want.

On my Pentium N5000 (pretty slow basic laptop) it takes about 5 minutes.

Here’s the produced video (sorry it’s Laurent Garnier again, file was conveniently just there in my folder) :

There’s plenty else can be done with ffmpeg, but this is just an introduction for a single use case scenario.

Cheers

Don Charisma


Resources & Sources

Unless otherwise stated everything here is (c) DonCharisma.org, all rights are reserved. Copyright for music in video belongs to respective copyright holder, and is being presented here under fair use. 


Comments

Comments are often welcomed, provided you can string a legible, relevant and polite sentence together. In other cases probably best shared with your therapist, or kept to yourself.


Charisma-Writing-Banner-DonCharisma.org-1024x512



2 thoughts on “ffmpeg One Liner – Still Photo + Music File = Video File

Leave a Reply for Don Charisma

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.