Skip to content

CropGeometry working successfully?

Strange behaviour with CropGeometry functionality

I don't quite understand how the CropGeometry functionality works, and I don't know if I misunderstand it or really have some kind of bug. I have an application with a screen area of 800x450 pixels (16:9 Aspect ratio). In this application I want that when a video is shown, instead of deforming the video to adapt to the screen. That the video is zoomed and cut to fit to the screen. Original Video: original

Doing a test with a video that has QCIF resolution (176x144), I do this satisfactorily using CropGeometry="16:9". Video with CropGeometry="16:9": CropGeometry16_9

Since I want to be able to pan and zoom the videos, I try to do the same with the CropGeometry functionality but passing it the new resolution and where it should cut. Searching the internet I have seen that it indicates the following: https://wiki.videolan.org/VLC_HowTo/Crop/ From what I understand I should use this format: vlc input --vout-filter=crop --crop-geometry=120x120+10+10 120x120 is the wanted resolution (in pixels), and 10+10 is the top-left position where the cropping should start (in pixels)

So if the original video is 176x144 resolution I would have to remove pixels above and below to get to 16:9 proportional resolution like my container, so I crop the original video to have a resolution of 176x99 (99 *(16/9) = 176). Therefore if I remove 22.5 pixels from the original video from the top and bottom it should do the same as executing CropGeometry="16:9".

CropOverview

So, I use CropGeometry="176x99+0+22" and the result is the following: CropGeometryFailed

I don't understand what is wrong, doing tests I have been able to do a good crop with: CropGeometry="176x126+0+18"; But I don't really understand why I have to use that parameters.

Is CropGeometry working as expected?

Thanks

What is the current bug behavior?

Using CropGeometry doesn't cut as expected while using the wanted resolution (in pixels) and top-left position. Now using CropGeometry="176x99+0+22" I got:

CropGeometryFailed

What is the expected correct behavior?

I was expecting to get:

CropGeometry16_9

Does it work on other plaforms? Does it work with the official VLC apps?

Relevant logs and/or screenshots

Environment

  • OS: Windows
  • Version 10
  • Device:
  • LibVLC version and architecture 3.0.11.0 x64
  • LibVLCSharp version 3.4.8.0

Possible fixes

Edited by yewnok
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information