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

Manually updating video - adds unwanted additional frames to the end #117

Open NaorHadar opened 3 years ago

NaorHadar commented 3 years ago

Describe the bug I am trying to manually record a video (meaning I call Capture when I want to record the frame), the problem I am having is that the end of the video gets additional 10 frames~ (varies), which are frozen. I tried producing a video and adding the frame count to the top right of the video (in Unity), and you can see in the result video that there are frozen frames at the end.

I want to create sort of sequence, where I add up multiple mp4's together, but with this bug I can't seem to do it properly.

I tried changing the settings, updated the version, and even found this (which is the closest I could find for something that useful for my case): https://www.renderheads.com/content/docs/AVProMovieCapture/articles/usage-completing-captures.html

But I don't think that would help me removing the additional frames...

Your Setup (please complete the following information):

To Reproduce I am not sure if it will reproduce, but you could try to manually update the movies for 100 frames, and keep a Text counter in the video, so you can see if there are duplicates or frozen frames.

Logs No error log

NaorHadar commented 3 years ago

Ok so I did a test where I have a frame counter (of the video encoded frames), and I stopped the recording at 1688 frames, I used StopCapture with default parameters (all false), and the result was 1684, The beginning of the second part (right after that I tried StartCapture to record a second video) is correct, I can see the 1688 frame counter in the video at the first frame of the second video.

Now the first parameter of StopCapture is skipPendingFrames, which if I set to false should not skip the 4 missing frames but process them, right? well they are gone from the videos. (Also tried setting skipPendingFrames=true but got the same result, as if skipPendingFrames does nothing.)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

kahnivore commented 3 years ago

Not sure offhand exactly what's causing this but have some ideas relating to that the GPU has a buffer of about 2-4 frames and Unity is a bit behind - eg Unity might be rendering frame 10 but the screen is showing frame 7. It could also be stopping capture before Unity has submitted the frame it's about to display. We could look into adjusting the way stopping the capture works to align perfectly with the number of displayed frames.

In the meantime, have you tried using Force GPU Flush?

It'd also be useful to know:

  1. If you're doing a realtime or offline render
  2. if you're recording audio?
NaorHadar commented 3 years ago

I actually don't remember if I tried Force GPU Flush, I'll try it tomorrow and update.

I am using the offline render and not recording audio.