RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
48 stars 8 forks source link

CompletedFileWritingAction never called #288

Closed jiaming233 closed 2 months ago

jiaming233 commented 1 year ago

Describe the bug CompletedFileWritingAction never called after screenCapture.StopCapture(); NativePlugin.IsFileWritingComplete(_handle) always return false

Your Setup (please complete the following information):

To Reproduce Set _minimumDiskSpaceMB almost close to disk space, and call StopCapture(true) automaticlly when there is no enough space

private void CheckFreeDiskSpace() { if (_minimumDiskSpaceMB > 0) { if (!IsEnoughDiskSpace()) { Debug.LogWarning("[AVProMovieCapture] Free disk space getting too low. Stopping capture."); StopCapture(true); } } }

Logs [16:18:45]info:[AVProMovieCapture] Stopping capture 0 UnityEngine.Debug:Log (object) RenderHeads.Media.AVProMovieCapture.CaptureBase:StopCapture (bool,bool,bool) (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2643) RenderHeads.Media.AVProMovieCapture.CaptureBase:CheckFreeDiskSpace () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:3002) RenderHeads.Media.AVProMovieCapture.CaptureBase:LateUpdate () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2927)

[16:20:49]info:[AVProMovieCapture] IsFileWritingComplete False UnityEngine.Debug:Log (object) RenderHeads.Media.AVProMovieCapture.FileWritingHandler:IsFileReady () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/FileWritingHandler.cs:75) RenderHeads.Media.AVProMovieCapture.CaptureBase:RemoveCompletedFileWrites () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2985) RenderHeads.Media.AVProMovieCapture.CaptureBase:LateUpdate () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2940)

....endlesss "IsFileWritingComplete False"

MorrisRH commented 1 year ago

Please try updating to the latest version

jiaming233 commented 1 year ago

Please try updating to the latest version

It still occurs with lastest version 5.1.6, running Demo00-ScreenCapture.

For test, I left 12MB in my disk and set _minimumDiskSpaceMB as 10. Then I start capture, when the video file size hit 2 ~ 3MB, StopCapture called, but sometimes the file will never be completed. And then if I click "Play" in Unity Editor to quit, the Editor freeze.

Editor.log

OzanUst-M commented 1 year ago

Having same issue on iOS.

Chris-RH commented 1 year ago

@jiaming233, So we think that this is possibly due to post-processing options being enables (such as fast-start), which require copying the file. If you're short of disk space then the copy will fail. So we need to look into how to stop it from locking. Perhaps fail any post processing if disk space is not sufficient.

@OzanUst-M, _minimumDiskSpaceMB is Windows only; it isn't an option on iOS. So it can't be the same issue.

jiaming233 commented 1 year ago

Thanks for reply!

I try to disable post operations by commenting following lines in CaptureBase, which didn't work if (_outputTarget == OutputTarget.VideoFile) { applyPostOperations = true; }

Waiting for new release : )

jiaming233 commented 1 year ago

I made these 2 modifications and the problem have not been reproduced for now. Just for reference.

1 2

OzanUst-M commented 1 year ago

@jiaming233, So we think that this is possibly due to post-processing options being enables (such as fast-start), which require copying the file. If you're short of disk space then the copy will fail. So we need to look into how to stop it from locking. Perhaps fail any post processing if disk space is not sufficient.

@OzanUst-M, _minimumDiskSpaceMB is Windows only; it isn't an option on iOS. So it can't be the same issue.

I was talking about CompletedFileWritingAction being never called. It never happens after video recording is done and file is ready to share.

Chris-RH commented 1 year ago

@OzanUst-M that is a completely different issue then. Could you open a new issue with all of your details please.

RichRH commented 2 months ago

Closing this ticket as a workaround to the original issue has been provided (first parameter of 'StopCapture()' should be 'false', not 'true') and it's a duplicate of https://github.com/RenderHeads/UnityPlugin-AVProMovieCapture/issues/343 (further information there).

Cheers,