Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to generate an FLV out of an MP3 and a JPG, without uselessly looping the image and still be able to seek the audio ?

This command generates a non-seekable video:
ffmpeg -y -i audio.mp3 -i image.jpg -r 1 -acodec copy video.flv

and this one generates a seekable one, but with uselessly looping the image occupying both space and time:
ffmpeg -y -loop_input -i audio.mp3 -i image.jpg -r 1 -acodec copy video.flv -shortest

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can only seek to keyframes. Keyframes must be I-frames, that is contain a full picture. So you will have to loop the image to create the necessary I-frames for seeking.

You can set how often the I-frame is created by using the GOP (-g) option. If you really want to minimize file size, you could experiment with setting the frame-rate as low as possible and using (-g 0) to make sure each frame is an I-frame so the video is still seekable, e.g.

Keyframe every two seconds:

ffmpeg -y -loop_input -i audio.mp3 -i image.jpg -r 1/2 -g 0 -acodec copy video.flv

Keyframe every four seconds:

ffmpeg -y -loop_input -i audio.mp3 -i image.jpg -r 1/4 -g 0 -acodec copy video.flv

etc.

Also obviously compressing the JPG with a good compressor (like Photoshop's Save for Web at 60-70 quality) will also help.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.