If you've been following my site at all, or just browsing through, you'll see that I've tried to make this site friendly for older computers, specifically older Macintosh models such as my Centris 650 or LC475.
So far I've managed to optimize images and I've built a podcast system to listen to my favourite channels but what about video?
Well truth be told I did some digging into this I think two summers ago and just left it. Today I wanted to try adding a video to this site and yoinked up my old script again. Thought you might want to see how I did it.
What you need!
Macintosh computers using Quicktime can use a video format called Cinepak which was released around 1991 and was used also for videos on Sega Saturn systems. Because of it's low complexity it is a suitable format for our lowly 68K processors.
To transcode a video from say an MP4 to cinepak (which uses the .mov container) I used ffmpeg on my Xubuntu based laptop to encode the file. To get this, you can enter the magic incantation here:
#!/bin/bash
#$1 is file name to transcode
#$2 is the output title
filename=$1
vq=16
fps=15/1
vproc="pp=ac,pp=ac,pp=ac,hqdn3d=5,eq=contrast=256/220:brightness=1/512:saturation=256/224:gamma=16/16,scale=320:-4:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp,minterpolate=fps=$fps:mi_mode=mci:me_mode=bidir:me=ntss:vsbmc=1,xbr=2,scale=320:-4:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:sws_dither=2:in_range=0:out_range=2,format=pix_fmts=rgb24,pad=320:240:(ow-iw)/2:(oh-ih)/2"
aproc="pan=mono|FC<1.414FC+FR+FL+0.5BL+0.5SL+0.25LFE+0.125BR,firequalizer=gain='if(gte(f,25),0,-INF)+if(lte(f,11024),0,-INF)',dynaudnorm=p=1/sqrt(2):m=100:s=20,firequalizer=gain='if(gte(f,25),0,-INF)+if(lte(f,11024),0,-INF)',aresample=resampler=soxr:osr=22050:cutoff=0.990:dither_method=shibata"
ffmpeg -threads 0 -hide_banner -v 32 -stats -y -i $filename -vf $vproc -c:v cinepak -q:v $vq -af $aproc -c:a pcm_s8 -f mov "$2.mov"
Because of it's low complexity, the output file sizes are quite large actually for our test video of 40seconds, I processed my iphone's video through Handbrake to make a 720p version.
At 1280x720 my file size is: 18MB
Using Cinepak scaled down to 320x180 is: 6.7MB
Putting it on the Web
To make a page friendly for both modern and elderly computers, you can count on older browsers to safely ignore HTML tags they don't recognize.
As such we can dump the following code on a page that will either embed the high quality video on a modern browser, or provide a link to the cinepak video if we choose to click on it on an older computer.