0

OK, here's the situation:

  • I have a .mov video, recorded using QuickTime
  • I want to split it into images (which I will use in a js animation)

JS Code :

function pad(num, size) {
    var s = num+"";
    while (s.length < size) s = "0" + s;
    return s;
}


$(function(){
    var currentIndex = 1;


    setInterval(function(){
       $("#theImage").attr("src","img/video"+pad(currentIndex,3)+".png");
       currentIndex++;
    }, 1000/24);

});

So, I tried with FFMpeg :

ffmpeg -i "video.mov" -f image2 -vf fps=24 video%03d.jpg

This works. But the quality of the sprites is very low.

ffmpeg -i "video.mov" -f image2 -vf fps=24 video%03d.png

This works too. But the quality/size of the sprite is HUGE. I mean every sprite is around 110KB, with a grand total far above the video's size (100MB > 2MB!)

What's going on?

How can I achieve that, without losing any quality and still not having too deal with huge filesizes?

Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
  • Both of your commands are identical...? – evilsoup Oct 07 '14 at 14:34
  • @evilsoup The first one exports `.jpg`s and the last one `.png`s. – Dr.Kameleon Oct 07 '14 at 15:24
  • PNG is a more general image compressor than jpeg. Efficiency is very good for 'graphics' and rather poor for 'photographs'. This explains the file size difference between the two ffmpeg examples, at least. Also, video (like animated gif) uses temporal compression, storing the differences between frames. This means that compressed video is invariably more efficient than storing the frames as still images. So, a certain amount of file bloat is inevitable, if you will go with stills. If you could say a little more about the content or the project, we might be able to find other suggestions. – brennanyoung Dec 01 '14 at 10:38
  • Try tweaking the quality setting. Some information here: http://stackoverflow.com/questions/10225403/how-can-i-extract-a-good-quality-jpeg-image-from-an-h264-video-file-with-ffmpeg – brennanyoung Dec 01 '14 at 10:47
  • For people looking how to create sprites from a .mov file, I recommend [this answer](https://gist.github.com/vvo/6000388) – Daniel Apt Jul 05 '17 at 17:40

0 Answers0