The model 333 camera is able to encode and stream video in Ogg Theora in realtime. In order to encode in Theora the older 6.3.9 firmware must be loaded onto the camera. Due to space limitations in the FPGA, each firmware can only support a single encoding algorithm, either MJPEG or Theora. The 6.3.x series supports Theora and the 6.4.x and 6.5.x series support MJPEG.
The 353 camera has a larger FPGA with space for both Theora and MJPEG compressors. Porting the Theora compressor to the 353 is targeted to begin around September 2007.
We plan to resume Ogg Theora project on the new 353 hardware - Axis ETRAX FS is faster so it will better handle streaming (the bottleneck of the Ogg Theora implementation in Model 333).
Combining MJPEG and Theora in the same FPGA would complicate things - my plan is to unify the software part and the non-compressor part of the FPGA code that now are more advanced in MJPEG branch (histograms, gamma correction, timestamping, support of newer sensors). It will be possible to replace FPGA code at run-time or use software (lossless) Theora->JPEG conversion with the faster CPU. I'm also counting on native support of Theora in the browsers (like in Opera) so we can completely switch to Theora.--Andrey.filippov 11:57, 14 May 2007 (CDT)
Once the 6.3.9 firmware is loaded and an IP address is configured, the web interface on the camera is used to download short Theora clips for testing and also to set the video parameters which are also used by the Theora streamer. There are quite a few settings so it can take some time to adjust them properly to get a good picture.
Instead of requesting the page through a browser, wget can be used to download short Theora clips from the camera. When processing web requests the camera will first capture the entire clip to RAM and then begin to send the clip over the network. Requesting a Theora clip of only a single frame can be used to quickly adjust the video parameters from a script without taking much time to capture any video.
The Theora streamer can be acquired from the SourceForge download site and the file is Theora_str_1.0.tgz. This contains the source and compiled binaries for the streamer (theora_str) and the receiver (theorartp-client).
For the following examples it's assumed that the streamer has an IP address of 18.104.22.168 and the receiver has an IP address of 22.214.171.124. The examples use unicast rather than multicast for simplicity.
This method uses HTTP to transfer the executable to the camera so a webserver of some sort is required. In addition this is temporary and will be completely lost when the camera is powered off.
$ telnet 126.96.36.199 $ cd /tmp $ wget http://webserver/theora_str $ chmod +x theora_str $ ./theora_str -a 188.8.131.52 -p 20000 -k 25
This will download and run the streamer on the camera. The -p option is the IP port and the -k is the number of interframes between intraframes (keyframes) in the Theora stream.
$ theorartp-client -i 184.108.40.206 -p 20000 -f output.ogg
By default the camera will stream as fast as possible which may not be desirable. The theora_str program has a -f/--fps option that appears to allow the framerate to be adjusted but this ends up corrupting the Theora stream, rendering it unusable.
The maximum framerate is affected by the resolution of the frames, the exposure time, and the sensor clock. Of these three variables, the sensor clock is the only option that can be adjusted that won't dramatically affect the appearance of the frames.
To adjust the sensor clock, add an sclk parameter to the URL with a value specified in megahertz. The default and maximum sensor clock is 48 MHz. For example, to cut the framerate approximately in half, add "&sclk=24" to the URL.
These are issues that exist with the existing Theora streamer version 1.0:
- Frames with encoded sizes larger than around 100KB aren't transmitted. This appears to be caused by an explicit check of the frame size at line 469 of theora_str's main.c.
- An integer overflow exists in theora_str which causes streaming to halt after 45 minutes (at 5 FPS). The delta variable used in the while loop at line 454 of theora_str's main.c becomes negative and causes a very long sleep in the program.
- The -f/--fps option for theora_str doesn't work properly. The framerate must be throttled with the sclk option added to the configuration URL as mentioned above.