7
3
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?
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 – 2014-10-07T00:53:46.347
1Whether 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 – 2012-10-03T18:42:55.050
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 copyfor the audio, or-acodec copyfor older versions of ffmpeg. – evilsoup – 2013-02-01T03:25:39.450Why 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 – 2014-05-08T05:57:39.317