Streaming video over Gopher
Yesterday on the gopher-project mailing list, Wolfgang Faust gave a Gopher link to a streaming text file showing the current server time. Today, with his help, I have got video streaming over Gopher. In webcam streaming, Motion JPEG over HTTP is the defacto standard. The problem with Motion JPEG is that it is not actually a file format but a method of sending single JPEG frames over HTTP, one after another, as a MIME multipart document.
Gopher does however have an item type for GIF and GIF files can be animated. The solution therefore appeared to be to encode the video as an animated GIF and stream that.
#!/bin/sh /usr/bin/ffmpeg -r 1 -s qvga -i http://localhost:8090/low.mjpeg \ -pix_fmt rgb24 -f gif pipe:1 2>/dev/null
Above is the magic script that converts from a Motion JPEG stream into
an animated GIF. Our Motion JPEG stream is produced by
binary incuded with the ffmpeg distribution. By placing this into inetd
it allows any application with access to the port it’s running on to
start the transcoding of an animated GIF and stream the output.
Two examples of using this stream are:
I’ve requested the firewall rules on the Computing Society’s sandbox are modified to allow our Gopher server to see the webcam stream and as soon as they are, I’ll get the stream set up on our Gopher home page.