Active Topics

 


Reply
Thread Tools
Posts: 215 | Thanked: 348 times | Joined on May 2011
#1
I know about ctrl +shift+ p but I'd like to have my n900 automatically take screenshots every 5 mins

The main reason is so I can make process (work in progress) gif images of my drawings from MyPaint, like this:



thanks

Last edited by lonk; 2012-01-06 at 15:27.
 

The Following User Says Thank You to lonk For This Useful Post:
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#2
You could "Ctrl + Shift + P" to take your screenshot whenever necessary.
Or install Imagemagick package and run import with store the image, from a script with sleep set to 300.
Code:
#! /bin/bash
 #file: screenshot.sh

while [ 1 -eq 1 ]; do
appenddate=_$(date '+%d%b%y-%H%M%S')
 import -window root ~/screenshot$appenddate.png
 sleep 300
 done
Big Fat Warning!!!This will save to /home/user! Be aware of running out of space for to many pictures
 

The Following 2 Users Say Thank You to michaaa62 For This Useful Post:
Posts: 215 | Thanked: 348 times | Joined on May 2011
#3
Originally Posted by michaaa62 View Post
You could "Ctrl + Shift + P" to take your screenshot whenever necessary.
Or install Imagemagick package and run import with store the image, from a script with sleep set to 300.
Code:
#! /bin/bash
 #file: screenshot.sh

while [ 1 -eq 1 ]; do
appenddate=_$(date '+%d%b%y-%H%M%S')
 import -window root ~/screenshot$appenddate.png
 sleep 300
 done
Big Fat Warning!!!This will save to /home/user! Be aware of running out of space for to many pictures
Thank you!

I was having problems at first because "import -window root" would only take screenshot of the terminal, so had to install xwininfo to get the window id of MyPaint to get the script working.
many thanks
 

The Following User Says Thank You to lonk For This Useful Post:
Posts: 915 | Thanked: 3,209 times | Joined on Jan 2011 @ Germany
#4
Originally Posted by michaaa62 View Post
Code:
while [ 1 -eq 1 ]; do
One can write that while condition much shorter:
Code:
while [ 1 ]; do
Since the brackets might be a pita on the N900's keyboard another option would be:
Code:
while true; do
Edit:
btw: If you chose a date format like '+%F_%X' your files will automatically be sorted the correct way without explicitly sorting by time.

Last edited by sulu; 2012-01-12 at 09:59.
 

The Following 2 Users Say Thank You to sulu For This Useful Post:
Posts: 215 | Thanked: 348 times | Joined on May 2011
#5
Originally Posted by sulu View Post
One can write that while condition much shorter:
Code:
while [ 1 ]; do
Since the brackets might be a pita on the N900's keyboard another option would be:
Code:
while true; do
Edit:
btw: If you chose a date format like '+%F_%X' your files will automatically be sorted the correct way without explicitly sorting by time.

thanks


also, as a extra, is there a way for me to calculate the exact time taken (in minutes) between the first and last screenshot taken?
so I can do something like this:

convert -annotate [time difference between first frame vs last frame] *.png result.gif

display a annotated text over the animation on how long that piece has taken?


edit: also the code works really well, I can even set it at 3 seconds per each shot and I can draw without lag, much much better than screencasting

Last edited by lonk; 2012-01-12 at 16:51.
 
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#6
Another way, using gstreamer:
gst-launch-0.10 ximagesrc ! video/x-raw-rgb,framerate=1/10 ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="frame%05d.png"

This creates png images every 10 seconds with the name
frame00000.png frame00001.png ....

Or with timestamp on top of each frame:
gst-launch-0.10 ximagesrc ! video/x-raw-rgb,framerate=1/10 ! ffmpegcolorspace ! cairotimeoverlay ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="frame%05d.png"

I am no expert on creating movies from images, but this should work
ffmpeg -r 1/2 -i frame%05d.png -r 24 -b 1M timelapse.mpg

where the "-r 1/2" option defines the used input framerate.That way
your 1 per 10 seconds image will be rendered as 1 per 2 seconds, like a time lapsed movie.
 

The Following 6 Users Say Thank You to nicolai For This Useful Post:
Posts: 215 | Thanked: 348 times | Joined on May 2011
#7
Originally Posted by nicolai View Post
Another way, using gstreamer:
gst-launch-0.10 ximagesrc ! video/x-raw-rgb,framerate=1/10 ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="frame%05d.png"

This creates png images every 10 seconds with the name
frame00000.png frame00001.png ....

Or with timestamp on top of each frame:
gst-launch-0.10 ximagesrc ! video/x-raw-rgb,framerate=1/10 ! ffmpegcolorspace ! cairotimeoverlay ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="frame%05d.png"

I am no expert on creating movies from images, but this should work
ffmpeg -r 1/2 -i frame%05d.png -r 24 -b 1M timelapse.mpg

where the "-r 1/2" option defines the used input framerate.That way
your 1 per 10 seconds image will be rendered as 1 per 2 seconds, like a time lapsed movie.
I tried this but it didn't work for me, it says "gst-launch-0.10 not found". I tried to install gst-launch-0.10 or gstreamer with apt-get but it says couldn't find package
thanks for the code on making videos, I'll use this for uploading to youtube




About my previous post, I started writing my own script (my first serious one too, so no laughing at it when I show it and it looks very noobish )
It's going ok so far (I got the time duration bit sorted out), but I have one quick question:

-is there a way to stop a script by key press when on another window? or is the only option ctrl+C while on the Xterm window?
 
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#8
Code:
sudo gainroot
apt-get install gstreamer-tools
to get gst-launch
 

The Following 2 Users Say Thank You to michaaa62 For This Useful Post:
Posts: 215 | Thanked: 348 times | Joined on May 2011
#9
thanks, I tested it and works no problem

when I close it it says this

Code:
^CCaught interrupt -- handling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 98552154543 ns.
Is there a way I can print the "98552154543 ns." part? so I can use that and convert it to minutes and add it to the final gif/mpg timelapse file? (like I already mentioned I already learned a way to get the time duration, but if I can print that it might take less lines of code to do it)
 

The Following User Says Thank You to lonk For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 15:54.