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.

I've an .avi video (divx) that's at 25fps and it has mp3 audio at 64kbit/s. This video has just one image throughout the entire video.

I'm trying to convert this video to mp4 but to make it as small as possible (as there is just 1 frame really!)

I'm currently trying this:

ffmpeg -i video.avi -vcodec libx264 -acodec aac \
-ar 32000 -ab 64k -ac 2 -strict -2 -y video.mp4

But this makes an mp4 video that's similar size to .avi.

Next I tried changing frame-rate to 1fps:

ffmpeg -i video.avi -vcodec libx264 -acodec aac \
-ar 32000 -ab 64k -ac 2 -strict -2 -y -r 1 video.mp4

This made the video file much smaller (10x smaller) but it has an issue that the key-frame doesn't appear at 1st frame of the video. So the only frame in the video appears like 8 or 10 seconds in the video (!).

It looks like the problem here is that ffmpeg keeps dropping frames from video.avi and it doesn't write them to video.mp4 as keyframes. When it does write a keyframe it's late in the video.

It tried using -force_key_frames argument but that didn't help either. I did -force_key_frames 0 and -force_key_frames 1.

Does anyone know how I could create a really small mp4 video with just 1 static frame?

share|improve this question
1  
Whether it's AVI or MP4 doesn't matter, these are just containers and may include different video codecs (which determine the size). Do you have a sample of that video, maybe? Which FFmpeg version are you using? –  slhck Oct 3 '12 at 18:42
    
By definition, 64kb/s MP3 and 64kb/s AAC audio will both give you the same filesize - and transcoding such low-bitrate MP3 to any lossy codec will probably lose you noticeable quality. Just use -c:a copy for the audio, or -acodec copy for older versions of ffmpeg. –  evilsoup Feb 1 '13 at 3:25
    
Why not also just rip out the audio, make a standalone image file and re-compile it using the image file as the video input, so its not transcoding anything? –  EkriirkE May 8 at 5:57
    
Just wanted to follow up 2 years later and say that I still don't have a solution to this. My videos with just 1 static frame are still 3MB in size, when they should be 200KB. –  bodacydo Oct 7 at 0:53

3 Answers 3

ffmpeg -loop 1 -shortest -y -i image.jpg -i audio.amr -acodec copy \
-vcodec video.avi video.mp4

Remove the image and the audio separately then reassemble?

share|improve this answer
    
What you say is what I would suggest, but you don't list the command that actually separates the audio and video, as far as I can tell. –  trlkly Sep 11 at 22:24

You should check if the video-part is really a factor by separating the A/V-components

with ffmpeg this works with

#retrieve audio-only
ffmpeg -i <<VideoName>> -vn -acodec copy -f <<AudioCodec>> output.audio
#retrieve video-only
ffmpeg -i <<VideoName>> -an -vcodec copy -f <<VideoCodec>> output.video

If the video is really significant in size, one possibility would be to create a screenshot of it, and use the image as input for the video-coder, instead of recoding the videostream

see ffmpeg.org/wiki for reference

#create screenshot from video
ffmpeg -i <<VideoName>> -ss 00:00:01.0 -f image2 -vframes 1 output.screen.png

You can see on this stackoverflow-post how to make a video from a still

share|improve this answer
    
You and Shawn Fluhr seem to both have half the answer. You explain what he forgot. But I do wonder: what is this .screen image format? Is it better than saving it as, say, a lossless format like PNG? –  trlkly Sep 11 at 22:34
    
@trikly No, .screen is no format, its just how i called the output-file to show its a screenshot, changed the line to include missing format. –  Legionair Sep 12 at 14:57

If you just want to convert it, use a program called Format factory (link here: http://www.pcfreetime.com/) It can convert the file straight to mp4 for you, and you can set it to small size

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.