Lossless video

I like to use Big Buck Bunny, because it is completely free in terms of copyright and licensing. All the source files are provided, so you can generate an arbitrary resolution movie. Thankfully xiph.org has taken the time to render all the frames in 1080p in an uncompressed png format. The audio is also offered in 5.1 lossless flac format.

Here’s a test run for the first 15 seconds of the movie into a completely lossless ffv1 video codec and flac audio vodec avi.

$ ffmpeg -t 15 -r 24 -f image2 -i BBB/BBB-1080-png/big_buck_bunny_%05d.png \
-i BBB/BigBuckBunny-stereo.flac -vcodec ffv1 -s 1280x720 test.avi

The result however is difficult to play, because of the immense amount of data that needs to be read off of the hard drive. I need to try reading this off a RAID or a solid state drive.

video stats

  • frames: 14315
  • fps: 24
  • duration: 9:56.5 minutes
  • bytes for video (uncompressed): 89,050,752,000
  • bytes for frames (lossless compression): ~30,292,344,000
  • bytes per frame (uncompressed): 6,220,800
  • average bytes per frame (lossless compression): ~2,116,100
  • video bitrate (uncompressed): 1,194,393,600
  • video bitrate (lossless compression): ~406,296,196

audio stats

  • 48000 Hz
  • 24 bit
  • bytes for stereo audio (uncompressed): 229,040,000
  • bytes for stereo audio (lossless compression): ~150,000,000
  • audio bitrate per channel: 1,536,000
  • audio bitrate per channel(lossless compression): ~1,005,900
Uncompressed Lossless compression Lossy compression
Video (mbps) 1,194.4 406.3 10
Audio (kbps) 1536.0 1005.9 192

It’s a factor of 3 to go from uncompressed video to lossless, then another factor 0f 40 for lossy.

It’s a factor of 1.5 to go from uncompressed audio to lossless, then another factor of 5 for lossy.

Video might have compressed more since this is a computer generated animation. 90 gigs uncompressed to 30.5 gigs lossless to 800 megs lossy. lossy compression is very important if you want filesizes to be manageable. I have to applaud the creators of these various codecs for being so effective. If I actually tried to encode the video with a lossless codec (ffv1), I would probably get more than a factor of 3 compression.

No Comments

NFTS Write Support in 2.6 Kernel

Enable NTFS write support under File Systems —> DOS/FAT/NT Filesystems —> NTFS file system support

No Comments

Hard Drive Prices

Sweet spot seems to be 1.5 TB, but there is a cheap 1 TB Hitachi with $5 rebate.

No Comments

Python Script for Downloading

Handy script to pull from a website

import sys
import os
# download files
for i in range(1,10):
  sUrl = "http://media.xiph.org/BBB/BBB-1080-png/";
  sFilename = "big_buck_bunny_" + str(i).zfill(5) + '.png';
  os.system('wget ' + sUrl + sFilename);

No Comments

Windows Programs

Programs to install in windows
  • Avira AntiVir
  • Firefox w/ ABP and NoScript
  • Thunderbird
  • Sunbird
  • VLC
  • SecureCRT
  • SecureFX
  • TightVNC
  • Xming (mesagl version)
  • Pidgin
  • Quicktime
  • iTunes
  • Audacity
  • MikTeX
  • TexNicCenter
  • JabRef
  • Blender3d
  • 7zip
  • MS Office
  • Adobe CS

No Comments

Captchas

I added some captchas to decrease spamming. Even though my spam filter sorts spam out, it is getting harder and harder to tell false positives until I look at the website links added. Only humans are allowed to comment.

No Comments

SSH Tunneling VNC

Because I forgot, I decided to make a post.

on remote machine, start vncserver

$ vncserver

on local machine, tunnel ssh

$ ssh –L 5901:localhost:5901 user@host.com

$ vncviewer locahlost:5901

No Comments

Incremental Backups

Backup script for incremental backups using tar

Do a yearly, quarterly, monthly, weekly, daily incremental backup.

#!/bin/sh
BACKUPNAME="home"
DIRBACKUPSTORAGE="/backup"
DIRTOBACKUP="/home/username"
DOW=`date +%a` # doy of the week, Sun
DOM=`date +%d` # day of the month, 01
DM=`date +%d%b` # date and month 01Jan
YMD=`date +20%y%m%d` # datestamp
M=`date +%b` # month Sep

# Yearly level 0 backup
if [ $DM = "01Jan" -o ! -f $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap ]; then
  rm $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap
  tar -c -v -J -g $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap -f $DIRBACKUPSTORAGE/$BACKUPNAME-$YMD.0.tar.xz \
$DIRTOBACKUP
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap $DIRBACKUPSTORAGE/$BACKUPNAME.1.snap
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap $DIRBACKUPSTORAGE/$BACKUPNAME.2.snap
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap $DIRBACKUPSTORAGE/$BACKUPNAME.3.snap
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap $DIRBACKUPSTORAGE/$BACKUPNAME.4.snap
fi
# Quarterly level 1 backup
if [ $DM = "01Apr" -o $DM = "01Jul" -o $DM = "01Oct" ]; then
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.0.snap $DIRBACKUPSTORAGE/$BACKUPNAME.1.snap
  tar -c -v -J -g $DIRBACKUPSTORAGE/$BACKUPNAME.1.snap -f $DIRBACKUPSTORAGE/$BACKUPNAME-$YMD.1.tar.xz \
$DIRTOBACKUP
fi
# Monthly level 2 backup
if [ $DOM = "15" ]; then
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.1.snap $DIRBACKUPSTORAGE/$BACKUPNAME.2.snap
  tar -c -v -J -g $DIRBACKUPSTORAGE/$BACKUPNAME.2.snap -f $DIRBACKUPSTORAGE/$BACKUPNAME-$YMD.2.tar.xz \
$DIRTOBACKUP
else
# Weekly level 3 backup
if [ $DOW = "Sun" ]; then
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.2.snap $DIRBACKUPSTORAGE/$BACKUPNAME.3.snap
  tar -c -v -J -g $DIRBACKUPSTORAGE/$BACKUPNAME.3.snap -f $DIRBACKUPSTORAGE/$BACKUPNAME-$YMD.3.tar.xz \
$DIRTOBACKUP
else # Daily level 4 backup
  cp $DIRBACKUPSTORAGE/$BACKUPNAME.3.snap $DIRBACKUPSTORAGE/$BACKUPNAME.4.snap
  tar -c -v -J -g $DIRBACKUPSTORAGE/$BACKUPNAME.4.snap -f $DIRBACKUPSTORAGE/$BACKUPNAME-$YMD.4.tar.xz \
$DIRTOBACKUP
fi
fi

Restoring

$ tar --extract \
           --listed-incremental=/dev/null \
           --file home.0.tar
$ tar --extract \
           --listed-incremental=/dev/null \
           --file home.1.tar

References

No Comments

DVD to mp4

$ mplayer -dvd-device /mnt/disk dvd://<title >

$ mplayer dvd://1 -dumpstream -dumpfile dump.vob

ffmpeg -t 15 -i VTS_01_1.VOB -deinterlace -acodec libfaac -ab 160k -vcodec libx264 -vpre hq -b 5000k -threads 0 output.mp4

References

No Comments

MATLAB: urlread

Just found out about urlread.m. I can make some matlab and octave webpage pullers now.

No Comments