imdecode incoming stream

asked 2014-07-07 08:11:24 -0600

MRDaniel gravatar image

updated 2014-07-07 08:20:49 -0600

berak gravatar image

Hello,

I am recieving a stream from rtmpdump of type char*. So, it's an RTMP stream.

I have converted pushed each of the 3518 char items into a std::vector<uchar>

cv::Mat img = cv::imdecode(bufVec,0);
cv::Mat img = cv::imdecode(cv::Mat(bufVec),0);
cv::Mat img = cv::imdecode(bufVec,1);
cv::Mat img = cv::imdecode(cv::Mat(bufVec),1);

All of these attempts do not yield an image. The cv::Mat img has 0 rows and 0 cols. The rtmpdump example code writes this data to a file object.

If i read the uchar array to the console, it has a lot of meta data etc.

This is what i get if i push the data to the console.

C:\fakepath\Untitled.png

Any clues on how to approach this? How do i get each frame?

edit retag flag offensive close merge delete

Comments

1

no way cracking RTMP packets with imdecode, imho.

berak gravatar imageberak ( 2014-07-07 08:19:21 -0600 )edit

@berak flash players seem to manage it ok. It must be possible! :) I don't mind coding this, but a few pointers to get me thinking along the right lines would help a great deal here. Don't tell me it can't be done. Tell me why it _currently_ can't be done, and perhaps there is a way around it.

MRDaniel gravatar imageMRDaniel ( 2014-07-07 08:30:06 -0600 )edit
1

sure it can be done, just not by simply thowing it at imdecode.

aren't there libs for this ?

can't you plugin into ffmpeg, gstreamer or such ?

berak gravatar imageberak ( 2014-07-07 08:44:18 -0600 )edit

i totally forgot to ask the obvious:

did you try VideoCapture("whatever://my.stream.url") ?

berak gravatar imageberak ( 2014-07-07 09:43:28 -0600 )edit

I've tried that but the rtsp support for my media server isn't great. I can try gstreamer, thank you @berak.

MRDaniel gravatar imageMRDaniel ( 2014-07-07 16:12:28 -0600 )edit

@berak, for future reference, here is the RTSP attempt https://groups.google.com/forum/#!topic/c-rtmp-server/jw-ZEmjXQ68

MRDaniel gravatar imageMRDaniel ( 2014-07-07 17:35:08 -0600 )edit