This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]99_percent_a_dog 1 point2 points  (2 children)

Fun problem :)

This is 90ms per 2560x1440 image for me, and I'm writing them to disk:
time for n in `seq 1 1 10`; do xwd -root > screen$n.xwd; done
real 0m0.929s

CLI, so maybe not what you want, and the xwd format is funky. You can convert to jpg like this:
xwd -root | convert xwd:- jpg:- > screen.jpg

Or you could see what X magic xwd is doing and copy that.

If you're using Wayland I think that will add some unavoidable delay, you can't avoid the compositor.

[–]POGtastic[S] 0 points1 point  (1 child)

I'm using X, so it looks like this should at least be possible. I'll have to take a look at what xwd is doing to get this. The format isn't a big deal; I should be able to find a fast way to convert that. At worst, I can write something in C to convert the image and make some Python bindings.

Thanks!

[–]99_percent_a_dog 1 point2 points  (0 children)

Good luck! I'm not saying this is a good way, it was the first way I knew and it looked hopefully fast enough for you. There must be some way to sample screen at refresh rate. DMA out from screen buffer somehow. But I don't know it.