What is the best (and simplest!) way to record video from a webcam to the local filesystem--all from a browser? Ideal开发者_如何学运维ly the video would be recorded in HD and then we could use ffmpeg later to convert it into the formats and sizes needed.
Here are some things we've looked into:
- Use Flash to stream to a local Red5 server. But we've had issues with video quality here.
- A Java applet using JMF (can we even write to the filesystem from an applet?). We've heard this might not be very efficient though. Can it handle HD?
- Write a custom Firefox plugin. Would this be very difficult?
Basically the hardest thing here is that the controls need to be embeddable into a browser. All we need is a box where the webcam frame is displayed to the user, and then some Javascript hooks so we can code start/stop buttons within the HTML page.
The computer is fully controlled (it's a kiosk) and we can do just about anything to it. We just need a solution that runs in the browser. Our current app is run in Firefox in kiosk mode and the webcam recording is just a part.
Like others have mentioned, it is extremely difficult to write any file to the local filesystem from within a browser, due to security sandboxing. Your solution with Flash/Red5 is a good solution.
To resolve your issue of video quality, the Camera object has a function called setQuality. Depending on the capture resolution you want to use (which you set using Camera.setMode), it may be worthwhile to use some compression (for the same reason web servers use compression). You can disable compression altogether by using cam.setQuality(0,100). You should also take a quick look at the API in case I goofed.
Also, like Zárate mentioned, this may be a configuration issue with Red5. So if changing the quality in Flash doesn't help, check the Red5 Mailing Lists.
The local Red5 looks like your best bet. Whatever quality issues you might have sound simpler to resolve than any of the other options.
Either pop by the Red5 mailing list and find out about tweaking quality or if you know enough Java have a go yourself.
Makes sense?
J
if you're still looking for a solution, you can try:
https://framebase.io/
They have a recorder widget that will automatically transcode the video for you when a user saves the recording. You'll just then have to do an API call to get the video back once it's done transcoding.
If you have full access to the computer, you should use a desktop application to record the video. Recording video and local storage are both relatively difficult for a web application, and I don't think your solutions will be much more portable than a desktop application.
精彩评论