Skip to content
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

MOV containing PCM - playback speed too high [reopened] [question] #4228

Closed
ened opened this issue May 9, 2018 · 6 comments
Closed

MOV containing PCM - playback speed too high [reopened] [question] #4228

ened opened this issue May 9, 2018 · 6 comments
Assignees
Labels

Comments

@ened
Copy link
Contributor

ened commented May 9, 2018

I would like to re-open the issue here, rgd. incorrect MOV file playback when the audio stream contains PCM 16 LE raw audio.

#1592

The issue appears when a Android phone connects Dash Cams or IP Cameras, downloads the recordings and tries to play them. The issue is present throughout multiple chipsets and manufacturers.

To followup with the original issue, I submitted additional sample files by email.

As a follow-up question to this: Is this something the FFmpeg extension could takeover? In that case, I will close this issue immediately.

@tonihei
Copy link
Collaborator

tonihei commented May 9, 2018

It still looks like the media is broken. The raw audio actually has a sample rate of 16 kHz while the headers claim its 32 kHz (see the ffmpeg output in #1592). When I override the sample rate to be 16 kHz, everything works as expected.

Note: I derived the actual sample rate from the Mp4 sample table. The chunks have 1024 bytes, meaning 512 samples with 16 bit. The timestamp difference between the chunks is 32000 us which leads to 32000/512 = 62.5 us per sample, which is 16kHz.

@ened
Copy link
Contributor Author

ened commented May 10, 2018

@tonihei OK, so it's bad media.

A few things then:

  • VLC, Android standard MediaPlayer and ffmpeg support playback without issues here, the pcm_s16le component on ffmpeg seems to handle it just fine in fact. As ExoPlayer already tries to work with the PCM audio in DefaultAudioSink, would this be a welcome additional layer of compatibility?
  • The media files are generated by the thousands at this moment, as mentioned earlier it's a standard out of the box IP camera product and those recordings were taken there.
  • If ExoPlayer will not be able to handle this, then I am probably forced to install the ffmpeg plugin for the audio playback. Would you concur with that?
  • When you write "I derived the actual sample rate from the Mp4 sample table." => wouldn't that be the best way anyway?

@ened
Copy link
Contributor Author

ened commented May 11, 2018

  • So far was not able to get the FFmpeg solution to work. I used the pcm_s16le decoder component but was not successful, yet.
  • As a workaround, I could decipher the header and then configure ExoPlayer, but how to do this on a single file? I know about com.google.android.exoplayer2.audio.AudioAttributes, IMO the best place to configure the audio parameters. However, it might need to be extended with an encoding field to force a certain Audio format.

@andrewlewis
Copy link
Collaborator

When the audio track is rechunked in AtomParsers, it seems that a lot of WAV data in the file is skipped over, which is leading to the clicks. This may be a bug in the rechunking or sample table parsing code, or the file may be invalid yet handled correctly by some other players.

@ened
Copy link
Contributor Author

ened commented May 18, 2018

Let me know if you need any more sample files. I should be able to get 1440p, 1080p, 720p files in 30 and 60FPS.

andrewlewis added a commit that referenced this issue May 18, 2018
The sample size from the stsd box takes precedence over the sample size in the
stsz box.

Also remove assumption that C.INDEX_UNSET is -1 in ChunkIterator (which is a
no-op change).

Issue: #4228

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196661751
@ened
Copy link
Contributor Author

ened commented May 19, 2018

@andrewlewis @tonihei , Exo Player Team: Thank you so much. I successfully tested the latest revision from git. Very happy. 🎉

@google google locked and limited conversation to collaborators Sep 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants