-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to enable exact (but inefficient) seeking into variable bitrate MP3s #6787
Comments
I get "You are not authorized to download this file." when I try and download the file. Please could you make it available? |
I've sent a new link |
Thanks! Unless you're going to use a constant bitrate, MP3 is fundamentally not well suited to use cases that require exact seeking. There are two reasons for this:
Ultimately, this means that the only way to perform an exact seek into this type of MP3 is to scan the entire file and manually build up a time-to-byte mapping in the player. This obviously doesn't scale well to large MP3 files, particularly if the user tries to seek to near the end of the stream shortly after starting playback, which would require the player to wait until it's downloaded and indexed the entire stream before performing the seek. For ExoPlayer we decided to optimize for seeking speed over accuracy in this case. We do have plans to support exact seeking by building up an index, however we'll most likely disable this option by default (if we do this, it'll be possible to enable it with a flag). I will keep this issue open to track this enhancement. If you control the media you're playing, I would suggest that you use a more suitable container format (i.e. MP4). |
Thanks a lot for your detailed explanation. Since we are the one to extract the audio stream from the original mp4 video we control the media. As a side note - as one who's been working with ExoPlayer in the last 5 years (even had the opportunity to make a small contribution to the project :)) - I think you're doing an incredible job in making our life much easier - keep up the good work! |
MP4/M4A is always a better choice. IMO there aren't really any valid use cases for MP3 any more, unless you need to use/support it for legacy reasons. p.s. Thanks! Happy to help :). |
That sounds quite likely. |
|
Why isn't your preferred option to use a container format that's appropriate for your use case? Even the people who made MP3 don't think you should use it any more.
My understanding of XING headers are that they're only for VBR content, so if your file is CBR I'm not sure why it's ended up with a XING header in the first place (if you do some research for XING header, most references on the internet suggest that they're only used for VBR content). So yes, if you can generate the CBR MP3 without the XING header, I would expect that to work. We don't support your second suggestion. |
You're right - using a different container is probably the right approach. I guess we'll probably need to go over all of our already generated mp3 (there are a lot) and perform some kind of adjustment - removing the XING header or transcoding to a different container, and change the way we generate new mp3 files. Thanks for the tip in the right direction. |
Just a note on the competitive front - iPhone's AVPlayer seeking is precise on the same mp3 - so it probably ignores the XING header in this case. |
This seeker is only seeking to frames that have already been read by the extractor for playback. Seeking to not-yet-read frames will be implemented in another change. Issue: #6787 PiperOrigin-RevId: 291888899
Issue: #6787 PiperOrigin-RevId: 291953855
This is supported in the |
@ojw28 how to enable or use this flag? |
It is enabled by using The documentation has not been updated yet as this functionality has not been released yet. |
Issue description
When seeking to 1603000ms in the mp3 file it seems to seek approx. 3 seconds earlier.
Seeking the mp3 file using Audacity(or VLC) it seeks to the expected position (as you can hear the expected audio).
I'm not sure it's relevant but the mp3 was created by extracting the aac stream of an mp4 video file using ffmpeg. (The original mp4 is seeked correctly by ExoPlayer while the mp3 does not)
Reproduction steps
This happens consistently across devices.
Link to test content
A link to the mp3 file was emailed to dev.exoplayer@gmail.com.
A full bug report captured from the device
Full bug reported was emailed to dev.exoplayer@gmail.com
Version of ExoPlayer being used
2.11.0
Device(s) and version(s) of Android being used
Was reproduced on -
OnePlus 6 running Android 10
Google Pixel 3 running Android 10
Virtual device Google Pixel 2 Running Android 9
Virtual device Nexus 5X running Android 7.1.1
The text was updated successfully, but these errors were encountered: