Mic/Speakers Audio Feedback in VLC API - c++

I'm building a Webcam recording application with Qt 5.3 using vlc-qt, the problem is while previewing Audio/Video high feedback/noise and echo starts and gets higher, I've been googling and found it's the effect called Larsen's effect and how it's happening.
Notes:
I know using a headphone is a solution
I'm on a Windows 7 Ultimate Notebook
The Microphone Boost on zero dB is less noise but echo is persistent
My Questions:
How other webcam recording applications suppress the noise and the echo?
Specifically, how it can be fixed in VLC, your answer can be commandline arguments, notes or instructions to do in VLC software, it doesn't have to be code
Thanks!

I found http://www.dspcottage.com/en/algorithms/AEC a C++/MFC echo cancellation application based on Speex, but I needed to use it in Qt so I scrapped all MFC related code and here is the final solution https://github.com/Marware/Cpp_AEC

Related

Realtime video buffer access webcam, Windows Phone 8.1 C++

I need to do some basic video processing from the Webcam in Windows Phone 8.1.
I cannot find any examples of how to access the webcam preview buffer. The Microsoft examples (very few) all have a video preview frame activate, I can find none that show how to subscribe to a 'new frame ready' event, or where the buffer is.
The MediaCapture, and CaptureDevice appear to be the main ways of reaching the camera in this api.
Can anyone point to a specific example? For instance, a QR code reader, or maybe a program that adds video effects, like greyscale, would need to attach an event to every frame.
Thanks.
It sounds like you need to access the buffer from the preview stream of the phone cameras. If you absolutely need to target 8 and 8.1, then you should look into GetPreviewBufferArgb(out int[] pixels). See here: https://msdn.microsoft.com/en-us/library/windows.phone.media.capture.cameracaptureframe.getpreviewbufferargb.aspx
But if you can instead target Windows 10, you get the benefit of fully universal APIs, and you don't take a dependency on the likely soon to be deprecated (if not already) Windows.Phone.Media.Capture namespace. I would strongly recommend doing this instead, as the APIs will be easier to work with, and any 8.1 device can upgrade to 10 for free.
Here is a fully working Windows 10 sample: http://aka.ms/2015buildgetpreviewframesample, which was shown off at the last Build conference (video here: http://channel9.msdn.com/Events/Build/2015/2-730).

Qt5 QMediaPlayer use codecs that are delivered with the program

I need to write a (portable) program that, amongst other things, is able to play a video file. The QMediaPlayer in Qt5 seems to be the obvious choice, but apparently it only uses codecs that are installed on the executing machine.
All I need for the video player is being able to play at least one video format on all (windows) machines without installing anything, and communicate the current status to the main program (currrent time in ms, playing/paused).
Specific question: Can someone give me some hints where I have to look? How can I implement a video codec into my program so that QMediaPlayer can reliably play videos on all machines? Alternatively (but less prefered): How to (easily) implement another video player into the program that is capable of doing the task?
I've already tried my luck with libVLC and one or two other options but it never worked so far and it seems to make my program way more complex than it has to be.
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. So you have to install GStreamer codecs on Linux or if you are on Windows you should install something KLite Codecs.
May be it is good to consider using libraries like QtAV. It will work for most platforms and no additional codecs and plugins are required to install.
QtAV uses FFmpeg and has some interesting features like multiple renderers for 1 player, region of interest(video crop), custom filters, ... It also works fine for both Qt4 and Qt5.
QMediaPlayer uses the underlaying video framework of whatever machine you use, that means there's no way to portable write a player using such class. Your only solution, in my opinion, is switching to FFMpeg playback library, that uses native codecs instead.

Problems capturing with Media Foundation & Windows 8 in C++

This is going to be my first question in StackOverflow after several days looking for an explanation. Please, be gentle with me for asking because I know my problem is a bit bizarre to be a general problem.
I made a MF capture video application, based in the Microsoft example 'CaptureToFile'. It did work on Windows 7 x64. I upgraded to Visual Studio 2013 without problems. Problems arose when I try to put all the development on a Windows 8.1 x64 machine.
The app compiles and executes without error, but it's UNABLE to capture samples by using m_pReader->ReadSample() in asynchronous mode; only the first two samples arrive to OnReadSample method; and there must be 'control' samples, because the IMFSample is null in all of them. After that, the app gets 'hanged' waiting for data.
I've tried the original MFCaptureToFile sample with the same sad results.
Of course, I think hardware and software are similar (the same capture card with the same driver version, both are desktop PC...)
Do you know any possible reason for this behaviour? in Win7 everything is working flawless! Or at least, if you could light me a bit about new paths for finding what's happening
Thanks in advance
UPDATE: There is another 'player' in the game. Looking into the threads, I see that a worker thread is in 'RTWorkQ.dll', the real-time work queue container, specific only for Windows 8. I will go on investigating. In the meantime, if you have any idea, something to share, I'll be glad to hear you.
UPDATE 2: I've modified the sample MFCaptureToFile to get the video samples synchronously, because I thought the problem could be due to the asynchronous behaviour; related with the queues. I've to say that the problem persist even with this change. The second time it tries to read a sample, the application gets 'hanged' waiting for a reading that doesn't never arrives.
UPDATE 3: I've tried with the CaptureEngine sample application that uses another MF way to capture video (MFCaptureEngine). It builds and runs flawlessly but doesn't show any images when starting the 'preview' and doesn't record any useful, only non-playable files.
UPDATE 4: I've installed Visual Studio 2010 Ultimate in Windows 8 PRO. The sample MFCaptureToFile fails again in the sample. It's unable to read a 2nd sample from the frame grabber. I'm starting to think that can be an incompatibility between the capture card (Datapath VisionRGB-E1S) and Windows 8 PRO despite the driver assures it works fine in this platform and the test program shows images. Tomorrow I'm going to try the test with an external USB webcam.
Finally, I have figured out the reason of this problem.
With Windows 8.1 release Microsoft has introduced New AVStream Interfaces for Windows 8.1
There is a small but very important change in KS_FRAME_INFO structure - the new FrameCompletionNumber member.
An identifying sequence number for the frame in the completed queue.
This number is used to verify proper frame order. When this value is
0, the frame was cancelled. This member is available starting with
Windows 8.1.
DirectShow doesn't care about this number. And MediaFoundation cares.
So, you cannot just fix that on your user-mode side. The manufacture developers must release an update. Btw, I have two webcams - Logitech C270 and Creative Live Socialize HD. Logitech supports Metro while Creative does not.
I have successfully updated my driver with only a few lines of code (to set up FrameCompletionNumber properly).
UPD. similar thread http://www.osronline.com/showthread.cfm?link=255004
It must be a problem of the frame grabber Datapath VisionRGB-E1S. I've tried with the brand-new USB webcam LifeCam Studio, and everything worked fine.
I will left for other future thread why this unpaired behaviour between Windows 8 and Windows 7, but it could be something related to the User-mode access...
I had the same kind of issue:
IMFSourceReader was obtained successfully
reader->SetCurrentMediaType() reported no error.
reader->ReadSample() was successful.
then OnReadSample() was called only once and the hrStatus argument 0x80070491
For me, the issue was that I modified the video subtype IMFMediaType, then applied to the reader as current media type.

Displaying multiple video streams in one winform in c++

i want to develop a windows application in c++ that could be draw multiple video streams that come from network in one window (like video conference applications).
in another words, i want to have one window and split this window into sections that each section show a video stream.(like what we see in video conference applications like oovoo or webex).
how i can start learning and witch subject important here i Google the net but can not find any article or example about this subject.
please guide me
thanks a lot
I did a similiar project, which shows 4 different videos in window. These videos were coming from network(TCP/IP) connection. I used VLC for encoding the videos. (Videos are in mp4 format.) Also I used QT for GUI design. Since QT has phonon framework after qt release 4.5, I guess you can use QT for both encoding videos and gui design.
You can check it here:
http://qt-project.org/doc/qt-4.8/phonon-overview.html

Audiooutput problem in Qt using qmultimedia low level API

I'm trying to get mpg123 audio decoder to work with QT on windows. How do i play the decoded audio data at the right speed with Qmultimedia module in push mode. Currently i'm using simple timer to get it to play audio but it's not very efficient way to do it, if I do anything else at the same time audio get all distorted. Is there any better way to send the decoded data to audio output? It would be nice if anyone could point me to any nice examples using Qmultimedia module and Qaudiooutput class. I've tried to figure out QT example project "audiooutput" but it seems that it's also using timer to send audio to output in push mode.. Hope that I'm not too confusing.
I also had to figure that out and I would also suggest using the Phonon framework to do this.
It uses Windows Media Player as host on Windows, QuickTime on Mac and some KDE stuff on Linux.
So it's pretty platform independent.
If you need more low-level functionality, you should take a look into an open-source project called portaudio. It's very easy to use and you can manipulate or even fill buffers from code.
I used it to build an oscillator.
Hope that helps!
Best,
guitarflow