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. Any suggestions? Thanks in advance.
This question is marked "community wiki".
asked 21 Jun '10, 13:19 Naana |
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. 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. 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.) 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. 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. 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. 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. Good luck.
link
This answer is marked "community wiki".
answered 28 Jul '10, 00:44 DBA Thanks a lot DBA; most grateful for your comment, suggestion and advice. I will look into the idea of shell scripting. It is really a non-trivial engineering project but one has to start from somewhere to get results. Thanks so much.
(28 Jul '10, 14:08)
Naana
|
Welcome to LinuxExchange, Naana! Could you please describe your problem more in detail? I'm afraid I cannot understand your problem correct.
I'm sorry but StackOverflow would be much more suitable for this question. But don't request code for such a complex solution, be detailed and precise and you'll get help.