I decided to create a time-lapse screen recorder as a side project. Mostly for fun, but also to see how I spend my work days.
I got the original idea from Nick Winter in this youtube video. He worked a 120-hour work week as a personal challenge, and no doubt posted the video as an inspiration for others to do the same or something similar. Me being me, however, I was more interested in the technology.
At first, I tried to find programs that already exist. The one he used (which he wrote) only works on Mac. I use linux. It was a pretty simple program, so I didn't think it would be that hard (or take that long) to reproduce. The plan was pretty straightforward: write a script to take screenshots periodically, then stitch them together into a video.
For taking screenshots, I used scrot. (Worst name for anything ever, in my opinion.) It has an excellent command line interface (perfect for automation), it offers several useful options, it can save with a custom filename or a timestamp, and it can execute a command of your choice afterward. So I created ten-line bash script to execute scrot every 10 seconds.
#!/bin/bash
cd /home/brwong/recorder
interv=10
echo "HELLO!!"
echo "today is " $(date)
echo "now recording ($interv) ..."
while true
do
scrot -z -e './resizer.sh $f $w $h'
sleep $interv
done
This will capture a screenshot, execute the resizer script on it (see below), sleep for the interval (10 seconds), and repeat. It will run until I kill the program. With a bit more complexity, I could add an interactive interface, or convert it into a background service.
The resizing script uses the convert
program from imagemagick to shrink the three-monitors-wide screenshot down to a standard HD video size, fill the rest of the image in black, and add a timestamp in the bottom corner. It's unfortunate for the video that my wide monitors setup is much wider than it is tall. If I were clever, I could break up the three separate screens and place one of them on top or underneath, but that might be a little disorienting; and it would take a lot more work. Also, if I wanted to, I could have used another program (such as ffmpeg) to snap a photo from the laptop's webcam and include a shot of me in the video.
#!/bin/bash
filename=$1
#givenwidth=$2
#givenheight=$3
convert $filename -resize 1920x -gravity North -background black -extent 1920x800 $filename
convert $filename -gravity SouthEast -pointsize 48 -fill red -annotate +100+0 $(date +"%H:%M") $filename
mv $filename snaps/$filename
When interpreting the program's arguments, keep in mind that this script is executed by scrot
in the recorder script. The givenwidth
and givenheight
were included because I was still trying to figure out how exactly the sizing worked. I left them in to hint that both scrot
and convert
have those options available.
After a day of work (or any length of time), I go to the terminal that was running the recorder script, kill it, then execute the compiler script. I'm a programmer, so I called it compiler.sh
. I don't know what the actual video editing term is for converting a series of images into a video.
I used mencoder for the task. The bash script first makes a list of all the images, and writes the list to a file. Because of the timestamp image filenames, they're already in the correct order. Then it calls mencoder
on that file, passing in the formats of the input images and desired output video, and specifying that there is no sound. Mencoder makes the video and puts it in the destination folder. Then, just for my convenience, the script uses xclip
to copy the path of the new video file to the clipboard, so I can open it afterwards. Normally, I delete the image files manually, in case something goes wrong with the compilation, but this could be included in the script as well.
#!/bin/bash
videoname=$(date +"%Y%m%d-%H%M%S").avi
rm -f files.txt
for i in snaps/*
do
echo $i >> files.txt
done
echo "mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o vids/$videoname -mf type=png:fps=20:w=5760:h=1200 mf://@files.txt"
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o vids/$videoname -mf type=png:fps=20 mf://@files.txt
rm -f files.txt
echo -n "$videoname" | xclip -selection clipboard -in
echo "wrote video file to $videoname"
A careful reader will discover that I used a for-loop to write the list of images in the "snaps" folder to a file, instead of simply writing the results of ls snaps
directly to a file. I'm hoping there was a valid, non-embarrassing reason for that, but it's entirely possible that there isn't.
And that's it! Three scripts that could really be one script, a bunch of easily automated yet not automated steps, and, ultimately, the functionality that I wanted. The end result was pretty cool, and I learned a few things along the way.
Antibiotics are substances that get their start in nature, usually as fungi or other forms of bacteria that exist in soils. These substances are able to bind to the cell walls of harmful bacteria, penetrating the cell to either kill the bacteria or prevent it from reproducing - antibiotics online, no prescription required, safe & secure payments. Two free pills (Viagra or Cialis or Levitra) available with every order.
Written on Tue, 21 Feb 2023 11:29:30 by antibiotic-247 |
Baclofen is a muscle relaxant drug. Baclofen reduces the severity of muscular spasms in neurological conditions like multiple sclerosis. It also reduces frequency of muscle spasms in multiple sclerosis. Baclofen is used for treating spasm of skeletal muscles that cause muscle clonus, rigidity, and pain due to multiple sclerosis.
Special offer: purchase baclofen only 0.66 per pill - https://nieuws.top010.nl/wp-content/uploads/cms/buy-baclofen-online/, get free AirMail shipping or free courier delivery and discount for all purchased! No prescription required, safe & secure payments, fast & free delivery.
Two free pills (Viagra or Cialis or Levitra) available with every order.
Tags: baclofen order online, baclofen purchase, get online baclofen no prescription
Written on Fri, 17 Feb 2023 22:47:20 by baclofen-Grone |
Cytotec (misoprostol) is used for reducing the risk of stomach ulcers in certain patients who take nonsteroidal anti-inflammatory drugs (NSAIDs).
Special offer: Buy Cytotec (Misoprostol) 200 mсg х 60 pills now only for $2.27 per pill, save $104.11 and get discount for all purchased!
Written on Tue, 07 Feb 2023 20:38:39 by misoprostol-100mg-30 |
Zithromax is used to treat many different types of infections caused by bacteria, such as respiratory infections, skin infections, ear infections, and sexually transmitted diseases. In children, it is used to treat middle ear infection, pneumonia, tonsillitis, and strep throat.
Special offer: Buy Zithromax 500 mg х 90 pills now only for $1.49 per pill, save $89.50 and get discount for all purchased!
Two Free Pills (Viagra or Cialis or Levitra) available With Every Order.
No Prescription Required. Safe & Secure payments.
Written on Thu, 02 Feb 2023 11:40:40 by zithromax-250mg |
Neurontin is used for treating seizures associated with epilepsy. Neurontin is an anticonvulsant.
Special offer: neurontin to buy only for $0.58 per pill, save up to $208.22 and get discount for all purchased!
Two Free Pills (Viagra or Cialis or Levitra) available With Every Order. No Prescription Required, safe & secure payments.
Written on Mon, 30 Jan 2023 04:06:01 by doxycycline-100mg |
What is doxycycline mainly used for? Doxycycline is a tetracycline antibiotic. This medication is used to treat a wide variety of bacterial infections, including those that cause acne.It works by slowing the growth of bacteria. Slowing bacteria's growth allows the body's immune system to destroy the bacteria. Doxycycline may treat: syphilis, acute gonococcal urethritis, pharyngitis, cholera and more. Doxycycline is also used to prevent malaria.
Special offer: buy doxycycline no prescription only for $0.34 per pill, save up to $311.56 and get discount for all purchased!
Two Free Pills (Viagra or Cialis or Levitra) available With Every Order. No Prescription Required, safe & secure payments.
Written on Fri, 27 Jan 2023 22:54:00 by doxycycline-100mg-270 |
I am not sure where you’re getting your information, but great topic.
Written on Mon, 09 Jan 2023 22:35:38 by antibioticsPa |
Thanks for great info I was looking for this info for my mission.
Written on Mon, 09 Jan 2023 19:33:51 by prednisonePa |
buy cialis usa Was diagnosed with PCOS when I was 19 and told I would need help if I ever wanted to conceive
Written on Fri, 23 Dec 2022 19:13:35 by GrooneCex |
I am not sure where you’re getting your information, but great topic. I needs to spend some time learning more or understanding more.
Thanks for excellent information I was looking for this info for my mission.
Written on Tue, 20 Dec 2022 03:36:43 by lasixGrone |