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

[Android] CaptureFromTexture output is flipped #344

Closed artoonie closed 4 months ago

artoonie commented 7 months ago

Describe the bug CaptureFromTexture is flipped on Android on v5.1.8 (both X and Y).

I believe this is related to the release note:

Fixed issue with output being incorrect on some devices when no capture rotation is enabled and the encoder does not support the resolution being requested

Your Setup (please complete the following information):

To reproduce I haven't narrowed this down to a simple reproducible case yet -- still investigating, but when updating 5.1.7 to 5.1.8, suddenly my Android captures are flipped. I don't see anything that would cause this in any of the C# files in the project, so I expect it's in one of the java libraries.

Request A few options:

  1. Is it possible to get this change behind a flag so I can disable it?
  2. Or alternatively, perhaps you could provide some information that could help me "reverse" this change on my end?
  3. In the meantime, how can I download a non-watermarked version of v5.1.7 which does not have the issue? My last downloaded version is over a year old, and I'd like to upgrade to 5.1.7 in the meantime while I find a workaround for this issue.

Additional Info Only happens on Android, not in Editor, not on iOS.

MorrisRH commented 7 months ago

The CaptureFromTexture script is missing a fix-up that was added into the CaptureFromCamera script, apologies for that.

You just need to add the following to the PrepareCapture method of CaptureFromTexture.cs at line 313:

#if !UNITY_EDITOR && UNITY_ANDROID
            _isTopDown = false;
#endif

It should look something like this:

            _pixelFormat = NativePlugin.PixelFormat.RGBA32;
            _isSourceTextureChanged = false;
#if !UNITY_EDITOR && UNITY_ANDROID
            _isTopDown = false;
#endif
            SelectRecordingResolution(/*_sourceTexture.*/width, /*_sourceTexture.*/height);

This fix will make it into the next release.

artoonie commented 7 months ago

All good, that patch works on my end. Thanks for everything Morris!

artoonie commented 7 months ago

I noticed that CameraFromCamera has the same problem in some cases. I haven't confirmed, but I believe it's only when the output format is ImageSequence? In my case, changing _isTopDown from false to this worked:

_isTopDown = _outputTarget == OutputTarget.ImageSequence

I have not confirmed whether it's the output target or one of my other settings that I always use in tandem with ImageSequence, so check before using.

Chris-RH commented 7 months ago

Fixed in AVPro Movie Capture 5.2.0

MorrisRH commented 6 months ago

I've fixed up image sequence in the plugin so that we don't need to special case the _isTopDown flag in the script. This will make it into the next release.

Chris-RH commented 4 months ago

AVPro Movie Capture 5.2.1 has been released. Please let us know if it has not fixed your issue.