Score:1

How to loop an animated GIF file as a background of a music?

us flag

I have a GIF file which is 5 seconds long, and an mp3 which is about 3 minutes long.

I want to create a video where the GIF file will be the background animation (replayed repeatedly), and the mp3 audio will play.

How to do this with ffmpeg or some other tool in Ubuntu?


I tried this, but the command convert destroyed the color of the GIF, and the final video did not have any sound. Another answer mentions the software Imagination, but I could not figure out how to use it. I am looking for an answer that works for a recent version of Ubuntu, like 22.04

Score:1
cn flag

The most basic way to do it would be:

ffmpeg -stream_loop -1 -i input.gif -i audio.mp3 -shortest output.mp4

where -stream_loop -1 means looping the following input infinitely, while -shortest ends the loop when the shortest (audio) stream ends. -fflags shortest can also be added to ensure no extra length in some situations. The rest should be self-explantatory - input and output names.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.