Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

moved ffmpeg temp files to cache folder (#921)

Jeremy Bullockedaab7f46d48
diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
index 9dd86a1c4..fc147d925 100644
--- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
+++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
@@ -100,7 +100,8 @@ 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 tempPath = getFfmpegCache().getQString() + "//" +
+ QString::fromStdString(m_path.getName()) + "tempOut" +
QString::number(m_frameCount) + "." + m_intermediateFormat;
std::string saveStatus = "";
TRasterImageP tempImage(img);
@@ -137,8 +138,9 @@ void Ffmpeg::createIntermediateImage(const TImageP &img, int frameIndex) {
void Ffmpeg::runFfmpeg(QStringList preIArgs, QStringList postIArgs,
bool includesInPath, bool includesOutPath,
bool overWriteFiles) {
- QString tempName = "tempOut%d." + m_intermediateFormat;
- tempName = m_path.getQString() + tempName;
+ QString tempName = "//" + QString::fromStdString(m_path.getName()) +
+ "tempOut%d." + m_intermediateFormat;
+ tempName = getFfmpegCache().getQString() + tempName;
QStringList args;
args = args + preIArgs;
@@ -189,7 +191,8 @@ void Ffmpeg::saveSoundTrack(TSoundTrack *st) {
int bufSize = st->getSampleCount() * st->getSampleSize();
const UCHAR *buffer = st->getRawData();
- m_audioPath = m_path.getQString() + "tempOut.raw";
+ m_audioPath = getFfmpegCache().getQString() + "//" +
+ QString::fromStdString(m_path.getName()) + "tempOut.raw";
m_audioFormat = "s" + QString::number(m_bitsPerSample);
if (m_bitsPerSample > 8) m_audioFormat = m_audioFormat + "le";
std::string strPath = m_audioPath.toStdString();
diff --git a/toonz/sources/image/ffmpeg/tiio_gif.cpp b/toonz/sources/image/ffmpeg/tiio_gif.cpp
index 0676b9145..18356e6a2 100644
--- a/toonz/sources/image/ffmpeg/tiio_gif.cpp
+++ b/toonz/sources/image/ffmpeg/tiio_gif.cpp
@@ -74,7 +74,8 @@ TLevelWriterGif::~TLevelWriterGif() {
QString filters = "scale=" + QString::number(outLx) + ":-1:flags=lanczos";
QString paletteFilters = filters + " [x]; [x][1:v] paletteuse";
if (m_palette) {
- palette = m_path.getQString() + "palette.png";
+ palette = ffmpegWriter->getFfmpegCache().getQString() + "//" +
+ QString::fromStdString(m_path.getName()) + "palette.png";
palettePreIArgs << "-v";
palettePreIArgs << "warning";