Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088477

MP3 playback reporting incorrect position for some files

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • 7u6
    • javafx
    • Have observed similar behavior with the same .mp3 files on both Windows and Ubuntu.

    Description

      While using the Media class playing an .mp3 file with these encoding settings, the track current position is inaccurate.

      I'm assuming MP3's of any encoding configuration should play fine since the JavaFX documentation states the Media class can handle MP3s with "all supported combinations of sampling frequencies and bit rates."

      Problems observed with these MP3 file encoding settings:

      -MPEG Audio 1, Layer 3
      -Bitrate: 256 kbps
      -Sample rate: 44.1 kHz
      -Encoded with: LAME.98

      A side note is that Amazon .mp3 provides their downloads in this format (at least for some of the tracks purchased through their service). I say this because it indicates that the encoding configuration is not particularly uncommon. Some research indicates that Amazon MP3 doesn't publish their .mp3 files with consistent encoding settings and there is no way to know which encoding you'll get before you buy something. Again, I'm just putting that info here as a clue to what might be actually going on with the file I'm using and to help the process of finding the answer to the issue.

      Audio plays back fine but there appear to be inconsistencies with seek and current position and the most notable problem can easily be seen when playing the end of a track. In my case, the slider that I have bound to the current position will reach the end of the track and stop before the actual end of the track happens. This indicates the position reported by the Media class for this file is not correct. The same interface works with .wav files with no problem as well as most other MP3 files I have tested with.

      To me, it appears there may be issues with how playback occurs with some .mp3 files, depending on the codec that was used for the original file creation. I'm not a codec expert, though so really I'm just reporting the behavior I'm seeing.

      -----Updated replication steps based on comment from 6/1/13-----------------

      Many files on Amazon MP3 are free to download, so I found one that reproduces the issue. You can download it here: http://www.amazon.com/Piano-Sonata-major-K-331-allegretto/dp/B00B0W2U4Q/ref=sr_1_12?ie=UTF8&qid=1370115523&s=dmusic&sr=1-12 

      Let me know if you have any trouble downloading that file. You may need to create a free Amazon account if you don't have one already. 

      This file (according to iTunes) has been encoded with the LAME3.97 encoder. 

      Replication steps (on Windows 7 x64 and Ubuntu 12.04): 

      1. Play the song in iTunes (or another audio player) -- notice that the song has an end time of 3:46. Also notice that the last note of the song happens at 3:36, followed by about 10 seconds of silence before the track stops playing. 

      2. Play the song in a JavaFX application (load from local file system) using JDK 7.21. Notice that the last note of the song appears at 3:42 with only about 4 seconds of silence at the end.

      -----------------------------------------------------------------------------------------------------------
      It may be that this encoding configuration is altogether not supported in JavaFX, but I could not find documentation saying as such.

      Thanks in advance for the help.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kfitzgerajfx Kristian Fitzgerald (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Imported: