diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
index 3f35abe..9229cd2 100644
--- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
+++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
@@ -399,6 +399,26 @@ void Ffmpeg::getFramesFromMovie(int frame) {
   }
 }
 
+int Ffmpeg::getGifFrameCount() {
+  int frame               = 1;
+  QString ffmpegCachePath = getFfmpegCache().getQString();
+  QString tempPath        = ffmpegCachePath + "//" +
+                     QString::fromStdString(m_path.getName()) +
+                     QString::fromStdString(m_path.getType());
+  std::string tmpPath = tempPath.toStdString();
+  QString tempName    = "In%04d." + m_intermediateFormat;
+  tempName            = tempPath + tempName;
+  QString tempStart;
+  tempStart = "In0001." + m_intermediateFormat;
+  tempStart = tempPath + tempStart;
+  while (TSystem::doesExistFileOrLevel(TFilePath(tempStart))) {
+    frame++;
+    QString number = QString("%1").arg(frame, 4, 10, QChar('0'));
+    tempStart      = tempPath + "In" + number + "." + m_intermediateFormat;
+  }
+  return frame - 1;
+}
+
 void Ffmpeg::addToCleanUp(QString path) {
   if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
     m_cleanUpList.push_back(path);
diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.h b/toonz/sources/image/ffmpeg/tiio_ffmpeg.h
index 4b3fe4f..853110a 100644
--- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.h
+++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.h
@@ -41,6 +41,7 @@ public:
   TFilePath getFfmpegCache();
   ffmpegFileInfo getInfo();
   void disablePrecompute();
+  int getGifFrameCount();
 
 private:
   QString m_intermediateFormat, m_ffmpegPath, m_audioPath, m_audioFormat;
diff --git a/toonz/sources/image/ffmpeg/tiio_gif.cpp b/toonz/sources/image/ffmpeg/tiio_gif.cpp
index 089461d..f410ddd 100644
--- a/toonz/sources/image/ffmpeg/tiio_gif.cpp
+++ b/toonz/sources/image/ffmpeg/tiio_gif.cpp
@@ -190,7 +190,7 @@ TLevelReaderGif::TLevelReaderGif(const TFilePath &path)
   m_ly                    = m_size.ly;
 
   ffmpegReader->getFramesFromMovie();
-
+  m_frameCount = ffmpegReader->getGifFrameCount();
   // set values
   m_info                   = new TImageInfo();
   m_info->m_frameRate      = fps;