QMultimedia - Which Video/Audio encodings and containers are supported? - c++

I'm trying to make a multimedia database system using Qt. I'm using QMultimedia to play back videos in a QVideoWidget.
The following is the code I am using to play a video file in a QVideo Widget:
mMediaPlayer = new QMediaPlayer();
mMediaPlaylist = new QMediaPlaylist();
QMediaContent content(QMediaResource())
mMediaPlaylist->addMedia(QUrl::fromLocalFile(QDir(QString("data")).absoluteFilePath(QString("%1.dat").arg(mMedia.GetUID()))));
mMediaPlayer->setPlaylist(mMediaPlaylist);
mVideoWidget = new QVideoWidget();
mMediaPlayer->setVideoOutput(mVideoWidget);
this->setCentralWidget(mVideoWidget);
mVideoWidget->show();
mMediaPlayer->play();
Basically, it plays a file called 1.dat for example, which is just a renamed video file (video.mp4 for example). However, playing the video never works, and the following error is produced:
DirectShowPlayerService::doRender: Unresolved error code 80040266
With some google searching, I found that this error is because QMultimedia doesn't have the required codecs/filters to play the format of the video. I've tried converting my videos to many different formats using ffmpeg, while trying formats specified at Supported Formats in DirectShow and Supported Media Formats in Media Foundation. I've also tried installing Directshow Filters for Ogg Vorbis, Speex, Theora, FLAC, and WebM, and converting my video to theora/vorbis in an ogg container. Still no go.
I should note that I did manage to play one mpg file, so I do know QMultimedia is working. But I tried converting another video to mimic the properties of that mpg file, and it didn't seem to work, so it seems QMultimedia is extremely specific in what formats it supports.
What system is QMultimedia using for its backend decoding? How can I find out what types of encodings and containers it supports? Is it possible to write my own decoder in Qt?
Thanks

this document describe features supported by QMultimedia backends. Render to widget is not supported now.
I recommend to use another library for encoding/decoding multimedia(f.e. ffmpeg) - QMultimedia now is not stable and I think that correct work only examples from documentation :(

Related

C++ Alternative to SFML Audio with MP3/M4A/Metadata/GetSamples support

I'm currently using SFML Audio for my visualizer and it works great but some of the limitations are causing problems. Currently my music library consists of MP3 and M4A files and I'm not keen on having to convert them every time I make additions to the library. I'm also looking for a way to read metadata from MP3 and M4A files so that I can list the title, album, and artist. I would you iTunes' exported playlist to get that info yet it only lists the title of the song. Since this is a visualizer I also need to be able to get at least 8192 samples per channel at the current audio position in order to produce the visualization. And lastly I'm hoping to be able to stream media instead of loading it all at once so that there's not a short pause when switching songs. What are some alternatives that support these features?
Must work with Windows.
C++ Library for loading/playing audio (I can make due with C if need be)
Supports MP3/M4A
Supports Reading metadata (Optionally on alternative library)
Supports getting sample data at the current position in the song (at least 8192 samples in advance)
Supports streaming media instead of loading it all at once to prevent lag on switching songs.

Convert Movie to OpenNI *.oni video

The Kinect OpenNI library uses a custom video file format to store videos that contain rgb+d information. These videos have the extension *.oni. I am unable to find any information or documentation whatsoever on the ONI video format.
I'm looking for a way to convert a conventional rgb video to a *.oni video. The depth channel can be left blank (ie zeroed out). For example purposes, I have a MPEG-4 encoded .mov file with audio and video channels.
There are no restrictions on how this conversion must be made, I just need to convert it somehow! Ie, imagemagick, ffmpeg, mencoder are all ok, as is custom conversion code in C/C++ etc.
So far, all I can find is one C++ conversion utility in the OpenNI sources. From the looks of it, I this converts from one *.oni file to another though. I've also managed to find a C++ script by a phd student that converts images from a academic database into a *.oni file. Unfortunately the code is in spanish, not one of my native languages.
Any help or pointers much appreciated!
EDIT: As my usecase is a little odd, some explanation may be in order. The OpenNI Drivers (in my case I'm using the excellent Kinect for Matlab library) allow you to specify a *.oni file when creating the Kinect context. This allows you to emulate having a real Kinect attached that is receiving video data - useful when you're testing / developing code (you don't need to have the Kinect attached to do this). In my particular case, we will be using a Kinect in the production environment (process control in a factory environment), but during development all I have is a video file :) Hence wanting to convert to a *.oni file. We aren't using the Depth channel at the moment, hence not caring about it.
I don't have a complete answer for you, but take a look at the NiRecordRaw and NiRecordSynthetic examples in OpenNI/Samples. They demonstrate how to create an ONI with arbitrary or modified data. See how MockDepthGenerator is used in NiRecordSynthetic -- in your case you will need MockImageGenerator.
For more details you may want to ask in the openni-dev google group.
Did you look into this command and its associated documentation
NiConvertXToONI --
NiConvertXToONI opens any recording, takes every node within it, and records it to a new ONI recording. It receives both the input file and the output file from the command line.

What MPEG4 encoder library to use?

So I have a WIN32 app that records videos using DirectShow. Now I want to convert the .AVI files to .MP4.
I rather not use a custom filter in the source, since I don't want to have to register filters(admin needed). I also dont want to use a standalone application since it should be automatised. Preferbly I just want a library with a well documented API since im rather new to this. Then I can use it from my app to convert the .AVI files when they are done being recorded. Anyone can point me in a direction? Or have comments on my method of choice?
I'd be outmost grateful for any help and thanks in advance!
Because MPEG-4 codecs are not royalty free, finding suitable encoder might be not as easy as you could think of it. Microsoft does not provide Windows with the encoder, except H.264 (MPEG-4 Part 10) encoder in some editions of Windows 7, and only within Media Foundation (as opposed to DirectShow). If you are OK to be limited to those Windows 7 versions, Media Foundation might be a good option, MSDN offers samples to transcode file into file and it is reasonably easy and well documented.
There are third party solutions, there half made libraries you can leverage to encoder, there is FFmpeg which offers MPEG-4 Part 2 video encoder under LGPL, and MPEG-4 Part 10 through libx264 under GPL. And my understanding you might still be expected to pay royalties to MPEG-LA. FFmpeg might still be a good option to convert file to file because its command lnie interface is well documented (as opposed to libavformat/libavcodec API which are not so well documented on the contrary).
Another option is to use Windows Media codecs and compress into ASF/WMV files.
Libavcodec and libffmpeg -- an everything-to-everything media converter (includes library and command-line application): http://ffmpeg.org/

combining separate audio and video files into one file C++

I am working on a C++ project with openCV. It is a simple web cam application with basic features like capturing pictures and videos. I have already been able to save video (w/o audio). Since openCV doesnot support audio processing, I was wondering if there is any way I can record audio separately in a different file and later combine those together to get one video file.
While searching on the internet, I did hear something about using ffmpeg with openCV. But I just cant figure out how to do it exactly.....
Can you guys help me? I would be very grateful... Thankyou!
P.S. I have used openCV and QT (for GUI)
As you said, opencv doesn't by itself deal with audio. However once you get a separate audio and video file, you can combine them using a technique called muxing. There are many many ways to do this. I use VirtualDub for most of my muxing needs, although it is windows only (not sure if that's a problem). I know ffmpeg is also capable of muxing (via the command line interface), I can't recall what the command is. There's also mplayer and a multitude of other programs out there to do this.
as far as i know openCV is good for video/image processing. To support audio processing, you can use other libraries e.g. PortAudio or C-sound.

c++ convert/play videos and images

I'm looking for build in library for converting videos/images. i heard something about DirectShow. Do you know any library you have used to convert videos/images?
For transcoding (converting one video format to another) using Directshow is bit tricky, you want to use Media Foundation for this job.
There is Transcode API available in Media Foundation to achieve this task. This link has more details on Transcode API, tutorials and samples to get you started.
You can use DirectShow for grabbing images from video stream. For it you must create your own filter node. It is complex task because of filter is COM object that will work within chain (DirectShow filter graph) of other filter nodes - codecs. So after creating you need register your filter in system. As for me i think you can try it because you can use all registered codecs in system and as result get decompressed/final image into your filter. As other solution i think that you can try to use modules from some open source media player. For example try VideoLAN but as i know it is big thing and not easy to use.
Good luck!