Monday 27 August 2012

recording video, realitime

ffmpeg -f alsa -ac 2 -i pulse -r 30 -f x11grab -s 1920x1200 -i :0.0 -vcodec libx264 gwMINE_footage_1.mkv

or now,

avconv \
-f x11grab -r 30 -s hd1080 -i :0.0 \
-f alsa -ac 2 -i pulse \
-vcodec libx264 -vf 'scale=-1:720' -pre:v lossless_ultrafast \
-acodec libmp3lame \
-y outfile.avi

Friday 17 August 2012

rsync incremental backups

A directory holds incremental backups (I've mounted a remote directory locally to ease the command but ssh could also be used), in numerical order.  If the last backup number was 5, the next will be 6.  rsync is used to create the incremental backup:

$ crontab -e

Add this for nightly backup:


0 0 * * * i=`ls /mnt/Apollo/archive | tail -n 1`; i=${i%/}; j=$((i+1)); rsync -azm --delete --progress --include='*/' --include='*.tex *.dat *.DAT' --exclude='*' --link-dest=/mnt/Apollo/archive/$i/ /home/me/ /mnt/Apollo/archive/$j

which breaks down as,

0 0 * * *
  : at 0 minutes, 0 hours every day every month every year execute:

i=`ls /mnt/Apollo/archive | tail -n 1`
  : get listing of archive directory in increasing number order (I hope!)

 i=${i%/}
  : Remove the trailing slash from the directory name

j=$((i+1)) 
 : Add one to it and assign to j.

rsync:

-a
(rchive) : preserve file parameters (owner, read/write/execute etc)
-z
(ip) : compress during transmit.
-m
 : do not create empty directories on the backup.
--delete
  : if a file is deleted on the source, remove it on the backup (I hope from the incremental!)

--include='*/' 
 : required to get this to work!
--include='*.tex *.dat *.DAT'
   : files to archive.
--exclude='*' 
  : don't archive anything else.
--link-dest=/mnt/Apollo/archive/$i
    : the reference archive directory used to generate deltas from.
/home/me/
   : start point for information to be backed up.
/mnt/Apollo/archive/$j 
  :  target for incremental data.