Create a web server to feed cam video
|Status:||Closed||Start date:||22 Aug 2013|
|Category:||04 - Root File System|
|Target version:||1.0 - Atreides|
|Severity:||03 - Medium|
I need a web server package added to buildroot and I need to install my small web files for it to server up ffmpeg output via crtmpserver.
I need to list exactly what has to happen for this to work too.
RM #220: Fix logs directory. Make pkg target depend on main build stamp .$(MONKEY_T).
RM #220: Added init script to monkey that uses a stamp file to determine if it will start or not.
RM #220: Added init script that utilizes a stamp file to determine if the rtmp server should start or not.
#1 Updated by Hammel almost 6 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
lighttpd, tinyhttpd and boa are available in Buildroot. tinyhttpd can be eliminated because it has no online presence and was just a student project, which means it may not be seeing any active development.
Monkey has a C-API, as does Mongoose. The C-API is appealing in Monkey (less overhead with scripting languages). I've used Mongoose in the past but it's not actively developed. It is very small and doesn't fork. But it might be too small for PiBox's needs. Mongoose was easy enough to learn by reading the code and an example. Monkey has some documentation and a nice web site but I don't see much online about the API.
boa is stable and widely used. Linux Journal has a short article on using it.
I think what I need to define is what I want to display (images, layout, etc) and determine how I want to do that before picking a server.
#2 Updated by Hammel almost 6 years ago
- % Done changed from 10 to 20
- PHP builds page based on
- Webcam availability
- USB SD card availability (video files)
- select a file (or webcam)
- Start JWPlayer to crtmpserver
Buildroot's php is 5.3.x, which is sufficient for anything I might want to do.
#3 Updated by Hammel almost 6 years ago
- % Done changed from 20 to 30
After playing with a number of the available httpd options I settled on Monkey due to it's apparent ease of configuration to enable PHP (re: CGI) support.
I've created a cross build for monkey and have tested the installed opkg on the target. It comes up enough to know its basically working though the default configuration needs to be adjusted. Configurations are under /etc/monkey, with monkey.conf, plugins.load and plugins/cgi/cgi.conf the most likely candidates for updates.
Once the configuration is fixed I can try writing a simple PHP-based test to make sure it's serving up PHP-based content.
#4 Updated by Hammel almost 6 years ago
- % Done changed from 30 to 40
The default config essentially works. All I have to do is place my php files under /home/httpd/monkey/php. It doesn't work from the top level directory. There isn't anything in the /etc/monkey/plugins/cgi/cgi.conf that specifies php has to go under the php directory, but that appears to be the case.
I need to change the default config to use port 80 now and force a redirect from index.html to php/index.php and that should be the start of the web server support on PiBox.
#6 Updated by Hammel almost 6 years ago
Testing complete feed of webcam, through ffmpeg to crtmpserver across to web browser.Setup under pibox:/home/httpd/monkey
- crtmpserver.html - pulls feed from ffmpeg
- jwplayer directory
I don't know if this works for tablets, however. I tested on my x86 Fedora 16 desktop.
- chown -R nobody.nobody /home/httpd/monkey (or alternative non-root user)
The streaming works, but the image is about 4 seconds behind. That's unusable. I need to find a way to speed things up. One possible solution is to use the options I discovered in RM #192: --intra and -qscale 2
#7 Updated by Hammel almost 6 years ago
- File camff.sh added
- File crtmpserver.lua added
- File crtmpserver2.html added
- % Done changed from 40 to 50
I now have the best working version of this I think I can get for the prototype. I've tweaked how ffmpeg reads from /dev/video and feeds crtmpserver (see updated camff.sh). This works fairly well with occasional hickups from ffmpeg. This may be due to the old version of ffmpeg and I certainly need to try to cross compile an updated ffmpeg to test that theory.
crtmpserver seems to work fine (see crtmpserver.lua). It doesn't seem to have any crash problems that I can see. It only accepts flv input - the mpegts support is apparently unavailable (at least from the open source version). I tested it's use with flv to a browser with JWPlayer and that part seems okay from the crtmpserver side. I've not tested HTML5 support yet.
The bigger issue I'm having with testing this is network stability. The network seems to die after a period of time. Sometimes quickly, other times it takes a while. I let it run for hours last night - it eventually died overnight at some point because my ssh sessions went away. Pinging it this morning shows it's back and ssh's work again. So something is not right with either my wireless routers (highly likely) or with PiBox's wireless adapters (I've tried the two that have AP support and both appear to have the same problem, which seems odd).For the proof of concept what I have now is sufficient. I need to do the following:
- Add an init script to the Monkey opkg that tests for a run-stamp. If the run-stamp is found, monkey starts. If not, it doesn't. This will allow me to create a web based front end to configure features in PiBox.
- Add an init script to the crtmpserver opkg, also with a run-stamp.
Once those are done, this issue can be closed for the first release.
#10 Updated by Hammel almost 6 years ago
- % Done changed from 70 to 80
Added init script that utilizes a stamp file to determine if it will start or not to the crtmpserver opkg.
The three (monkey, crtmpserver and piboxwww) now need to be tested to make sure they install cleanly and come up correctly.