Page 1 of 1

Cropping help with libVLC older version

Posted: 16 Sep 2013 16:27
by psyence
Hello there...I am brand new to libVLC, but I need to figure out how it works because I have to modify/maintain some code that uses it. So go easy on me while I ask some questions that are probably a little bit stupid to some of you... :)

After doing a little research, I've discovered that the authors of this code were using what seems to me to be a pretty old version (0.8.6h).

Basically, what happens is that when the user hits a record button, they init vlc, then use it to capture the screen until the user hits the button again, then they stop recording. The captured video is stored in a local mpg file.

My problem comes from the fact that I would like to add some code to crop this video, since we don't need to capture the entire screen, which it seems to do by default. I'm not supposed to post the code here, but basically the way they use libVLC is like this...

-Create a new libvlc_instance_t using libvlc_new(). There are arguments passed to this function: --one-instance --no-drop-late-frames --plugin-path [the plugin path]

-Create a new playlist item with a call similar to the following: int playlistitem = libvlc_playlist_add_extended(vlcinstance, "screen://", nullptr, argc, options, nullptr), where argc is the number of options and options is an array: {"screen-fps=24","--ttl=12","--vout-filter=crop","--crop-geometry=640x160+0+0", ":sout=#transcode{vcodec=mp4v,vb=1024,scale=1.0}:duplicate{dst=std{access=udp}}


I figured out that at least with the VLC player command line, I could crop screen capture videos using --vout-filter=crop --crop-geometry=AxB+C+D, but this option seems to be getting ignored by libVLC, as no matter what I change A,B,C, and D to, the resulting movie is not cropped. I need to know if it's even possible to crop a movie like this with 0.8.6h and I would like to know what I'm doing wrong and why my crop arguments are getting ignored when I pass them to libvlc_playlist_add_extended(), along with the rest of the parameters.

Just a quick note: It looks like the code's author had compiled dlls. I don't know for sure if she compiled in the crop module. Is there an easy way to find out?
Thanks in advance...No amount of googling seemed to help with this problem and we want to avoid rewriting the code to use the newer libVLC to crop if at all possible.

Re: Cropping help with libVLC older version

Posted: 28 Oct 2013 07:33
by rohuezo
Hello psyence,

have you tried the Options instead of --crop-geometry?

Code: Select all

--screen-left={1} --screen-top={2} --screen-width={3} --screen-height={4}
The values you can get from the window that you want to record.

Be aware that VLC can only record on the Screen.Primary, i.e. if you're using dual (or more) monitors and the coordinates of the window are not on the Screen.Primary, then VLC will not record correctly... At least, that was my experience!

Best regards,
rohuezo