Jelajahi Sumber

obs-ffmpeg: Show additional details in failed to write error

A bit of a hack, but this is one of the more common errors that users
are encountering, so showing useful information will help cut down on
the number of support issues.
Richard Stanway 7 tahun lalu
induk
melakukan
bf16ec5f2d

+ 1 - 0
plugins/obs-ffmpeg/data/locale/en-US.ini

@@ -49,3 +49,4 @@ ReplayBuffer.Save="Save Replay"
 
 
 HelperProcessFailed="Unable to start the recording helper process. Check that OBS files have not been blocked or removed by any 3rd party antivirus / security software."
 HelperProcessFailed="Unable to start the recording helper process. Check that OBS files have not been blocked or removed by any 3rd party antivirus / security software."
 UnableToWritePath="Unable to write to %1. Make sure you're using a recording path which your user account is allowed to write to and that there is sufficient disk space."
 UnableToWritePath="Unable to write to %1. Make sure you're using a recording path which your user account is allowed to write to and that there is sufficient disk space."
+WarnWindowsDefender="If Windows 10 Ransomware Protection is enabled it can also cause this error. Add OBS to the controlled folder access list in Windows Security / Virus & threat protection settings."

+ 14 - 0
plugins/obs-ffmpeg/obs-ffmpeg-mux.c

@@ -26,6 +26,10 @@
 #include <util/threading.h>
 #include <util/threading.h>
 #include "ffmpeg-mux/ffmpeg-mux.h"
 #include "ffmpeg-mux/ffmpeg-mux.h"
 
 
+#ifdef _WIN32
+#include "util/windows/win-version.h"
+#endif
+
 #include <libavformat/avformat.h>
 #include <libavformat/avformat.h>
 
 
 #define do_log(level, format, ...) \
 #define do_log(level, format, ...) \
@@ -290,6 +294,16 @@ static bool ffmpeg_mux_start(void *data)
 		struct dstr error_message;
 		struct dstr error_message;
 		dstr_init_copy(&error_message,
 		dstr_init_copy(&error_message,
 			obs_module_text("UnableToWritePath"));
 			obs_module_text("UnableToWritePath"));
+#ifdef _WIN32
+		// special warning for Windows 10 users about Defender
+		struct win_version_info ver;
+		get_win_ver(&ver);
+		if (ver.major >= 10) {
+			dstr_cat(&error_message, "\n\n");
+			dstr_cat(&error_message,
+				obs_module_text("WarnWindowsDefender"));
+		}
+#endif
 		dstr_replace(&error_message, "%1", path);
 		dstr_replace(&error_message, "%1", path);
 		obs_output_set_last_error(stream->output,
 		obs_output_set_last_error(stream->output,
 			error_message.array);
 			error_message.array);