Open alexisod opened 1 year ago
Hello alexisod,
Thank you for your comment.
You want to change the dimensions of the source stream, and you mentioned cropping it from 2560x1920 to 2560x1440. This functionality is available by default if you're looking for a way to resize the video within Restreamer.
We don't have a direct tutorial, as the process is simple. Please take a look at this video for guidance: https://www.youtube.com/watch?v=yPy3ElSkoSA
It is important to note that when resizing videos, the image quality may degrade significantly when enlarging them. Please keep this in mind when adjusting the dimensions of your video stream.
Please also note that this process involves encoding the video stream, which can be resource-intensive. Ensure your hardware can handle the processing load, or consider adjusting the encoding settings for optimal performance.
Cheerio Sven
Hi Sven,
Thanks for gettting back to me. I am not looking to proportionally resize the video. I would like to crop it, i.e. use a certain section of it. In the example I sent the width is 2560 and the height is 1920. I want to use the top 1440 i.e. crop out 480 pixels from the bottom. I hope this is clearer.
Thanks again for your help
Alex
Hello alexisod
We apologize for the earlier misunderstanding. It seems our initial response may have been unclear due to the early hour and a lack of ☕ caffeinated beverages. To clarify, the cropping functionality you are seeking is currently not available in Restreamer, as there is no built-in cropping module. We have, however, taken note of your request and added it to our feature request list.
You can find the related discussion here: https://github.com/datarhei/restreamer/discussions/345
Cheerio Sven
Haha it happens to all of us:) No worries:) Effectively and as far I I understood from my research, if there was a way to pass something like -vf "crop=2560:1440:0:0" as custom params to ffmpeg, that should do it. Does this sound about right? (assuming there was a way to add custom parameters)?
Alexis
it is possible to use ffmpeg to resize the stream then pipe it out again
isn't as clean as it being inside datarhei, but it is possible
https://superuser.com/questions/1282044/crop-video-stream-using-ffmpeg cc: @alexisod
thanks @grahhnt Would love to see it as part of datarhei one day!
Actually you can crop with FFMPEG without re-encoding if your stream is using h264 or h265 as the video codec, with the h264_metadata (or h265_metadata). Example :
ffmpeg -i "rtsp://192.168.1.64:554/h264Preview_01_main" -codec copy -f flv -bsf:v h264_metadata=crop_left=64:crop_right=64:crop_top=228:crop_bottom=228 "rtmp://cdg02.contribute.live-video.net/app/live"
The relevant FFMPEG option is: -bsf:v h264_metadata=crop_left=64:crop_right=64:crop_top=228:crop_bottom=228
Note that is only works if your player interprets correctly these metadata. For example it's not interpreted correctly by the player in firefox, but it is interpreted correctly by these of chrome and android.
So it'd be great if datarhei gave us the possibility of customizing the options passed to FFMPEG !
So it'd be great if datarhei gave us the possibility of customizing the options passed to FFMPEG !
Hello @barroudjo Good point. We added this to the feature request list. https://github.com/datarhei/restreamer/discussions/345
Cheerio, Sven
Is it possible to crop the source stream to certain dimensions? In my case the camera stream is 2560x1920 and I would like to crop it so that I broadcast a stream of 2560x1440.