RPi-Distro / vlc

GNU General Public License v2.0
41 stars 4 forks source link

clvc cannot set video window size and position #80

Open jjdisplay opened 1 year ago

jjdisplay commented 1 year ago

Hi

I installed the raspberry pi OS 64bit headless and installed vlc using the command

$ sudo apt install vlc -y

After that, I used the vlc to play the Bunny test video

$ cvlc -R --width=500 --height=500 --video-x=100 --video-y=100 --no-fullscreen Big_Buck_Bunny_360_10s_30MB.mp4

The vlc just play the Bunny test mp4 in fullscreen.

Please advice how to set the video window dimension and position?

jc-kynesim commented 1 year ago

As it stands drm output is just fullscreen so no way round it currently. I have added position controls to the next version (--drm-vout-window <width>x<height>+<x>+<y> - similar to the old mmal positioning option), however that will just get you the video in that position on a black screen - drm claims all the output and that isn't easy to change. I suspect that isn't what you were hoping for.

jamesee commented 1 year ago

Can we compile OMXPlayer on the PiOS 64-bit?

cooperbang commented 1 year ago

Why should drm claim all output?

The Direct Rendering Manager was created to allow multiple programs to use video hardware resources cooperatively. Programs wishing to use the GPU send requests to DRM, which acts as an arbitrator and takes care to avoid possible conflicts.

jc-kynesim commented 1 year ago

@cooperbang Sadly you are mistaken. That might possibly have been the intent but that's not how it works these days. Feel free to try to prove me wrong.

cooperbang commented 1 year ago

If the X Sever already has master control over DRM you need to to use the KMS API to create a new DRM plane and display the content there.

jc-kynesim commented 1 year ago

If you would care to point me any example code that does what you suggest I'll happily do just that. I may have missed the correct API.

cooperbang commented 1 year ago

Look here: https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/vc4/vc4_plane.c#L1574

jc-kynesim commented 1 year ago

Nope - that is kernel internals. I mean a userland example where it gets an appropriate drm device fd from X, picks/allocates a plane and assigns a BO (frame buffer) to it - if you can find one of them then making it play video is easy. Most of the trick is getting the drm fd with the correct permissions set on it. After that everything that I've already written just works. Believe it or not - once I've got a good drm device fd I know how to use it.

cooperbang commented 1 year ago

ok - will this fix the problem? https://indico.freedesktop.org/event/2/contributions/60/attachments/66/107/XDC-20220-DRI3-modesetting-without-glamor.pdf https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/945

jc-kynesim commented 1 year ago

No DRI3 doesn't appear to give sufficient privs; you can get what amounts to a read only drm handle out of it which allows BO allocation but that on its own is not not good enough - I sort of hoped it would do what I & you want but it didn't seem to. (Yes, I have done a bunch of searching the web in the past.) If it is as simple as you seem to believe someone must have written a working example that uses it and put it somewhere I can can crib. I want something that I can compile and see working - not powerpoint.

nightside1 commented 1 year ago

Hi jc-kynesim and all, I've just received a new Raspberry PI5. There is a way to install the old vlc version with mmal-vout plugin (--mmal-vout-window)? The latest working VLC version is: 3.0.17.4 Vetinari (revision 3.0.13-8-g41878ff4f2) Can someone help me? Thanks

jc-kynesim commented 1 year ago

I think not - its not so much VLC as the firmware/kernel no longer supporting that. There's no point VLC having the plugins if they can't be used.

I too am frustrated by what used to be easy becoming somewhere between hard and impossible in the name of progress. The new world is a lot more standard and secure than the old world but it comes with a price...

nightside1 commented 1 year ago

Thank you jc-kynesim. As I understand it, for now there is no option to use the new plugin--drm-vout-window <width>x<height>+<x>+<y> to run different instances of VLC in different screen positions, for a quad view or something like that, since DRM claims all the output and this is not easy to change. With -drm-vout-window I'm able to set video window size and position, but just 1 stream is allowed on the screen. For now I'm still stay on rpi4 with VLC 3.0.17.4 Vetinari (revision 3.0.13-8-g41878ff4f2) waiting for a possible solution with a new firmware/kernel and VLC release.

I hope that this will be possible in the future.. Is there any chance?

Thanks

SvenVD commented 8 months ago

Is there any update, or alternatives to achieve the same result.? For https://github.com/SvenVD/rpisurv I need the ability to set coordinates for multiple windows.