UnityPlugin-AVProMovieCapture
UnityPlugin-AVProMovieCapture copied to clipboard
CPU encoding h264 @ 4k captures frames out of order - from keeping (#XNhs1LfAOw)
An obscure bug with H.264 CPU encoding at 4K (very hard to replicate) where on about 25% of recordings every 3 to 5 seconds or so it skips & repeats frames in a jumbled order.
This happens only for H.264 if I disable hardware encoding and use CPU encoding (for better quality than NVENC).
Simplified Example: Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 4 Frame 6 Frame 5 Frame 10 Frame 11 Frame 12 Frame 13 Frame 14 Frame 15 Frame 16 Frame 15 Frame 14 Frame 16 Frame 20 Frame 21
The above example is simplified. With the actual bug it repeats about 10 frames in a jumbled order every few 3 to 5 seconds.
Note: This does not happen every time. I am recording videos roughly about 30 minutes to 1 hour in length. This will happen on 1 out of every 4 or so videos at random. Record the same video again with the exact same parameters and it may or may not happen.
Note2: If I use hardware encoding with Unity set to use an RTX 3090 card and a second RTX 2080 TI card running the display (and therefore the NVENC encoding) the above bug does NOT happen ever.
Example short 20 second video capture to demonstrate the issue.
https://youtu.be/ZrGQwj7tskk
Another Note: Ive tried running two instances of Unity recording concurrently. Also tried running a single instance of Unity with nothing else running. It makes no difference. Encoder settings were:
- Offline Render
- H.264
- Min Bitrate 80Mbps
- Max Bitrate 100Mbps
- Resolution: 4K UHD
Unity was running DX12 with DXR. Recursive rendering, GI ray tracing etc... but NO path tracing.
Hardware Spec: CPU: Threadripper 3970x GPU1: RTX 3090 GPU2: RTX 2080 TI
Note 2: If I push the bitrate both min and max upto any number between 160 and 300 mbps then this does NOT happen ever. Even if I disabled the 2080 ti and leave just the single card and have two instances of Unity rendering plus Adobe Media encoder re-encoding videos.
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.
@tcwicks we are looking into this, but do you now if there is anything else the can be changed to stop this issue from happening? For example, changing to D3D11, or capturing at a lower bitrate/resolution?
I also wonder if it's possible to reproduce this with only a single GPU installed as I don't currently have access to a multi-GPU machine.
We're just trying to narrow down the cause, so any hints you can give would definitely help.
Thanks,