193
63
This should be pretty trivial, but I can't find a way to get it to work.
I want FFmpeg to take one JPEG image and an audio file as input and generate a video file of the same duration as the audio file (by stretching the still image for the whole duration).
I don't care very much about what video codec is used for output, but it is vital that I can use "copy" as the audio codec (i.e. copy the audio stream without transcoding it).
What is the right command line that would do that?
I tried:
ffmpeg -i image8.jpg -i sound11.amr -acodec copy test.avi
and tried a lot of combinations with and without -s 640x360
, -loop_input
, -shortest
, -t xxx
, -r 0.1
(artificially low frame rate in the hope that the video would be longer) and -f image2
Either I get errors or I get a video file of the duration of one frame.
I've googled around and found a dozen of proposed solutions (supposedly to this very same question) none of which works.
Can anybody suggest a working command and explain the rationale behind it?
I just tried your command line and it worked as expected. Your problem might lie with the sound format. Does transcoding the sound work? – Captain Giraffe – 2011-05-04T17:49:31.357
By "as expected" do you mean the resulting video has the same duration as the audio input? Have you played it? Isn't it one-frame-long? – matteo – 2011-05-04T17:59:08.727
Sound format is not the problem, transcoding the sound works – matteo – 2011-05-04T17:59:25.917
I had a order of params issue too and it cost me hours! Too bad these sorts of problems aren't covered in the help. http://gregoire.org/2009/12/05/fun-with-ffmpeg/
– Paul Gregoire – 2011-05-19T13:20:28.093Hi, I am also searching a way to create a video by combining an audio file and an image, within the android code. I figured out the command for that: ffmpeg -i allmapeople.mp3 -i Penguins.jpg video_finale.mpg I tried many 2 tutorials using ffmpeg that generates the .so file. But I still could not find out a way to combine an audio and an image. Please help me!!! – TharakaNirmana – 2013-01-15T05:21:09.277
4this is better than chosen answer, i experimented and it's fast and file size is small..
ffmpeg -y -i image.png -i audio.mp3 -c:a copy result.avi
– Muhammad Umer – 2014-07-07T06:05:02.217related: https://stackoverflow.com/questions/25381086/convert-mp3-video-with-static-image-ffmpeg-libav-bash
– Ciro Santilli 新疆改造中心法轮功六四事件 – 2018-09-01T07:59:43.730@MuhammadUmer Youtube can't process video created this way. – Eric Wang – 2020-02-12T22:04:53.277
This answer works: https://askubuntu.com/a/868831/216272
– Eric Wang – 2020-02-12T22:11:19.617