I am make a player with wx.Media, when I import a mp3 file, Wx return diferent time when the file has a bit rate variable or bit rate constant. I have the same file, but with diferent duration retorned by Wx. If i use software to get multimedia information like Mediainfo, VLC, Reaper etc, all softwares return the same time with variable or constant bit rate. Has Wx a bug?, how can I solbed it?
I use Media info to get mp3 information, but remember, my problem is the time duration retorned by wx.media.MediaCtrl.Length() instruction when mp3 file is variable or constant bit rate, here a example:
‘track.mp3’
with bit rate variable : 2054243 milliseconds
with bit rate constant: 2106902 milliseconds
This may be a (known) problem in wxWidgets. The wxAMMediaBackend (which I think is the default backend?) has a comment in the code about GetDuration() not working correctly with VBR MP3 files:
You might want to try the other backends (e.g. WMP 10) to see if the behavior is any different?
I tryed with MEDIABACKEND_DIRECTSHOW and MEDIABACKEND_WMP10, but the problems it’s continuing. In vefore coment show a problem with variable bit rate (vbr), but in my test, wx.media and other softwares return the same duration time, the problem ocurre when I load a constant bit rate mp3 (cbr), because only wx.media return a diferent duration.
I checked the duration that FFmpeg returns and that of wx.media.Length for VBR and CBR.
As you pointed out, wx.media.MediaCtrl.Length returns the same value for media with VBR but a different value for CBR (but not always).
I noticed that the Windows 10 explorer also shows the same but wrong duration time as wx.media.Length returns, so I guess this problem is with the backend of Windows.
The three files shown above have the same duration time (90.648 s). The first one is the original and the other two are converted from the original one using FFmpeg with a constant bit rate. The wx.media.MediaCtrl.Length returns 92.984 s for the last file.