Anyone know how to combine an MP3 with a JPEG and get a valid MP4 video file using ffmpeg? My attempts at using stuff found through Google isn't working.

Trying to wean myself off of QuickTime Player 7 for this sort of thing, and or would be cool to be able to do it entirely on my phone in Termux.

@ckeen I'm trying to make a video with audio over a still image, so not really the same thing 😛

@tfb Ah thanks for letting me know! This might come in handy!

@tfb never done this but I wonder if you could convert the image to a video with imagemagick, then combine it with the audio with FFMpeg.

@tfb `fmpeg -f image2 -loop 1 -i still.jpg -i sound.mp3 -shortest video.mp4`

`-f image2` is a way to say "this input is an image". `-loop 1 -i still.jpg` turns "still.jpg" into an endless video stream.

`-i sound.mp3` tells ffmpeg what audio to use.

`-shortest` stops the encoding when the audio finishes. Without this, encoding will go on forever, since the video stream is infinite.

`video.mp4` is the output file.

@minoru Thanks for the explanation. It doesn't produce a file that anything (Mi Video nor VLC) will play though. I'm a bit suspicious of Termux's ffmpeg now ... I should retry on an Intel Linux box.

@minoru And it worked like a charm on Linux! Thanks!

Now to get ffmpeg installed on my Mac and I guess start reporting bugs to Termux.

Sign in to participate in the conversation
Functional Café

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!