OpenCV videos across platform - windows

I am writing a video using OpenCV on Linux machine. I want to read the same video using OpenCV on a Windows machine. I am not able to do this using the standard codecs provided in openCV.
Can anybody suggest how I can read/write videos across the two platforms?

The OpenCV Wiki directly addresses this issue. See http://opencv.willowgarage.com/wiki/VideoCodecs and specifically the heading "Compatibility list."
Unfortunately the only codecs supported on all three platforms (Linux, Windows & OSX) are 'DIB' 'I420' and 'IYUV' which are all uncompressed video codecs and thus make for really huge file sizes.
The wiki also lists some codecs to try that may work on any two platforms but not on all three.
If you decide to use uncompressed video files, you can convert them to something with a smaller filesize once they are on your windows machine using a program like VirtualDub.
Edit: FYI, On Windows I have OpenCV output in Motion-JPEG and then I use VirtualDub in directstream copy mode to resave the file which corrects a bug with the movie's index. These M-JPEG video files then play by default on Mac and Windows.
If I am trying to read video into OpenCV, I often will first convert my video to Cinepak, (using virtual dub, quicktime etc.) and then feed it into OpenCV. I use Cinepak because for some reason Cinepak encoders seem more prevalentthan MJPEG encoders.

I don't think the problem is with OpenCV, I think it is with codecs, as you mentioned. I also don't think OpenCV comes with codecs... double check that you have the proper codecs installed under Windows.
Did you look at the documentation on video codecs?

Related

How can I download the libsvt_hevc library on ffmpeg on a Mac?

I need to perform Scalable Video Encoding on a video using ffmpeg. In order to do so, I need to have the libsvt_hevc library. So any idea how add this library to Ffmpeg on a Mac?
I tried downloading the library but none of the links available online are suitable for Mac.

Proprietary codecs on Linux. What is legal?

So, assuming we got a distribution without proprietary codecs installed.
Let's take Linux Mint for example. I want to store and playback wav and ogg format sounds, either by using my own software, or by using another developer's software. So far so good right?
Imagine now that we have the following scenario. For some reason, I wanna playback a file that is either an mp4 or mp3 or mpeg or any other format, made by proprietary codecs. Instantly, I will need a codec for these formats.
I read somewhere that Fluendo sells solutions for "legal codec usage" for linux distros.
URL of fluendo: http://www.fluendo.com/en/
So here comes the questions:
Using VLC and ffmpeg is enough for me to convert a file to an ogg or ogv so I can playback a song or a video using an open format. You can also playback playback files made by proprietary formats. But are VLC and ffmpeg legal to use, to playback such files made by proprietary codecs? For example, ss VLC codecs okay to be used without paying anyone for mp4 playback? Is it okay to convert a file from mp4 to ogv?
If not, are there any legal and open source and free (as in freedom) codecs around that can solve the issue, or does someone have to pay a product, to be ethically correct, to the developers of the proprietaty codecs?
Note that I do not ask for Windows, since codec licenses are included to the price of the operating system. I ask exclusively for a free linux distribution.
Since #LordNeckbeard pointed me to the FAQ of FFmpeg, that I really can't believe I missed, it became clear to me that there is a problem in using proprietary codecs, thus there are some file formats that could be avoided to keep ourselves safe. Otherwise if someone can afford a license to use them too, that would be perfectly fine.
So mp3, mp4, mpeg and some more patented formats are to be avoided, if not licensed.
ffmpeg can be built so it can exclude support for such formats and if you need to use sound or video to your software ogg and ogv are nice and efficient formats as we all know.
Digging a little deeper Ι found that too.
https://www.fsf.org/resources/playogg_radiostation.pdf

Detect if DivX and MKV codecs are installed or not?

How can we detect, within a program, whether DivX and MKV codecs are already installed or not?
For my apps, I need to check user OS (Windows) for some requirements. Are there any specific registry keys that I can check? Or should I check for file association of these types? What's the best solution?
Include a dummy video in your resources that is similar to the video content you want to play, then try to load it off-screen; if it works, you know that the codecs are correctly installed for the format you care about (i.e. both the container and video/audio codecs are there, and they are working)

Is There a Windows Video Codec Common Dialog?

Does Windows have a common dialog to select video codecs? If there is one, how can I create one in c#? I'm asking because I'm currently developing with a plugin that seems to have included extremely dated codecs, and am not sure if the plugin is simply retrieving a list of codecs from the system. I don't have the source of the plugin, so I can't look at the source code directly.
Attached is a screenshot of the dialog:
Screenshot http://www.freeimagehosting.net/uploads/fb936bd413.png
Thanks!
That looks like the save options dialog from Video for Windows. Specifically, I believe that's the dialog that pops up when you use the AviSaveOptions function from avifil32.dll.
You could probably call that from C# using P/Invoke if you wanted to.
The dialog does get a list of video codecs from the system. However, VfW only supports VfW codecs, not the newer DirectShow codecs. Any of the more modern codecs you might have installed on your system are going to be DirectShow codecs, more likely than not.
If you want a more modern codec, you're going to have to install a VfW version of that codec.
No, there is no directly accessible codecs list available in the form of a CommonDialog in C#.
CFP.

Which video and audio format/codec should I use?

Environment: Windows XP/Vista, VS2008, C#/.NET 2.0, VideoGrabber.
Hi All,
I'm writing an app which captures cameras input and encodes them into a movie file (including sound).
My client suggests I encode the movie using the DivX codec. But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound? It must support compression. Ideally, I should be able to programmatically set basic configuration.
Note: I read this question but it doesn't actually address my needs.
TIA,
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound?
About the best you can hope for is WMV2 (WMV v8). You may be able to encode it using qasf.dll.
The codecs you get for AVI in XP are all woeful efforts from the early days of ‘Multimedia PCs’: things like Cinepak and RLE, which are of zero use for modern full colour/resolution video, and Intel 4:2:0, which is only chroma subsampling, not really actual video compression.
If you need better than that you'll have to start embedding your own codecs, eg. from ffmpeg.
But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
That's best anyway. Silently installing codecs onto a system is rather antisocial as there are often clashes between them and you could end up messing up other DirectShow applications. For example there are (at least) three different common DirectShow codecs that can handle “DivX” (which is really nothing more than MPEG-4 Advanced Simple Profile video plus MP3 audio in an AVI container): DivX, Xvid and ffdshow. Having more than one installed can be a recipe for bugs.
Not sure how useful this is to you, but I was trying to answer that very question just recently. This article suggests DIB, I420, or IYUV are supported on all platforms... at least in OpenCV. I had the least trouble with I420.

Resources