Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 17 Nov 2018, 13:40
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
A part of my futur tool : a way to make a screen capture
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
fabrice_035


Joined: 28 Apr 2014
Posts: 534
Location: Bretagne / France

PostPosted: Sat 10 Nov 2018, 10:04    Post subject:  A part of my futur tool : a way to make a screen capture  

Hi,

I'm in the process of making a program... experimental.

And I encountered a problem (among others) : how to select an area on desktop with mouse ?

Happy i found a good solution here https://bbs.archlinux.org/viewtopic.php?id=85378

To test i follow the example to compil

Code:

gcc -Wall -Wextra -lX11 -o selectarea draw.c -lX11


I'm trying, it works well.

And next is simple, i modify printf function in source to make it compatible with ffmpeg tool, and recompil

Code:
printf("-s %dx%d -i :0.0+%d,%d\n",rw,rh,rx,ry);


Now i have a program be able to select area, return position and it can be integrated with ffmpeg !

Next step, i imagine you want open the fresh capture with your best paint picture program with Puppy ?

Right, i try this

Code:
ffmpeg -y -f x11grab `selectarea` -vframes 1 screenshot.png | xargs defaultpaint screenshot.png


Enjoy Smile

You can download binary here or compil yourself.

(remove fake .zip extension)

Regard
selectarea.zip
Description  remove fake .zip extension
zip

 Download 
Filename  selectarea.zip 
Filesize  11.64 KB 
Downloaded  7 Time(s) 

_________________
Linux Tahrpup 6.0.6 / 3.14.79
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 996
Location: not Bulgaria

PostPosted: Mon 12 Nov 2018, 04:17    Post subject:  

Or just use scrox (an enhanced fork of screen capture tool scrot), which is used in weX (audio/webcam/screencast tool based on ffmpeg). Scrox 32bit and 64bit dotpet downloads available here:

http://www.murga-linux.com/puppy/viewtopic.php?p=918785&search_id=1371926159#918785

mcewanw wrote:
weX uses scrox to select windows (with or without border) or fullscreen or mouse-selectable rectangular capture area. (Works great capturing youtube or similar streaming videos, actually, via Alsa MIX for audio rather than MIC input and X11 screencast for video, though of course it is generally better to simply download such videos directly via say Firefox video download extensions).


Because of its inbuilt screenshot capability, however, scrox does require libgib1 (PPM search for giblib) and libimlib2 installed for the pixel captures etc - these small graphics-related libs may already be on your system of course

After installation, to get scrox usage, just enter: scrox -h

scrox is also available in weX all-in-one dotpets by Mike Walsh for XenialPup64 and BionicPup64:

http://www.murga-linux.com/puppy/viewtopic.php?p=1009799#1009799

and (for 32bit older systems) - this 32bit All-in-one weX includes specially compiled newer ffmpeg for old boxes:

http://www.murga-linux.com/puppy/viewtopic.php?p=989694#989694

Note that scrox does NOT depend on weX. It can simply be used, like scrot, for screenshots, or for getting mouse cursor coordinates for use in other scripts (such as in weX where it is used for screencast area /or-exact-window-with-or-without-decoration determination).

Your little mouse coordinates finding program looks interesting though - nice and simple way to get ffmpeg to instantly receive a mouse-determined screen capture area. You should mention that the compiled version you offer for download is compiled for 32bit systems only.

wiak

Last edited by wiak on Mon 12 Nov 2018, 05:41; edited 1 time in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 996
Location: not Bulgaria

PostPosted: Mon 12 Nov 2018, 05:00    Post subject:  

By the way, FATDOG used to have a screencast.sh program (maybe still does) which used the simple xrectsel program to find coordinates. I needed something more sophisticated for my weX screencast program wishes, hence used scrox (since scrox can also determine actual window corners as well as mouse defined areas).

https://aur.archlinux.org/packages/xrectsel/

https://github.com/lolilolicon/xrectsel

xrectsel itself actually gets its idea from scrot (just strips out the coordinate finding code of scrot and doesn't do screenshots itself).

Actually, I also wrote a plugin for weX that uses xrectsel plus xrandr as an alternative to using scrox, but I've always since used scrox in practice.

Your trick (modified xrectsel) saves having to take traditional xrectsel coord output and fishing out the bits needed by ffmpeg x11grab (using, say, sed or awk or simply bash parameter substitution using the likes of ${wxh%x*}, as in weX after scrox use, or similar). Then, again, your simple mod to xrectsel makes the output more specific for ffmpeg x11grab use rather than general purpose (you could, for example, modify your source code to include an option to print your ffmpeg-compatible output and leave traditional xrectsel output if no option supplied - then you could push it as a possible patch to xrectsel github site):

Code:
root@xenial64:~# xrectsel
422x180+458+419


Code:
printf("-s %dx%d -i :0.0+%d,%d\n",rw,rh,rx,ry);



Quote from: https://www.ffmpeg.org/ffmpeg-devices.html
Code:
The filename passed as input has the syntax:

[hostname]:display_number.screen_number[+x_offset,y_offset]

hostname:display_number.screen_number specifies the X11 display name of the screen to grab from. hostname can be omitted, and defaults to "localhost". The environment variable DISPLAY contains the default display name.

x_offset and y_offset specify the offsets of the grabbed area with respect to the top-left border of the X11 screen. They default to 0.


wiak
Back to top
View user's profile Send private message 
fabrice_035


Joined: 28 Apr 2014
Posts: 534
Location: Bretagne / France

PostPosted: Mon 12 Nov 2018, 09:54    Post subject:  

Hi wiak ,

I'm not looking for a tool already made I want to make mine.

Thanks for xrectsel.c but it's clone of https://bbs.archlinux.org/viewtopic.php?id=85378 !

Regard.

_________________
Linux Tahrpup 6.0.6 / 3.14.79
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 996
Location: not Bulgaria

PostPosted: Mon 12 Nov 2018, 22:21    Post subject:  

fabrice_035 wrote:
Hi wiak ,

I'm not looking for a tool already made I want to make mine.


I understand. Looking forward to seeing it and its programming implementation.

fabrice_035 wrote:

Thanks for xrectsel.c but it's clone of https://bbs.archlinux.org/viewtopic.php?id=85378 !


Yes, I know; xrectsel is by Arch user lolilolicon. Except, it's not a 'clone', https://github.com/lolilolicon/xrectsel is the main xrectsel github site.

https://bbs.archlinux.org/viewtopic.php?id=85378 is the forum thread where lolilolicon announced his first xrectsel attempt. I'm not sure if he has improved upon it since. I was just giving url for its github site in case someone else wanted to use or contribute to it, since that is where patches should be pushed if contributing.

EDIT: Yes, lolilolicon improved the program since that 2009 bbs.archlinux.org post. His latest change (Oct 2016) is here, so what I was getting at is that it is best to base forks/mods on latest github version:

https://github.com/lolilolicon/xrectsel/commit/29c1f50c7b8881aa506eb8134190bf3add4c9e55

wiak
Back to top
View user's profile Send private message 
fabrice_035


Joined: 28 Apr 2014
Posts: 534
Location: Bretagne / France

PostPosted: Tue 13 Nov 2018, 13:08    Post subject:  

Wiak, but thanks to you, I discovered
Code:
https://github.com/lolilolicon?tab=repositories

_________________
Linux Tahrpup 6.0.6 / 3.14.79
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0580s ][ Queries: 12 (0.0048s) ][ GZIP on ]