Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

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's gravatar image

Naana
112
accept rate: 0%

edited 28 Jun '10, 12:29

Welcome to LinuxExchange, Naana! Could you please describe your problem more in detail? I'm afraid I cannot understand your problem correct.

(21 Jun '10, 18:33) guerda
1

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.

(28 Jun '10, 14:13) guerda



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's gravatar image

DBA
2264
accept rate: 23%

edited 28 Jul '10, 01:20

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
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×90
×24
×23
×19
×2

Asked: 21 Jun '10, 13:19

Seen: 2,567 times

Last updated: 23 Mar '11, 10:23

powered by OSQA