Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Sofa/GL/src/sofa/gl/VideoRecorderFFMPEG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
Loading