libvlc seek problems
Posted: 13 Jan 2014 22:34
by microaide
I am writing a cross-platform media player to play MP3 files using libvlc. I am using Qt 4.7 with VLC 2.0.1. My only interest is in playing audio files, mostly MP3 and WAV. The good news is that the MP3 files play perfectly. The bad news is that I am having problems seeking while the media is paused. If I seek while the media is playing, everything works perfectly. But if the media is paused there are problems. I use libvlc_media_player_set_time to position the file to a given time. Then I call libvlc_media_player_get_time periodically in a timer event to update my seek slider and displayed media time. What I see is that libvlc_media_player_get_time first reports the time I set. But then the reported time suddenly jumps to a higher time, often 10-20 seconds or more higher that the time I tried to seek to. Seeking backwards can result is a forward seek much larger that the backward seek I was trying to do. I can understand the reported time being off by 10-20 ms, but not 10000 ms or more. Any ideas?
Re: libvlc seek problems
Posted: 14 Jan 2014 01:04
by microaide
More information on the seeking problem. Upgrading to VLC 2.1.2 did NOT change the problem. Also, the seeking problems affect the regular VLC media player (standard QT interface) as well. Seeking errors seem to be worse on longer MP3 files. With an MP3 file of almost 10 minutes length I can pause the playback at approximately 5 minutes. Then I hit ALT-LEFTARROW to step back 10 seconds (while the media is paused). The position changes momentarily to 4:50, then suddenly jumps forward by some random amount, often between 10 and 30 seconds. Stepping back 10 seconds while paused usually leaves the position FORWARD from where it was. Trying to change position using the seek slider while paused has similar problems. I click the slider and drag it with the mouse. Then I release it at the desired time, and the slider suddenly snaps forward anywhere from a few seconds to over 20 seconds.
I am running Windows XP SP3, but I tested VLC media player on Crunchbang Linux and it does the same thing. My MP3 files are mono, sample rate 22050Hz, bitrate 32 Kbps, encoded with Lame 3.93, and have ID3v1.1 tags. I would appreciate it if anyone else can reproduce these symptoms. The seek problems occur only when the media is paused. If it is playing, everything works perfectly.