PDA

View Full Version : Streaming Video



khrave
25th May 2010, 16:50
Hello everyone!

I recently started a task of trying to stream video from a webcam thats plugged into one of my usb ports into a Qt widget in Ubuntu linux. There are very few well documented examples of this within a recent time period. The webcam I am using is a Logitech 1.3 megapixel that is compatible with the Linux distribution I have.

I saw on some post during my googling endeavors a person reading /dev/video0 as if it were a file and trying to get the video data read in this way. My question then, is twofold: Can video data be retrieved this way, using the /dev files? And how do you get the webcam's video data into a buffer to start decoding it? I have very little knowledge of working with video and don't know how to decode the data yet, but a step in the right direction would be very helpful.

I don't have any relevant code to speak of, so any tips or code examples would be greatly appreciated. Thanks for your time!

I forgot to mention that I am using Qt Creator 1.3.1 which is based on Qt 4.6.2 (32 bit).

khrave
25th May 2010, 18:50
Ok cool, I'll read through this stuff. Thanks for the info! Feel free to post whatever else you come across :P.

khrave
25th May 2010, 20:48
Those documents have a LOT of information that I don't really understand. The authors are writing down structs and commands that I have never seen or heard of. I simply need to get the video data, decode it if necessary, and display it in a widget. If this information is being shown to me and I am just too ignorant to find it, I apologize. If there are some more clear examples with more fleshed out code you (muisei) or anyone are aware of, they would be greatly appreciated. Thanks again!

khrave
27th May 2010, 20:08
Ok, so I found some code from the same project a few years ago. The person who wrote it is attemping to use UDP sockets to read in video data and then decode it with ffmpeg. I have been informed that the video I will be receiving and putting into my Qt program will be Mpeg4, but I don't know how it is supposed to be encapsulated. All of that is moot at this point anyway, because I am using VLC to stream video to the loopback address (127.0.0.1) and the Qt program is reading that in.

When I use the MPEG4 Codec with certain encapsulations, it will throw the following errors at me.

[mpeg4 @ 0x83ec350]looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag

[mpeg4 @ 0x83ec350]warning: first frame is no keyframe

[mpeg4 @ 0x83ec350]ac-tex damaged at 18 3

[mpeg4 @ 0x83ec350]Error at MB: 141

[mpeg4 @ 0x83ec350]concealing 1116 DC, 1116 AC, 1116 MV errors.

I have attached the .cpp file where the decoding of the video is "supposed" to happen. Thanks for your help!