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::VideoWriter()
Have a nice day.