ffmpeg split avi into frames with known frame rate

前端 未结 4 1051
时光取名叫无心
时光取名叫无心 2020-12-24 07:28

I posted this as comments under this related thread. However, they seem to have gone unnoticed =(

I\'ve used

ffmpeg -i myfile.avi -f image2 image-%05         


        
4条回答
  •  臣服心动
    2020-12-24 07:56

    Part one of your math is good, the 2 minutes and 29 seconds is about 149 seconds. With 1000 fps that makes 149000 frames. However your output filename only has 5 positions for the number where 149000 has 6 positions, so try "image-%06d.bmp".

    Then there is the disk size: Do your images fit on the disk? With bmp every image uses its own size. You might try to use jpeg pictures, they compress about 10 times better.

    Another idea: If ffmpeg does not find a (reasonable) frame rate, it drops to 25 or 30 frames per second. You might need to specify it. Do so for both source and target, see the man page (man ffmpeg on unix):

       To force the frame rate of the input file (valid for raw formats
       only) to 1 fps and the frame rate of the output file to 24 fps:
               ffmpeg -r 1 -i input.m2v -r 24 output.avi
    

    For what it's worth: I use ffmpeg -y -i "video.mpg" -sameq "video.%04d.jpg" to split my video to pictures. The -sameq is to force the jpeg in a reasonable quality, the -y is to avoid allow overwrite questions. For you:

    ffmpeg -y -r 1000 -i "myfile.avi" -sameq "image.%06d.jpg"

提交回复
热议问题