Skip to content

Commit 0932c48

Browse files
committed
VideoRecording: If ffmpeg is not available, the video recording will not be initialized.
1 parent 0168972 commit 0932c48

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.4.2
4+
5+
### Fixed
6+
- VideoRecording: If ffmpeg is not available, the video recording will not be initialized.
7+
38
## 1.4.1
49

510
### Fixed

Runtime/Scripts/GameRecorder.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ void Start()
7676
return;
7777
#endif
7878

79+
// Check if FFmpeg is available before initializing video recording components
80+
if (!VideoEncoder.IsFFmpegAvailable())
81+
{
82+
return;
83+
}
84+
7985
// Adjust the game resolution to be divisible by 4
8086
_gameWidth = Screen.width - (Screen.width % 4);
8187
_gameHeight = Screen.height - (Screen.height % 4);
@@ -178,6 +184,11 @@ public void StartRecording()
178184
return; // no log here as it would spam the log file
179185
#endif
180186

187+
if (_videoEncoder == null)
188+
{
189+
return;
190+
}
191+
181192
if (IsPaused)
182193
{
183194
IsPaused = false; // this will unpause
@@ -200,6 +211,11 @@ public void PauseRecording()
200211
return;
201212
#endif
202213

214+
if (_videoEncoder == null)
215+
{
216+
return;
217+
}
218+
203219
if (IsRecording)
204220
{
205221
IsPaused = true;
@@ -216,6 +232,11 @@ public string StopRecordingAndSaveLastMinute()
216232
return null;
217233
#endif
218234

235+
if (_videoEncoder == null)
236+
{
237+
return null;
238+
}
239+
219240
IsRecording = false;
220241
return _videoEncoder.StopEncoding();
221242
}
@@ -285,7 +306,7 @@ private void OnCompleteReadback(AsyncGPUReadbackRequest request)
285306
return;
286307
}
287308

288-
if (!IsRecording) return; // Recording might have stopped while waiting for readback
309+
if (!IsRecording || _videoEncoder == null) return; // Recording might have stopped while waiting for readback
289310

290311
// Get the raw data from GPU using safe copy to avoid allocation
291312
var rawData = request.GetData<byte>();

Runtime/Scripts/VideoEncoder.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,11 @@ private string GetPresetName(string encoder)
545545
}
546546
}
547547

548+
public static bool IsFFmpegAvailable()
549+
{
550+
return GetFfmpegPath() != null;
551+
}
552+
548553
private static string GetFfmpegPath()
549554
{
550555
string path = null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.betahub.bugreporter",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"displayName": "BetaHub Bug Reporter",
55
"description": "A tool for recording gameplay videos and submitting bug reports directly to BetaHub.",
66
"unity": "2022.3",

0 commit comments

Comments
 (0)