Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add an image to mp3, and convert it to a video file using ffmpeg [closed]

Tags:

ffmpeg

I 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.

like image 711
Samuh Avatar asked Jun 28 '10 13:06

Samuh


People also ask

Does FFmpeg work on images?

Creating a video slideshow of images with FFmpegFFmpeg is an open source command line tool that can be used to process video, audio, and other multimedia files and streams.


2 Answers

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.

like image 154
RobertPitt Avatar answered Oct 07 '22 20:10

RobertPitt


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.

like image 26
Jason B Avatar answered Oct 07 '22 20:10

Jason B