Modify audio output stream of QMediaPlayer - c++

I'm trying to port an audio player from Qt4 to Qt5, and from Phonon to QtMultimedia.
Everything works fine with a QMediaPlayer, except that I can't find any way to modify the audio stream between the output of QMediaPlayer and the system sound.
I would like to apply a post-processing effect to the audio.
Any way to do this? Maybe by sub-classing QMediaPlayer? I've checked the QAudioOutput and QAudioDecoder classes but I would have to implement a lot of things to get the same behaviour as QMediaPlayer.
Thanks!

Related

Qt video playback with libmpv makes QtWebEngine jquery content unsmooth - Ubuntu

I have a project that uses libmpv with the opengl widget (as per the examples that come with libmpv) along with a QtWebEngine widget that displays information, graphics and animations (a scrolling ticker for example).
I found that of the video playback options in Qt, mpv was the smoothest and most reliable. It will play back perfectly smoothly any video up to 1080p.
However while video is playing, any animations in QtWebEngine are unsmooth and jittery. Video is also slightly less smooth when something is moving in the webpage.
The system I'm testing with is not struggling for resources (cpu use is around 45%). There is also not any video decoding, as it's playing back raw video (but while it plays back encoded video, the effect is the same, regardless if hardware acceleration is enabled or not).
I figure that the mpv widget is interrupting the MainWindow thread while it processes frames and causing it to freeze every few milliseconds.
As far as I know there is no way to separate the mpv thread from the MainWindow thread though.
I don't know if it'll be possible to make mpv and webengine work together smoothly. I feel like there must be some way to run two widgets at once in one window and not have them mess with each other.
I'm testing with Ubuntu 18.04, QT 5.11 and the latest mpv from git.
Does anyone have any advice or pointers for what to try first? I realise this is somewhat of a broad question but my knowledge of graphics is limited. If anyone has advice on a conceptual level (I don't need someone to code me a fix) I can investigate myself.
Thank you.

QMediaPlayer - modify audio on the fly

I'm researching options for creating a simple video player. What I'd like to do, is to apply some audio processing (e.g. low pass filter for simplicity) while playing back the video. I've looked at Qt multimedia API, so here's my main question:
How could I edit the audio output of a QMediaPlayer? Do I need some lower level APIs?
Additionally, if some other technologies would suit this purpose better or provide better open source libraries, feel free to suggest. I have experience with C# as well.
QMediaPlayer doesn't allow low-level access to the audio data.
I'd suggest to you to use the QAudioOutput and QAudioDecoder classes for your purpose.
The QAudioDecoder produces QAudioBuffer objects. You can access the data() of these objects, process it (modify it) and feed it to the QIODevice that is returned by the start() method of the QAudioOutput object.
This will be the audio playback path of your player.
For the video you'll still use a muted QMediaPlayer to decode the video frames from the same file and output them to a QAbstractVideoSurface. You'll then need an algorithm to sync the video and audio frames produced by the above two methods.

Qt5 extracting audio from video

I have a task: user chooses a video file, I need to get an audio track from it and give an opportunity to play it with equalizer and then save this audio in mp3.
I found an example of media player in Qt. Playing video with Qt is very easy as the example has shown so I'd like to realize this task only with Qt API. The only way I know to get audio track from video is to use libAV or similar libraries. Is there an opportunity to get audio from video with Qt API? Also I haven't found the way to save an audio in a specific format with Qt. Is it possible?
Thanks a lot.

Qt 5, QCamera, video streaming by network

Can you guys help me, what the best way for streaming video and sound from webcam over network? I have a problem, because i'm need to use Qt for that. Now i'm using QCamera and QVideoWidget just for show videostream to screen, but i need to send this stream to server, which will show this stream to QVideoWidget too. May be need to use QMediaRecorder for that, but i'm not see some methods, where i can get audio/video raw-data frame, or may be other, anyway, how do you see for this, what the best way for streaming. Thanks a lot!

Key callbacks with gstreamer

I was wondering if anyone has any idea of how to do key callbacks with gstreamer. I've looked, and can't find anything. I'm trying to do the equivalent of cvWaitKey. I do have OpenCV in my program and it can interact with Gstreamer. However, Gstreamer is outputting the video to the screen thus cvWaitKey doesn't work.
Thanks!
This has nothing to do with GStreamer. Pick a UI toolkit like Gtk+ or Qt and use the functionality there.