-
Notifications
You must be signed in to change notification settings - Fork 9
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
recording video with custom resolution and custom viewport #5
Comments
Are you recording on a 3d canvas, or game object? An alternative solution to what you're proposing might be to put a second camera in the scene and record from that at the resolution you want |
hmm yeah good point... but wouldn't that require rendering the scene twice? which is something im trying to avoid... |
Glad you're finding the code docs to be helpful! It seems to me that what you want to achieve might be possible by adjusting the scale and offset passed to Graphics.Blit in iVidCapProVideo.cs. I'm not in a position to test that right now, but you might try hardcoding some values in that call on line 203 and see what happens. If that works, I'd suggest a new method in the file, something like SetCaptureRegion, that enables those values to be set. Another alternative, though it would get considerably more messy, would be to do it on the native plugin side. I'm pretty sure the embedded GPUImage code includes a Crop filter that could be pressed into service. |
yeah ok, ill try tweaking some values inside |
after some testing it appears the below code for changing the viewport, doesn't do anything.
|
Did you alter the Viewport Rect on the capture camera? It is possible the operation of Graphics.Blit has changed since this was implemented. Sounds like investigation is needed in order to determine if this is still needed. I was referring to a different possible approach to achieving your goal. As of Unity 2017, Graphics.Blit now accepts scale and offset parameters. Like this: Graphics.Blit(source, rt, new Vector2(0.5f, 0.5f), new Vector2(0.25f, 0.25f)); Some experimentation leads me to believe you may be able to achieve the effect you want by the proper setting of these parameters. |
hey @Akevlam, |
here is the shader im using for resampling the screen render texture into a custom sized render texture.
inside
and passing in the captureRect as normalized screen coordinates
|
Glad to hear you sorted it. I haven't split them out into seperate repo's at this stage - the c# source is in this repo at so if you were to make your changes to that code, and put a pull request in that would be great |
hey there,
have been working with your plugin and finding it very clear and easy to follow with your documentation in the code. really good job :)
im currently trying to record a video at 640 x 640 resolution, only a section of the screen, not the whole thing. please see reference image below.
ive done this previously using other frameworks by first capturing the entire screen into a framebuffer (render texture in unity) and then rendering that into a smaller 640 x 640 framebuffer by scaling and positioning the first texture in the new 640 x 640 viewport.
i can see this being done to some extent in
iVidCapProVideo.cs
class, but from what i can see it only performs scaling into the render texture, but does not support cropping.would be a nice feature for iVidCapPro if you could point me to how this could be done.
cheers,
L.
The text was updated successfully, but these errors were encountered: