Add an image to mp3, and convert it to a video file using ffmpeg [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
开发者_如何学JAVA Improve this questionI have the following files:
1. a jpeg image 2. an mp3 file of some length say (3 minutes)I want to convert this to a .3gp video. How do I do it?
I've tried the following:
Created a video of zero length(time) using the jpeg image:ffmpeg -f image2 -i temp_img.jpg temp_video.mpg
Then, I tried to mix the video and audio streams as:
ffmpeg -i temp_sound.mp3 -i temp_video.mpg -vcodec mpeg video_finale.mpg
On doing this I get: some error message like "Codec could not be determined(Video:0x000)"
Please help.
Thanks.
http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs
A love these commands but have not used them in a while so looked it up for you as it should be help full.
Try creating the video from the still image using:
ffmpeg -loop_input -vframes <num_frames> -i <input_image> <output_file>
This allows you to repeat the frame as many times as you want to make a video that is not zero duration. You can also use -t <duration>
to give the length of the video in seconds instead of number of frames.
Also, the -f
argument specifies the output format, which is not image2, but is output format you want to use, like "3gp".
You can match the length of the video file up to the length of the mp3 file and then use the second command you wrote. Also, I would use -vcodec copy
in the second command so that it just copies the video data from the first step without performing a decode/encode step causing some quality to be lost.
精彩评论