I've been playing around the QMediaplayer library. I was curious about how it would work with some streaming video source, so I've used VLC to stream some videos using udp protocol.
To make a quick test, I've used the Qt example named MediaPlayer example. As the example is designed to work only with offline files, I've added on dumb function on the Player implementation.
void setM(QUrl url){player->setMedia(url);player->play();}
Then, on the main.cpp file I call this function like this:
...
player.setM(QUrl("udp://239.1.1.1:1234"));
return app.exec();
What this do is start to reproducing the stream source once the program is read.
The problem here is that Qt through me the following error:
DirectShowPlayerService::doSetUrlSource: Unresolved error code 800c000d
To do this with local files and http streaming and it works... but when I tried with UDP or RTP I always get the same error.
I've spent few hours looking for more information, but always get the same response... use QMLVLC... For example, look this.
Does anyone tried this before? What's is wrong here?
PD: I know that there is a VLC plugging to make this work, but I would like make this work only with Qt (or at least, understand what is happening here).
PD2: I'm on windows 8.1, Qt 5.5 (mingw 4.9.2) and I have all the important codecs installed.
Thanks in advance,
UPDATE
Finally, I manage to deal with the new http://code.qt.io and here is the code I suspect is blocking udp (and others) protocols-> here.
Maybe, only "http" and "https" are accepted as valid stream sources on Directshowsservice... I'll try to get some extra time this week to recompile just the multimedia module for windows in order to add udp procotol to the function doSetUrlSource and see what happens. If anyone test it first, please let me know here!
UPDATE 2
First of all, I suspect QMediaPlayer couldn't reproduce UDP/RTP content because the AddFilter method... Anyway, http,https and rtsp works perfectly.
Secondly, I've found some strange behavior over udp protocol.
I'm using "udp://#239.1.1.1:1234" as test multicast direction. The strange thing is that during one test I put this direction by mistake "udp://#239.1.1.1:1234z" and this time no error has been through. It seems that the direction needs to contain a letter.
Related
I'm making a call software using Qt and Qml, and I need to get the microphone feed from Qml running as webgl to the C++ side, if not straight to GStreamer using server.
I already have a Qt program as the client using GStreamer to push audio stream to the server. GStreamer, of course, doesn't go to the webgl client side though. I've found, that you can get permissions to use mic/camera from Qml, but I haven't found any example actually grabbing the stream from there. I've also checked out the usage of WebRTC. It seems like it could work with Qml and I have found some examples using it with GStreamer, but I haven't been able to get the combination of WebRTC and GStreamer working even with the examples.
So the full question:
How can I get the audio from the Qml running as webgl? Is there a way within Qt or do I have to go through WebRTC? If so, is there some simpler or more beginner friendly example than the Nirbheek's gstwebrtc demos for connecting WebRTC to GStreamer?
Not the answer I wanted, but this ended up working in my case:
As the C++ side is also running another Qt GUI, Qml to be specific, I
can use WebEngineView with html and javascript to never bother the C++
implementation with GStreamer for WebRTC. So currently I'm running
PeerJS on both sides of the connection with PeerJS' signaling
server in between.
I'd have preferred to use C++ with GStreamer to connect to WebRTC, but
I can't find other easy way for me to connect browser's audio to Qt.
edit: I apologise, this answer doesn't work in the end. I have been testing the programs on a single computer, thus I didn't realize WebGL hosted Qml doesn't run WebEngineView's Javascript on the frontend, but backend instead.
OpenCV has the VideoCapture class to load video from external sources. I have a network camera on my network that I'm accessing with RTSP (using the FFMPEG plugin).
The sad thing is that it seems the open method and the constructor block on opening the video stream. This means if the stream is down, the program is stuck there forever.
Is there any sort of timeout ability? I tried looking in the source code, but in the end it calls external FFMPEG functions I believe and I'm unable to go further.
If there isn't timeout, is there any sort of library for a nonblocking VideoCapture method for RTSP or HTTP?
Although this question is quite old, I will supply more summarizing info for other people as well.
There is the possibility to build the dll for ffmpeg for opencv with a wrapper library Github issue refers to Peter's repo with a wrapper file (on line 198 is a timeout which can be set). (Sorry, I can't post more links).
As long as you are comfortable with Make'ing this, then you should be set (this wrapper is quite easy, it's stated). If you are looking for the actual issue on github, read the issue linked above. There you can find more information on the actual problem fixed.
To rebuild OpenCV (python cv2) with CMake: Example Visual Studio.
I have a pet project with webrtc audio-video calls. Currently calls from browser are working exactly as expected.
And I'm trying C++/Qt client based on Native C++ WebRTC (it is just a modified peer_connection_client example with modified signalling).
It works, but I've found an issue: when I make a call from one PC to another, the quality of the video is extremely reducing until bandwidth became around 250-300kbps (or 500kbps total, not sure).
As I told, there is a web version working on same signalling and I tested it out on the same PCs. The result was really surprised for me: no quality reducing and around 2000kbps network load.
Moreover, if I connect PC with cable to my router, the quality is fine and 2000kbps load, as expected.
I suppose that the problem is somewhere around wifi bandwidth estimator or so, but can't realize how can I control it's behavior.
Have someone any ideas how can I improve the quality and make webrtc use 2000kbps not 500kbps?
Thanks in advance,
Br,
Sergey
While going forward, I've found out that I have to call rtc::Thread::ProcessMessages() eventually to prevent being stuck on signalling_threads events.
But after that a new problem occured. It is "UDP send of XXX bytes failed with error 10035" this is described at https://groups.google.com/forum/#!topic/discuss-webrtc/wmYo7AU3evI.
I'm trying to come up with an easy solution to my "buggy" Ethernet camera. The thing is after establishing a TCP connection to reach faster FPS the camera ignores if someone is reading the socket buffer and blocks if the program unexpectedly stops without "sending end of connection" message. I come up with an stupid/easy solution. Disable and re-enable the Ethernet connection works. It works if the camera is directly connected to the computer. But now I have to program it.
I've found someone with similar problems but I want something more Qt like.
Programmatically disable/enable network interface
Does QT 5.4.0 have some API or Library to do it? Does C++ have something similar?
As the firs link says Microsoft suggested Win32_NetworkAdapter class but I have never used it. Will it work in QT with msvc 2010 used in a W7 64bit SO?
https://msdn.microsoft.com/en-us/library/aa394216%28VS.85%29.aspx
Thanks!
I am using Windows 7 and developing a chat-like application with Visual Studio 2010. I am looking for an EASY way of capturing audio from a microphone (or rather, from the default recording device), collect the buffer from said input, and send it over a socket. I've seen DirectX solutions recommended, but from my research that is quite the opposite of simple. 5000 lines of sample code for a simple capture/save file program? That simply doesn't work for me (and yes, that was an official sample provided with the SDK).
Anyway, I don't need it to be cross-platform, and I would really prefer something that already comes with Windows, though I don't mind installing a library as long as it doesn't take longer than writing the hardware drivers from scratch to figure it out (exaggeration). I've heard of this waveInOpen function, but oddly enough I cannot find any demos on how to use it. If anyone has an idea or a link to some sample code, I would greatly appreciate it. Thanks everyone for your time!
P.S. I can figure out the networking part myself. I just need access to the raw audio data buffer.
If you're doing the sockets yourself try checking out:
http://www.techmind.org/wave/
http://www.bcbjournal.com/articles/vol2/9810/Low-level_wave_audio__part_3.htm
http://www.relisoft.com/freeware/recorder.html
I enjoyed all of them but the last one, but then again, you might find it far more helpful.