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/
45 stars 8 forks source link

Corrupted video files (update with research) #343

Open woodrowproctor opened 7 months ago

woodrowproctor commented 7 months ago

Unity Version 2021.3.27 Avpro Capture desktop edition 5.1.8 Windows 10 CaptureFromCamera 1600x900 capture unity audio

I posted a while ago about getting some corrupted video files but I did not have enough information to get anywhere with it. I've figured out a lot of what is going on and I think it is an avprocapture bug.

I am using the capture from camera component and I am not doing anything fancy, basically just calling -

AVProRecorder.StartCapture()
AVProRecorder.StopCapture(true);

BUG: I have about a 1/6 chance of the video I created being unplayable when stopping the capture. I can make new videos after that one and they are fine. Also, if a video is captured in the unplayable state, on destroy for the capturefromcamera component freezes forever, causing the app to stall

RESEARCH: Looks like capturebase has a list of FileWritingHandlers. The videos that never finish are never removed from the list of _pendingfilewrites, which is supposed to clean up unfinished file writes. The video will remain in the list forever because FileWritingHandlers.IsFileReady will always return false. The completion status of the file writer will forever be stuck on BusyFileWriting. This happens on all the machines I have tested. I am left with a video that won't play and an app that must be forced to quit. Length of video has not effect on my results, and about 80% of the videos I record do not have this problem

Is there a way to force a file writer to finish whatever it's doing? Running dispose on a filewriter in this state causes an infinite freeze

woodrowproctor commented 7 months ago

NativePlugin.FreeRecorder(_handle); seems to be the line that freezes forever

Chris-RH commented 7 months ago

Ahh, thank you for the info, we'll look into this further.

woodrowproctor commented 5 months ago

@Chris-RH Have there been any discoveries or changes involving this problem? We are planning on switching to a different video recording plugin because of this problem. We can only do so much when the infinite loop is inside a hidden method that we cannot debug