Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWFs using the Animate CC camera tool export with cropped video #1

Open
Herschel opened this issue Dec 6, 2017 · 3 comments
Open

Comments

@Herschel
Copy link
Owner

Herschel commented Dec 6, 2017

Using the Camera tool in Adobe Animate CC will cause videos to export incorrectly.

Animate-CC-camera-sample.zip

Adobe Animate CC v 18.0 (build 107)

@ninjamuffin99
Copy link

I think this might be a problem with the "Basic Layers" thing. According to insanetoons on Newgrounds, as long as Animate is in "Advanced Layers" mode, it'll export fine through Swivel. https://www.newgrounds.com/bbs/topic/1430342

I've tried it myself and it seems to work fine in Advanced Layer mode, while there are problems in Basic Layer mode. Not sure how new this Advanced Layer stuff is though

leovoel added a commit to leovoel/Swivel that referenced this issue Sep 2, 2018
Animate CC's camera translates the mask of its parent (if there
is one) so that the mask's (0, 0) point coincides with its center,
and we do set a mask on it, so we end up with cropped output.

By setting the mask's position to (0, 0) just before a frame is
rendered, this problem is avoided.

Closes Herschel#1.
@leovoel
Copy link

leovoel commented Sep 2, 2018

the problem is that the animate camera is translating the parent's mask (if one is present) so that the mask's (0, 0) point matches with its center, and swivel does set a mask, so the animation gets cropped on output.

the camera avoids changing the mask position if "Advanced Layers" is enabled, which is why that happens to be a workaround for this.

a possible fix is to always reset the position of _mask to (0, 0) on every frame:

https://github.com/leovoel/Swivel/blob/aa364c0957994e4470c51c19dc6a1897e52f761c/src/com/newgrounds/swivel/swf/SWFRecorder.hx#L251-L254

i've tested that on these swfs, and they look okay (i took the liberty of adding a variant of the swf posted in this issue, modified so that it will trigger this problem. conversion results are also included).

i don't know if anything else should be set on the mask (e.g. rotation), but it doesn't look like it's needed if these samples are anything to go by.

also, this means that swivel won't properly convert swfs that use this procedure for masking, unless they set their mask on the second frame. i don't really know what would be a good way to fix that.

@Herschel
Copy link
Owner Author

Herschel commented Sep 5, 2018

Thank you for the very helpful info @leovoel! Resetting the mask position should definitely help in most cases.

I wonder if it's possible to tweak where in the display hierarchy Swivel sets the mask to avoid this issue entirely, or to only enable the mask for a moment while drawing the frame, and then disable it. I'm going to do a big brain dump about the mask here... It's been several years and I'd like to document it a bit before I forget!

Swivel masks the movie because there was an issue was with older style V-Cams. If the camera zoomed in, and there was a filter applied somewhere on the scene, it would cause the rendering to grind to a halt. When doing bitmapData.draw to render the frame, the Flash Player would try to apply the filter to the entire gigantic bounds of the zoomed-in clip. In the worst case, this would actually cause the player to crash.

After some fiddling, I found that masking the loader clip fixed the issue and forced the filter to only apply to the visible area. This sped up the rendering and avoided the crashes. I remember it being finicky, so it's possible that it only works when masking this particular clip and not other parent display objects. I believe I also tried using the clipRect of bitmapData.draw with no luck, etc.

The original movie that caused the issue was The Ballad of CrippleKane by Hans, in a scene where the camera zoomed in on a face and blurred the background.

Worst case, it'd be nice to add an "advanced options" box somewhere that allows the user to disable some of these settings if they cause problems with their SWF.

cosmicdan added a commit to cosmicdan/Swivel that referenced this issue May 30, 2019
Animate CC's camera translates the mask of its parent (if there
is one) so that the mask's (0, 0) point coincides with its center,
and we do set a mask on it, so we end up with cropped output.

By setting the mask's position to (0, 0) just before a frame is
rendered, this problem is avoided.

Closes Herschel#1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants