MP3 player issue
-
Hi,
Currently, I am developing an app that play MP3 files based on the official Qt example. Now, here is the issue:
I can play any kind of MP3 files from Linux and Mac perfectly. My problem only occurs specifically on Windows systems, when I try to play some specific type of MP3 files. Let me give you an specific example.- Using my Qt app I can play this file perfectly: https://tupitube.com/files/mp3/good.mp3
- When I try to play this file from my Qt app, it fails: https://tupitube.com/files/mp3/bad.mp3
Both files are MP3 valid files, and I can reproduce them from the web browser and from other non Qt apps. So, the big question here is, what is the difference between both files? Why the second one fails on Qt apps? What I am missing?
Note 1: In fact, the Qt Music player example also fails reproducing the second file. Why?
Note 2: These are the output for both MP3 files using mplayer and the ffprobe tool from ffmpeg:good.mp3 settings ========================================================================== Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24000->176400) Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III) ========================================================================== Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 192 kb/s bad.mp3 settings ========================================================================== Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000) Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III) ========================================================================== Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p, 76 kb/s
-
well, the first thing that comes to mind when looking at the metadata is that one is CBR and the other is encoded using VBR. I strongly suggest researching and understanding the MP3 format before attempting to code for it.
-
Thank you for the feedback. Continuing with my research, I wonder how the support of codecs and containers depends on the operating system settings. I mean, I was testing my code on Windows, Mac and Linux and the behavior of the app changes depending on how many codecs and libraries are installed in the system. I was hopping that for some reason Qt would provide the MP3 libraries support to create and play this kind of format. In that way, as programmer I shouldn't have to care about these details.
Additionally, I was playing around with the Audio Recorder example that comes with the Qt installation in several operating systems, and the options of codecs and containers changes depending on the results of calling these methods:QMediaRecorder::supportedAudioCodecs() QMediaRecorder::supportedContainers()
I know this could be obvious information for other programmers, but personally, this is some kind of a new topic to me.
Finally, I was testing the VLC application and I could realize that it includes its own codec plugins. So, I wonder is it possible to include the codecs support as part of a Qt application installer, in the same way VLC does it? -
QT doesn't process multimedia directly. It uses a "platform dependent" backend. In the case of linux it is generally gstreamer. Your capabilities will be dictated by the capabilities of the backend. the defautl windoze backend may not like VRB encoded MP3...that tickles a very foggy memory with me.
-
I've seen someone successfully built a qtmultimedia gstreamer plugin on Windows like this: https://github.com/gunrot/windows-qt-with-gstreamer
If that's possible, then maybe you could use gstreamer plugin instead of the default wmf/dshow ones, it should have better codecs support. But you'll also need to port gstreamer libraries with your application.
Just for discussion, never tried that by myself...
Ah...Also, strangely I've tried the Media Player Example with my qt5.15 and I can play both your good and bad mp3 files...
I remember reading from somewhere that the default backend's media playing capability on Windows also depends on the codecs you've installed on your system.