From f5ac82b942c85d8ff18689aa3d92bc69dd169f18 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 19 Jan 2026 15:05:13 +0100 Subject: [PATCH] Take special case where given path isn't empty but doesn't point to a real file --- Sofa/GL/src/sofa/gl/VideoRecorderFFMPEG.cpp | 23 +++++++++++---------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Sofa/GL/src/sofa/gl/VideoRecorderFFMPEG.cpp b/Sofa/GL/src/sofa/gl/VideoRecorderFFMPEG.cpp index 4ec9d904e7b..8fee37595ea 100644 --- a/Sofa/GL/src/sofa/gl/VideoRecorderFFMPEG.cpp +++ b/Sofa/GL/src/sofa/gl/VideoRecorderFFMPEG.cpp @@ -87,23 +87,23 @@ bool VideoRecorderFFMPEG::init(const std::string& ffmpeg_exec_filepath, const st m_ffmpegBuffer = new unsigned char [m_ffmpegBufferSize]; m_FrameCount = 0; - + std::string extension; +#ifdef WIN32 + extension = ".exe"; +#endif m_ffmpegExecPath = ffmpeg_exec_filepath; if(m_ffmpegExecPath.empty()) { - std::string extension; -#ifdef WIN32 - extension = ".exe"; -#endif m_ffmpegExecPath = helper::Utils::getExecutablePath() + "/ffmpeg" + extension; - if(!FileSystem::isFile(m_ffmpegExecPath, true)) - { - msg_warning("VideoRecorderFFMPEG")<< "ffmpeg hasn't been found automatically. Falling back to simply calling ffmpeg"<< extension <<" and hope that the OS finds it on its own. " ; - // Fallback to a relative FFMPEG (may be in system or exposed in PATH) - m_ffmpegExecPath = "ffmpeg" + extension; - } + } + if(!FileSystem::isFile(m_ffmpegExecPath, true)) + { + msg_warning("VideoRecorderFFMPEG")<< "ffmpeg hasn't been found automatically. Falling back to simply calling ffmpeg"<< extension <<" and hope that the OS finds it on its own. " ; + // Fallback to a relative FFMPEG (may be in system or exposed in PATH) + m_ffmpegExecPath = "ffmpeg" + extension; } + std::stringstream ss; ss << m_ffmpegExecPath << " -r " << m_framerate @@ -123,6 +123,7 @@ bool VideoRecorderFFMPEG::init(const std::string& ffmpeg_exec_filepath, const st #else m_ffmpeg = popen(command_line.c_str(), "w"); #endif + if (m_ffmpeg == nullptr) { msg_error("VideoRecorderFFMPEG") << "ffmpeg process failed to open (error " << errno << "). Command line : " << command_line; return false;