how to play rtsp streamming in QT - c++

I am trying to find a way to play in Qt 4.6 rtsp streaming, that i got from youtube api
can it be done somehow?

Live555 has some very useful libraries on this subject.

Checkout Phonon, multimedia framework for QT.

The most seamless way is to use Phonon.
If you are using Windows, Phonon uses DirectShow as the backend. To utilize this you need a RTSP DirectShow source filter, which you register in Windows. There are commercially available ones and a few open source projects that may have what you need.
For example,
http://sourceforge.net/projects/rtspdirectshow
A good rule of thumb is if you can play it in Windows Media Player (mplayer2.exe, wmplayer.exe), you can play it using Phonon. Currently you would not be able to play a URL containing "rtsp://" in WMP or Phonon is because no DirectShow source filters are installed which support RTSP.

Related

Backends to use for multimedia in Qt5

What are available and reliable multimedia backends to use with Qt5 for media playback on Linux?
I don't know about backends rather than gstreamer for linux, but you can try to integrate QmlVlc project into your code. You can find a demo here. It uses vlc for playing video. I successfully used this project for my purposes under Android. You can also try QtAV, it uses ffmpeg. From my experience it worked on Android as well, but there were issues with hanging UI. It might have needed more work to properly integrate though, but I didn't want to spend time on it, at least it was easy to try.
I know you were not asking for Android libs, but by using on Android I mean native (C++) code, so no Java was used.
you can use Gstreamer Qt bindings

Unable to play certain videos with QMediaPlayer

I have a Qt 5.3 application that plays videos which works fine for some videos. Unfortunately when given some .mov files, I either get a QMediaPlayer::FormatError or I can hear audio but no video.
I am assuming this is due to missing codecs, is there a way to add support so that I can play the videos?
EDIT: This is on OS X
QMediaPlayer can play any format that the platform's media service supports. You should install the right codecs for a video type to be played successfully. Try to install GStreamer codecs on Linux. If you are on Windows install KLite Codecs.
QtMultimedia's implemention is platform dependent (uses direct show on windows, gstream on linux etc). May be it is good to consider using libraries like QtAV or libVLC.
They work for most platforms and no additional codecs and plugins are required to install.

Using codecs in program

As I've mentioned in my another question, I'm having trouble with Qt 5.1's multimedia module. The QMediaPlayer class can't play some MP3 files. I haven't tested other formats thoroughly.
I'm not sure if this is a codec related problem. But I'm interested in using codec directly in my program rather than relying on the backend support for playing media files. I'll be developing the application in Qt 5.1 for desktop Windows platform.
I have no idea about using codecs in programs. Any pointer will be greatly appreciated.
You can go to [FFMPEG]: http://www.ffmpeg.org/ to integrate the open-source codec to play your media file.

How can I display an IPLImage stream on Qt interface using OpenGL for rendering?

What is the best way to integrate and display an IplImage into a Qt GUI? Can this be done using OpenGL? If yes, how?
Well, I am answering my own question here.
I have been working with OpenCV since a year now and many times I have had to write code that opens a video file and streams it.
Lately, I have been using Qt to provide the high level gui and I came up with a solution to display IplImages on a Qt GUI using OpenGL(which I spent a lot of time struggling with but succeeded finally). Although, OpenCV can be built with Qt highgui support, I was keen in learning a bit of OpenGL and using it in my application.
I thought it would be helpful for people who need a basic framework for running videos for their applications.
This basic framework can be used in a wide range of applications like video content analysis, face recognition, pattern recognition and more. In the broader sense, this is basically a video player without audio support. So if you want you can add audio support and make this a video player. It will play almost all formats as opencv uses ffmpeg to play videos. I have created a C++ library for the same which I use quite extensively:
The main classes are:
QVideo : The main widget, providing functionality to open a video/rtsp stream and play it
QIplImage: The core display widget. It's a QGLWidget which renders an IplImage
BackgroundWorker: This is a thread which runs in the background to retrieve images
from the stream. It is mandatory to run the frame grabber in a background thread,
otherwise it interferes with the GUI thread. All the image processing can be done in
this thread
The source code is provided so you can modify it to your needs.
Once the library is installed, you can use it in your qt application like so:
//Create an object
QVideo* video=new QVideo("Name",);
//set geometry (optional)
setCentralWidget(video);
To build the library, you will need qt and opencv(with ffmpeg support) installed.
The library gets installed in /usr/lib or /usr/lib64 based on the architecture.
The include files get installed in /usr/local/include
Of course, all this can be changed in the project file if needed.
To install, just unzip the package, and run qmake, make and sudo make install.
Note: The project is configured for unix and would need to be changed for windows builds. Drop me a message for more information.

Cross Platform (C/C++) Audio Library for MP3, AAC, WAV

I'm trying to find a cross platform audio library that will have the following abilities (in order of importance):
Full Windows, Mac, Linux support
C / C++ APIs
Free/cheap but commercially viable
MP3 Support
AAC Support
WMA Support
FLAC Support
OGG Support
ARM Linux support would be nice
Open Source
I've found several things like OpenAL, libao, Bass, etc. but they all seem to all either have a limitation of OS, codec or both. For the most part MP3 and AAC support are a must as I'm working on a media player and would like it to support those common formats.
Any suggestions?
You can take a look at GStreamer and FFmpeg.
EDIT:
Since you are willing to use Qt, you should definitely check Qt MultimediaKit, which is a part of the Qt Mobility project. Phonon is fading away because Qt is investing on MultimediaKit to replace it.
This example shows how to do simple audio playback. This example shows how to create a multimedia player. This example shows a more advanced music player, using Qt and QML.
I don't know if you are planning on using a framework like Qt.
This has a library called "Phonon" bundled, which is also really nice.
It is built on the corresponding native media framework, so QuickTime on Mac, Windows Media Player on Windows and GTK+ on Linux.
PulseAudio also looks promising without any framework.
Try out JUCE. It is like Qt in some respects, but much more audio-centric.I've been using it for some years now and it is well maintained and written.