I am using the following command to encode an AVI to an H264 video for use in an HTML5 video tag:
ffmpeg -y -i "test.avi" -vcodec libx264 -vpre slow -vpre baseline -g 30 "out.mp4"
And this works just fine. But I also want to create a placeholder video (long story) from a single still image, so I do this:
ffmpeg -y -i "test.jpg" -vcodec libx264 -vpre slow -vpre baseline -g 30 "out.mp4"
And this doesn’t work. What gives?
EDIT: After trying LordNeckbeards answer, here is my full output: http://pastebin.com/axhKpkLx
Example for a 10 second output:
Same thing but with audio. The output duration will match the input audio duration:
-loop 1loops the image input.-frameratesets the frame rate of the image input. Default is 25. Some players have issues with low frame rates so a value over 6 or so is recommended.-i input.jpgthe input.-c:v libx264the H.264 video encoder.-presetx264 encoding preset. Use the slowest one you can.-tunex264 tuning for various adjustments to fit specific situations.-crffor quality. A lower value results in higher quality. Use the highest value that still provides an acceptable quality to you. Default is 23.-vf format=yuv420poutputs the pixel format asyuv420p. This ensures the output uses a widely acceptable chroma sub-sampling scheme. Recommended for libx264 when encoding from images.-c:a aacthe AAC audio encoder. If your input is already AAC or M4A then use -c:a copy instead to stream copy instead of re-encode.-t 10(in the first example) makes a 10 second output. Needed because the image is looping indefinitely.-shortest(in the second example) makes the output the same duration as the shortest input. In this case it is the audio since the image is looping indefinitely.-movflags +faststartrelocates the moov atom to the beginning of the file after encoding is finished. Allows playback to begin faster in progressive download playing; otherwise the whole video must be downloaded before playing.-profile:v main(optional) some devices can’t handle High profile.See FFmpeg Wiki: H.264 for more info.