diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
index ae04e11..9dd86a1 100644
--- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
+++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
@@ -99,8 +99,9 @@ void Ffmpeg::setFrameRate(double fps) { m_frameRate = fps; }
 void Ffmpeg::setPath(TFilePath path) { m_path = path; }
 
 void Ffmpeg::createIntermediateImage(const TImageP &img, int frameIndex) {
+  m_frameCount++;
   QString tempPath = m_path.getQString() + "tempOut" +
-                     QString::number(frameIndex) + "." + m_intermediateFormat;
+                     QString::number(m_frameCount) + "." + m_intermediateFormat;
   std::string saveStatus = "";
   TRasterImageP tempImage(img);
   TRasterImage *image = (TRasterImage *)tempImage->cloneImage();
@@ -128,7 +129,7 @@ void Ffmpeg::createIntermediateImage(const TImageP &img, int frameIndex) {
   qi->save(tempPath, format, -1);
   free(buffer);
   m_cleanUpList.push_back(tempPath);
-  m_frameCount++;
+
   delete qi;
   delete image;
 }