Ask Your Question

joecmama's profile - activity

2020-10-15 16:09:39 -0600 received badge  Enlightened (source)
2020-10-15 16:09:39 -0600 received badge  Good Answer (source)
2018-05-10 20:33:36 -0600 received badge  Nice Answer (source)
2018-03-15 09:38:24 -0600 received badge  Good Question (source)
2016-08-02 14:58:30 -0600 received badge  Nice Question (source)
2016-02-24 05:36:28 -0600 received badge  Famous Question (source)
2016-02-07 06:43:06 -0600 received badge  Student (source)
2016-01-05 13:00:44 -0600 received badge  Notable Question (source)
2015-11-05 11:45:29 -0600 received badge  Scholar (source)
2015-11-05 11:44:51 -0600 received badge  Popular Question (source)
2015-09-14 05:00:22 -0600 received badge  Teacher (source)
2015-07-14 10:41:39 -0600 received badge  Enthusiast
2015-07-13 14:06:59 -0600 received badge  Self-Learner (source)
2015-07-13 10:00:56 -0600 answered a question How to fix H264 decoding?

Not sure if you still need help. I think I struggled with similar issues and have solved some of the problems using libVLC with OpenCV. I use MS Visual Studio on Windows 7 and 8.1. Details are given here: http://answers.opencv.org/question/65932

2015-07-13 09:59:35 -0600 answered a question ip camera h264 error while decoding

I struggled with similar issues and think I have solved some of your problems using libVLC with OpenCV. FFMPEG seemed to have issues of not decoding H264 properly, plus the newer versions (2.4.11) seemed to have the TCP fix in there already for FFMPEG. Anyways, I use MS Visual Studio on Windows 7 and 8.1.

Details are given here: http://answers.opencv.org/question/65932

2015-07-13 09:57:43 -0600 answered a question OPENCV2.4.9 with IP cam have h246 error

I struggled with video feed being corrupted on my ip camera, and think I have solved some of the problems using libVLC with OpenCV. I use MS Visual Studio on Windows 7 and 8.1. Details are given here: http://answers.opencv.org/question/65932

2015-07-13 09:56:35 -0600 answered a question Read h264 stream from an IP camera

I was able to get a video feed using libVLC with OpenCV. I use MS Visual Studio on Windows 7 and 8.1. Details are given here: http://answers.opencv.org/question/65932

2015-07-13 09:54:37 -0600 answered a question IP camera video corruption - solutions?

I struggled with similar issues and think I have solved some of your problems using libVLC with OpenCV. I use MS Visual Studio on Windows 7 and 8.1. Details are given here: http://answers.opencv.org/question/65932

2015-07-13 09:51:51 -0600 received badge  Editor (source)
2015-07-13 09:50:31 -0600 answered a question how to stream h264 video with rtsp in opencv- partially answered

After summarizing my question and struggles, here is the answer and solution I've come up with so far. I've posted the question and the solution so others don't have to search through many other posts that don't quite solve the issues I've had, and to share details that I had to figure out which helped me. I am using Visual Studio on MS Windows 7 and 8.1 machines and coding in C++.

The video stream of 2 cameras works with the following minor issues: - I need to figure out how to display them separately instead of alternating on the same window. This is not a problem for my application since I just need to process them together, not display them simultaneously. - About a 1 second delay.

1) It seems clear that FFMPEG library does not work for H264 video streams over RTSP. So I downloaded and installed libVLC along with the VLC Player.

a) libVLC installation: Download the 7zip file (no installer version) so as to get all the library header files, DLL's and source codes. Then link them, almost exactly like you installed and linked OpenCV (I used local method: system paths and environmental variables, after which I had to reboot). - I needed the libvlc.dll, libvlccore.dll, the headers and the .lib files, so you will have to find these and link them.

b) VLC Player: Download and install.
The player is for testing, since sometimes what you have in the code may be wrong. I recommend testing your URL directly in the player when you find errors you cannot explain. This allows you to test the RTSP or HTTP command you should use exactly in your code (go to Media -> Open Network Stream -> Network -> "Please enter a network URL:" -> and then enter "rtsp://username:[email protected]:554" for example).

2) Sample libVLC + OpenCV code to use to test: I used this which is similar to the VLC = VideoLan example.

  • It appears that the "unlock" callback function is one of the places to process the MAT image directly (in libvlc_video_set_callbacks(mediaPlayer, lock, unlock, display, context), for example here)

3) Some troubleshooting I had to do:

a) Undeclared identifiers: This implies missing headers. I needed to include the following for libVLC in addition to OpenCV headers: vlc/libvlc.h vlc/libvlc_media.h vlc/libvlc_media_player.h

b) x86 vs. x64: I kept getting this error since libVLC works for 32 bit and not for 64 bit. You can still use libVLC on a 64 bit machine (which is what I have), but need to change the configuration to 32 bit. I kept getting errors despite changing this in configuration manager, and resolved it by simply creating a new solution from scratch and then copying my code. (See link).

c) Stopped videos: occasionally some errors would show up on the back end, and the first 5 seconds or so were somewhat corrupted for brief periods. After a while, my videos just ... (more)

2015-07-10 17:30:34 -0600 commented question how to stream h264 video with rtsp in opencv- partially answered

Thanks LBerger! That is a great option, thanks for letting me know! Mine is how to get all the pieces and integration done, not necessarily a source code to solve it all. The source code that I do use is online, so I reference that, but mostly it's about all the troubleshooting I had to go through to get libVLC installed, integrated, and talking with OpenCV on MS Visual Studio for a Windows machine. Nothing great, but thought it would be helpful for others since it took me many weeks and tons of frustrated days to get to this point. lol I do also like the idea of writing a tutorial maybe in the future for stuff that's more heavy-duty, so thanks for the quick help and advice #LBerger! :)

2015-07-10 14:16:13 -0600 commented question how to stream h264 video with rtsp in opencv- partially answered

Hi #LBerger, what is a pull request and how do you do one?

2015-07-09 14:58:59 -0600 commented question how to stream h264 video with rtsp in opencv- partially answered

I will shortly post some solutions I've come up with, that will hopefully help others in similar struggles. I just have to wait 2 days according to the site rules.

2015-07-09 14:55:55 -0600 received badge  Supporter (source)
2015-07-09 14:43:52 -0600 asked a question how to stream h264 video with rtsp in opencv- partially answered

I've been struggling with this for a few months now and thought I should consolidate my efforts and "research" into this question all in one place. Mainly I am doing this to help those that have this issue or will face it in the future, so they don't have to waste valuable time.

It appears that others have struggled as well, since OpenCV uses ffmpeg library for rtsp and such, but has decoding errors for at least h264 video streaming (See link1, link2, link3 for some examples of broken images).

I have multiple IP cameras that I connected to a switch, and then need to process the video feeds through the rtsp commands that was given by the camera manufacturer: "rtsp://username:[email protected]:554" (Here, 554 is the RTSP port number assigned to the camera, which may require you to go an adjust the number by logging into the camera and accessing the camera settings)

I wanted to use my OpenCV code but could not just use: VideoCapture cap1("rtsp://username:[email protected]:554"); or, cap1.open("rtsp://username:[email protected]:554"); because of the broken video feeds from FFMPEG as explained above.

Trying to do the TCP protocol instead of UDP may have fixed the issue for others, but this is already incorporated in the latest versions of OpenCV (it was for 2.4.11. and a new update should fix it for 3.0.0; see this bug report) and did not work for me.