I wrote a little perl script to automatically download iView shows so I could watch them on the train much like some of the existing scripts that are around (except fully automatic)
I found it hard working out if the file had downloaded successfully – the file size reported by iView was often vastly different to the file that was actually downloaded.
After a little research on the FLV container format I found that I could calcu-guess™ the duration of the downloaded FLV file by reading the timestamp from the file – so I incorporated a timestamp check and retry system into my perl script.
None of the existing scripts have/had this ability and given they are written in bash/sh/batch they don’t really have a way to work with a binary file – so I ported that chunk of perl code to some c code, and am now releasing it – under GPL2 :)
Download the Windows binary & C source for FLVDuration
Compiling on linux is very easy
gcc -Wall flvduration.c -o flvduration
This program accepts the file name of a flv file as a parameter and prints out it’s duration in seconds and minutes as a decimal
freman-desktop:~$ ./flvduration sample.flv
FLVDuration v1.0.1 by Shannon Wynter - http://fremnet.net
Runtime in seconds: 525.44
Runtime in minutes: 8.76