Answers to: usb video storagehttp://linuxexchange.org/questions/892/usb-video-storage<p>Am working on sending real time video data from an embedded Linux device on to a usb device. Am using the c language. Currently, I have a code that can detect the usb, my challenge is how to send the video data from the camera to the usb device.</p> <p>Any suggestions?</p> <p>Thanks in advance.</p>enWed, 28 Jul 2010 00:44:37 -0400Answer by DBAhttp://linuxexchange.org/questions/892/usb-video-storage/1158<p>This is really an instrument-design question. Whole books have been written on developing real-time data acquisition systems. Below are just a few considerations.</p> <p>Your first problem is going to be data rate. To sustain your throughput, you MUST flow data out as fast as it flows in. If you can do that, you can keep the process going until your USB device fills up. </p> <p>For any sort of video, you'd better be using at least USB2 for output. Even then, the USB2 specification lists 480 Mbps as the maximum raw data rate and your actual data rate had better be FAR below that. (That's because although 480 Mbps is the raw data rate spec for USB2, device peculiarities and all the overhead of tossing data through the system will slow things down.)</p> <p>Chances are that the the raw input from your video device will be much higher than the USB2 spec. Hence you'll have to do some real-time processing to decimate the data. Your output data rate will limit the video frame rate, pixel count, compression scheme, etc. that you can save. Assuming you've got a reasonably powerful machine, simple processing should be sustainable.</p> <p>The software to do all of this could be as simple as a pipeline within a shell script. By using the shell, you'll save yourself all of the problems of buffering data within your C program. I STRONGLY suggest USING the power of the shell rather than trying to duplicate it in your own code.</p> <p>In general, sending a binary stream to an output device using the shell can be done trivially by using "cat" or "dd" to the mounted output file. The system will automatically buffer data during interrupts. I'd suggest limiting your C programming to specific data-processing algorithms you want to perform.</p> <p>This is ignoring all sorts of considerations of device latency, guaranteed response times, garbage collection, optimization, etc. But without additional details, as guerda said, one can't be more specific. And even with the details it's a non-trivial engineering project. </p> <p>Good luck.</p>DBAWed, 28 Jul 2010 00:44:37 -0400http://linuxexchange.org/questions/892/usb-video-storage/1158