{"record":{"id":"8853bd1b8c21889a","repo":"Yalantis/uCrop","slug":"load-ffmpeg-external-specified-filename-is-nul","errorCode":null,"errorMessage":"load_ffmpeg_external(): Specified filename is (null) or does not exist.","messagePattern":"load_ffmpeg_external\\(\\): Specified filename is \\(null\\) or does not exist\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":67457,"sourceCode":"                              cimglist_instance,filename,first_frame);\n      return *this;\n#endif\n    }\n\n    //! Load an image from a video file, using OpenCV library \\newinstance.\n    static CImgList<T> get_load_video(const char *const filename,\n                           const unsigned int first_frame=0, const unsigned int last_frame=~0U,\n                           const unsigned int step_frame=1) {\n      return CImgList<T>().load_video(filename,first_frame,last_frame,step_frame);\n    }\n\n    //! Load an image from a video file using the external tool 'ffmpeg'.\n    /**\n      \\param filename Filename to read data from.\n    **/\n    CImgList<T>& load_ffmpeg_external(const char *const filename) {\n      if (!filename || !cimg::is_file(filename))\n        throw CImgArgumentException(_cimglist_instance\n                                    \"load_ffmpeg_external(): Specified filename is (null) or does not exist.\",\n                                    cimglist_instance);\n      CImg<charT> command(1024), filename_tmp(256), filename_tmp2(256);\n      do {\n        cimg_snprintf(filename_tmp,filename_tmp._width,\"%s%c%s\",\n                      cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());\n        cimg_snprintf(filename_tmp2,filename_tmp2._width,\"%s_000001.ppm\",filename_tmp._data);\n      } while (cimg::path_exists(filename_tmp2));\n      cimg_snprintf(filename_tmp2,filename_tmp2._width,\"%s_%%6d.ppm\",filename_tmp._data);\n      cimg_snprintf(command,command._width,\"\\\"%s\\\" -v -8 -i \\\"%s\\\" \\\"%s\\\"\",\n                    cimg::ffmpeg_path(),\n                    CImg<charT>::string(filename)._system_strescape().data(),\n                    CImg<charT>::string(filename_tmp2)._system_strescape().data());\n      if (cimg::system(command,cimg::ffmpeg_path())!=0)\n        throw CImgIOException(_cimglist_instance\n                              \"load_ffmpeg_external(): Failed to open file '%s' with external command 'ffmpeg'.\",\n                              cimglist_instance,\n                              filename);","sourceCodeStart":67439,"sourceCodeEnd":67475,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L67439-L67475","documentation":"CImgList::load_ffmpeg_external() decodes videos by shelling out to an external 'ffmpeg' binary. Before doing anything it validates the filename; if the pointer is null or cimg::is_file() reports the path does not exist as a regular file, it throws this CImgArgumentException immediately.","triggerScenarios":"Calling load_ffmpeg_external(nullptr) or with a path to a non-existent/removed file, a directory, or an unreadable path on systems where ffmpeg is the chosen video backend.","commonSituations":"Typos or wrong working directory for relative paths; file deleted between selection and load; Android native code receiving a content:// URI instead of a real filesystem path.","solutions":["Check the file exists before calling: pass an absolute path and verify with std::filesystem::exists / access().","Fix relative paths by setting/verifying the current working directory, or always use absolute paths.","Copy non-file sources (URIs, streams) to a temporary local file first, then load that file."],"exampleFix":"// before\nlist.load_ffmpeg_external(\"clip.mp4\"); // cwd differs -> path not found\n\n// after\nstd::string abs = std::filesystem::absolute(\"clip.mp4\").string();\nif (std::filesystem::is_regular_file(abs)) {\n  list.load_ffmpeg_external(abs.c_str());\n}","handlingStrategy":"validation","validationCode":"bool usableFile(const char* p) {\n  return p != nullptr && std::filesystem::is_regular_file(p);\n}\nif (!usableFile(path)) { /* fix path before calling */ }","typeGuard":"bool isExistingFile(const char* p) {\n  return p != nullptr && std::filesystem::exists(p) &&\n         std::filesystem::is_regular_file(p);\n}","tryCatchPattern":"try {\n  list.load_ffmpeg_external(path);\n} catch (CImgArgumentException&) {\n  // report missing/invalid path to caller\n}","preventionTips":["Always pass absolute paths to CImg loaders.","Check std::filesystem::is_regular_file before every external-tool load call.","Extract URIs/resources to real files before loading in native code."],"tags":["cimg","video","ffmpeg","file-not-found","external-tool"],"backgroundTag":"file-not-found","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}