Cannot open some video files in OpenCV 2.4.13 for Java
Hi,
I have a problem regarding opening video files. I recently created an .avi-file from a bunch of images that I had taken from a camera. When I tried to open this using the following line of code,
VideoCapture vidCap = new VideoCapture("C:/somePathOnC/fileName.avi");
everything worked fine. However, when I try another video file, for instance the example video from this example. The video file in that example is called bouncingBall.avi. This, however, won't work. The program does not open up the video file, and no errors are shown.
The same happens with another video file I took from my IP-camera. The program I used to record the file, iSpy, saved the file as .mp4. Since this didn't work, I tried to convert it to .avi with different "codecs". I have so far tried all of the settings that the converter program offers. These are:
- H.264 /MPEG-4 AVC video format
- AVI-audio-video interleaved
- XViD-movie
- Lossless uncompressed AVI
- AVI with DV-coded
Also, please not that I've tried to have both of the files in the same folder, but it still didn't work.
So now, I'm out of ideas on how to solve this. I have done some search about an issue regarding FFMPEG, but I do not understand how to resolve that.
Thank you.
I don't know java but check video path and try to print video properties :
and compare those values with C:/somePathOnC/fileName.avi
in C++ to write CODECS name I use :
I guess you mean that I should check those values for one video file that does work, and compare it with another one that doesn't? Have I understood that correctly?
yes it's not an answer but may be a way to understand your problem...
Okay, so I did what I thought that you meant and ended up with this:
vidCap.get(CV_CAP_PROP_FPS) = 4 vidCap.get(CV_CAP_PROP_FOURCC) = 5.41215044E8 vidCap.get(CV_CAP_PROP_FRAME_WIDTH) = 640 vidCap.get(CV_CAP_PROP_FRAME_HEIGHT) = 480
For the other video that doesn't work, I get 0.0 on all of the values.
Check vidCap : if (vidCap.isOpened()) { .... } else { cout<< "cannot openned"; }
Can use an int instead of double int x=vidCap.get(CV_CAP_PROP_FOURCC);
I already have that piece of code in place, and for the video file that doesn't work, I always enter the else-block in your example.I have also edited the original post, just to notify that I've tried to have both of the files in the same folder, but without luck.
What is fourcc code value in an int variable? read this post too
FourCC = 541215044 if I cast it to an integer. What is that value anyway?
in hexa it 541215044 = 0x20424944 = ' BID' codecs is DIB.
video C:/somePathOnC/fileName.avi use a DIB codec.