FFMPEG GIF转PNG FRAMES帧的一些特性

in 前端 with 0 comment

使用
ffmpeg -i INPUT_GIF
可以查看gif的一些元数据,如下

Input #0, gif, from '.\17319227.gif':
  Duration: 00:00:01.59, start: 0.000000, bitrate: 3516 kb/s
    Stream #0:0: Video: gif, bgra, 300x206, 12.08 fps, 100 tbr, 100 tbn, 100 tbc

我们主要关注Duration和下面的fps以及tbr
按照文档说明
tbn = the time base in AVStream that has come from the container
tbc = the time base in AVCodecContext for the codec used for a particular stream
tbr = tbr is guessed from the video stream and is the value users want to see when they look for the video frame rate

当使用如下命令,将GIF转为PNG帧的时候

ffmpeg -i .\17319227.gif xxoo\frame%04d.png

实际上ffmpeg是按照tbr参数来转换的。并不是我们猜想的FPS参数。所以上面将会转换成159张图片。

Comments are closed.