live copy of an X screen

Arnaud Loonstra arnaud at z25.org
Sat Jan 28 03:40:59 PST 2012


On 01/27/2012 11:45 PM, Matthew Monaco wrote:
> On 01/27/2012 11:13 AM, Arnaud Loonstra wrote:
>> Hi all,
>>
>> I've been searching for a while for this but don't seem to find a
>> solution. My
>> quest is: Is it possible to get a copy of an X screen so I can display it
>> somewhere else?
>>
>> Suppose I have two X screens :0.0 and :0.1. Would it be possible to
>> capture :0.1
>> and display it in a little window on :0.0? This would be extremely
>> useful for
>> running things fullscreen on a second display (:0.1) while controlling
>> it from
>> the first (:0.0) while being able to see the contents of the second on
>> the first
>> display.
>>
>> I could write some capture code and get a framebuffer this way but I
>> thought I
>> would first explore if this isn't somehow built in already or done
>> before?
>>
>> Any thoughts/suggestions?
>>
>> Rg,
>>
>> Arnaud Loonstra
>
> I use x11vnc / tightvnc

I know it's an option however the overhead is way too high. The perfect 
solution would be to do it in the gpu. Everything is there so why 
process it in the cpu. In openGL you can do similar things with render 
to texture code.

I'm not familiar with any X11 api but there seem to be calls to just 
grab a display. I've been browsing through the ffmpeg code
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavdevice/x11grab.c;h=722f00ff0df14848e9c4202fd63360f60a7ee1ee;hb=HEAD
Which is giving some pointers... the Display struct, Xshm?

I've tried how much overhead such code would take by issuing
ffmpeg -f x11grab -r 10 -s xga -i :0.0 -an -f rawvideo /dev/null
which takes some 10% of CPU. This is still too much... In this case 
ffmpeg is still passing the data through. No encoding..

Input #0, x11grab, from ':0.0':
   Duration: N/A, start: 1327750724.645929, bitrate: 251658 kb/s
     Stream #0.0: Video: rawvideo, rgb32, 1024x768, 251658 kb/s, 10 tbr, 
1000k tbn, 10 tbc
File '/dev/null' already exists. Overwrite ? [y/N] y
Output #0, rawvideo, to '/dev/null':
     Stream #0.0: Video: rawvideo, rgb32, 1024x768, q=2-31, 200 kb/s, 
90k tbn, 10 tbc
Stream mapping:
   Stream #0.0 -> #0.0

Rg,

Arnaud Loonstra

-- 
Stichting z25.org
Concordiastraat 67A
3551 EM Utrecht
The Netherlands
+31-(0)6-41861063




More information about the xorg mailing list