Skip to content

Position restarts at 0 when seeking #186

@blitzdose

Description

@blitzdose

I stumbled across a weird issue when seeking audio tracks converted to opus using ffmpeg. Problem is, that Player.getPlayingTrack().setPosition() works just fine and the audio correctly seeks to the given position. But when calling Player.getPlayingTrack().getPosition() a few seconds later, I can see that the position has been reset to 0 and started counting from there. Example:

Player.getPlayingTrack().getPosition() // <-- returns 10200
Player.getPlayingTrack().setPosition(50000) // I can hear the audio seeking to the correct position, 50 seconds into the audio track
Thread.sleep(3000) // waiting 3 seconds

Player.getPlayingTrack().getPosition() // <-- now returns around 3000
Thread.sleep(3000) // waiting another 1 second
Player.getPlayingTrack().getPosition() // <-- now returns around 4000

Interesting is, that it does only happen to audio tracks, I converted using the following ffmpeg command, even if the input file is already in opus format:
ffmpeg -i <input_file> -vn -c:a libopus -f opus <output_file>
After lots of research I even came up with a different command to remove the repeating "pos" parameters in the audio packets of the ffmpeg generated audio file but the issue persists. Even when I use the command ffmpeg -i <input> -vn -c:a copy -f opus <output>, which should not reencode the audio, I get the same issue. This is also not limited to opus. ogg format and libvorbis encoding has the same issue.

I'm not sure if this is an issue with the library or ffmpeg or my skills but to me it looks like a bug in the library.

I added the two audio files below. I cant spot a meaningful difference between them.

Audiofiles.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions