FFMPEG: How to convert 1000 jpegs and 100 mp3 seconds into video?
So my programm generates JPegs and MP3 stereo track. I want to conve开发者_StackOverflowrt my programm results with FFMPEG to h264+aac or OGG (vorbis+theora) 100 seconds video. So how to do It from commandline at least (or using pure ffmpeg lib from C)?
Not that I've tried these commands, but from memory:
ffmpeg -i %4d.jpg -r 10 -vcodec theora -i file.mp3 -acodec vorbis out.ogg
or:
ffmpeg -i %4d.jpg -r 10 -vcodec h264 -i file.mp3 -acodec aac out.mkv
The -r is the framerate, 10 jpegs per second. These examples also assume that the JPEGs are numbered 0001.jpg to 1000.jpg. Optionally, if the JPEGs are not numbered, you can try to pipe, but I am not sure if ffmpeg has a JPEG input parser, example:
cat *.jpg | ffmpeg -vcodec jpegls -f image2pipe -i - [... rest of command after jpg input ...]
Note, none of these examples specify bitrate, output size, or anything else, you didn't mention them in your question, so not sure what you're after. For reference, you'll probably want to set a proper bitrate (-b VALUE_IN_BYTES), size (-s 1920x1080), number of audio channels (-ac X), audio bitrate (-ab XX), frequency (-ar XXXX) etc.
精彩评论