Search This Blog

Saturday 31 October 2015

screen capture

http://paste.debian.net/319011/

I wanted to do a screen capture to show how my fittstool desktop worked, but I wanted to use free/libre software for the capture and the end product.

I found I could capture sound and video with this command

ffmpeg -f alsa -ac 1 -ar 44100 -i hw:1 -video_size 1440x900 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast  `date +%Y%m%d%H%M%S`.mkv

Then I had to re-encode to a freer format that took ages and looked crap.

I tried using vp8 and after many attempts I got a reasonable webm screen capture. Running sound and video capture in the same command failed to grab all the sound but I discovered that running them as seperate commands worked fine!

I added both commands to a script and muxed them without the need to re-encode.

Capture screen and rename with date and time year-month-day-hour-seconds in a libre format.


##"capture-libre" script##


#!/bin/bash
## capture screen and rename with date and time year-month-day-hour-seconds in a libre format
ffmpeg -f alsa -ac 1 -ar 44100 -i hw:1  `date +%Y%m%d%H%M%S`.ogg &

ffmpeg  -video_size 1440x900 -framerate 20 -f x11grab -i :0.0 -c:v libvpx -crf 10 -b:v 1M  `date +%Y%m%d%H%M%S`.webm &


This will produce two files an ogg with the sound and a webm video both named the same and as near as damn it the same length.

Then killall ffmpeg to stop it! crude I know.

Now mux them in to one file, video with sound.

ffmpeg -i mux20151104112754.ogg -i mux20151104112754.webm -c copy  -shortest mux20151104112754.webm

edit: I have since modded the scripts and now have a capture script and a stop-mux-clean-move script

 video