So if anyone is still searching for an answer, the way i did it:
(in my case i only wanted to record part of the screen)
I had a second camera with a target texture of a render texture(you can create one by right-click > Create > Render Texture) then put that render texture on a material and that material on a RawImage, finally in RenderCamera prefab choose the the Target Camera the second camera. now you need a third camera to which you would add the CameraRecorder script(thirdCamera.gameobject.AddComponent<CameraRecorder>();) now by script you can modify the width and heght of the RawImage, on which the camera is rendered.
if you need to record only a part of the screen like in my case, you can modify the viewport rect of the third camera so it only records the RawImage feed.
(the result video becomes stretched in my case, because i needed to record at an aspect ratio of 1, still haven't figured out how not the result to be stretched, if anyone knows please let me know, but as a workaround you can put the video orientation of the Video Recorder in landscape and the record zoom mode at Zoom In With All Content, not the desired output, but close)