I'm developing the software which saves the movie captured by using webcam as video file (output.avi etc) to local of Intel Edison(/home/root/temp etc).
I'm using ISS IoT Edition C++ as IDE, and OpenCV2.4.9 as Image Processing Library.
When I tried to create video file(/home/root/temp/output.avi) using cv::VideoWriter() method which is prepared by OpenCV2.4.9, I found that video file was not created.
I don't know the cause of this problem...Are there any other packages to install such as codec?
If someone knows how to deal with this problem , could you please tell me that?
For your information in detail, I show you the code I created below.
Best regards, thanks.
const int videolength = 3;
const int width = 640;
const int height = 480;
const double framerate = 20.0;
const int imgnums = int(videolength*framerate);
std::cerr << "Error: Camera not found" << std::endl;<p> return -1;
std::cout << "Camera found" << std::endl;
int i = 0;
std::cerr << "Error: Blank frame grabbed" << std::endl;<p> break;
sprintf(buf, "/home/root/output_%02d.jpg", i);
if (i == imgnums)
i = 0;
if(cv::waitKey(30) >= 0)
std::cout << "Key input was occurred" << std::endl;<p> break;
int codec = CV_FOURCC('M', 'J', 'P', 'G');
std::string filename = "/home/root/output.avi";
out.open(filename, codec, framerate, cv::Size(width, height));
catch (cv::Exception& e)
const char* err_msg = e.what();
std::cerr << err_msg << std::endl;<p> return -1;
std::cerr << "Could not open the output video file" << std::endl; ⇒⇒⇒ that is why out.isOpened() == false.<p> return -1;
for (i = 0; i < imgnums; i++)
Thank you for contacting us.
I'm don't have too much experience using OpenCV, but I will try my best to help you with this.
I want to run your code under the same conditions than you, so are you following any specific guide to install OpenCV 2.4.9? Could you please provide it? Please include any additional step that you have taken to do this.
I'll be waiting for your reply.
Have a nice day.
Hi Leonardo R san
Thank you for your kindness.
I showed the specific guide to install OpenCV2.4.9 bellow.
Setting Intel System Studio(ISS) for IoT edition C++
1. Add OpenCV2.4.9 to Docker container which is used by ISS.
1-1. From Properties for my project(Sample etc), select Intel Package Manager.
1-2. When pushing Add new Packages... button, package Manager Utility dialog launches,
1-3. Type "opencv" word in edit box of package Manager Utility dialog.
1-4. Select all lists(libopencv-calib3d-dev, libopencv-calib3d2.4, .........too many) shown by following 1.3 step.
1-5. Push Add selected package(s) button.
Setting Intel edison
2. Synchronize Intel edison and Docker container.
2-1. When right-clicking target name shown in Connection tab, there is Synchronize packages.
2-2. When selecting Synchronize packages, Libraries related to OpenCV2.4.9 are installed to local directory in edison(/user/lib)
I was trying to test your code and I was not able to build the project, it seems that some packages were not installed.
Nevertheless, I was investigating more about this and it noticed that you can use different codec on the function VideoWriter(), so I recommend you to give it a try to different codec because when I checked your code it looked fine to me. Take a look at the documentation: http://docs.opencv.org/2.4.9/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight... VideoWriter::VideoWriter()
Have a nice day.