melnijir / Dicaffeine

Repository for things connected to Dicaffeine player/streamer.
https://dicaffeine.com
MIT License
106 stars 4 forks source link

Multi-channel video split/crop/roi #20

Open authoroftheaccident opened 2 years ago

authoroftheaccident commented 2 years ago

Hello,

Is there a way to crop or select the region of interest so that a number of raspberries can play different parts of a streamed video?

Something like the Pi Wall effect but with Dicaffeine?

Any help appreciated.

melnijir commented 2 years ago

Hi,

there is a way how to do that by modifying the generated configuration files. Each time you click on the Play button, the configuration file is generated in:

/tmp/yuri_config_player.xml

which can be played with yuri2 binary:

yuri2 /tmp/yuri_config_player.xml

If you look into the file, there are some nodes and links. The display node has class named glx_window. If you want to crop the image before displaying it, you need to add the node with class crop and connect it with link before the display node. For example, in the original file you would find:

<node class="glx_window" name="window_auto">
    <parameter name="decorations">false</parameter>
    <parameter name="show_cursor">false</parameter>
    <parameter name="fullscreen">true</parameter>
    <parameter name="display">:0.0</parameter>
    <parameter name="resolution">1920x1200</parameter>
    <parameter name="position">0x0</parameter>
</node>
<link class="single" name="link_video_dup_screen_auto" source="dup_auto:-1" target="window_auto:0"/>

modify it to:

<node class="crop" name="image_crop">
    <parameter name="geometry">320x240+100+100</parameter>
</node>
<node class="glx_window" name="window_auto">
    <parameter name="decorations">false</parameter>
    <parameter name="show_cursor">false</parameter>
    <parameter name="fullscreen">true</parameter>
    <parameter name="display">:0.0</parameter>
    <parameter name="resolution">1920x1200</parameter>
    <parameter name="position">0x0</parameter>
</node>

<link class="single" name="link_video_dup_crop_auto" source="dup_auto:-1" target="image_crop:0"/>
<link class="single" name="link_video_dup_screen_auto" source="image_crop:0" target="window_auto:0"/>

Basically it means that you've added the node with class crop called image_crop. It will take the original image, crop it to the resolution 320x240 with offset 100px from left&top. Also you've modified the links, original link is now heading for the image_crop node and the new one connects the image_crop and window_auto which is the display node.

Hope it's understandable. :wink:

authoroftheaccident commented 2 years ago

Thanks for the detailed response. I'll see how it goes.

dasl- commented 8 months ago

Hi @authoroftheaccident , I'm curious if you ever tried this out? Does the raspberry pi have enough CPU to do realtime cropping and playback of the videos?