google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.73k stars 6.03k forks source link

Invalid audio track info for TS/HLS (Parametric Stereo) #6943

Open stari4ek opened 4 years ago

stari4ek commented 4 years ago

[REQUIRED] Issue description

ExoPlayer identifies audio track incorrectly (mono/24kHz vs stereo/48kHz):

ExoPlayer:

mimeType=audio/mp4a-latm, channels=1, sample_rate=24000

MediaInfo

Audio
ID                                       : 257 (0x101)
Format                                   : AAC LC SBR PS
Format/Info                              : Advanced Audio Codec Low Complexity with Spectral Band Replication and Parametric Stereo
Commercial name                          : HE-AACv2
Format version                           : Version 4
Format settings                          : Implicit
Muxing mode                              : ADTS
Codec ID                                 : 15-2
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel layout                           : C
Sampling rate                            : 48.0 kHz
Frame rate                               : 23.438 FPS (2048 SPF)

VLC:

ADTS, Stereo, 48kHz, 32bps, SBR

[REQUIRED] Reproduction steps

Start demo with local TS file provided below


decoderEnabled [eventTime=0.11, mediaPos=0.00, window=0, period=0, audio]
tracks [eventTime=0.11, mediaPos=0.00, window=0, period=0, 
  Renderer:0 [
    Group:0, adaptive_supported=N/A [
      [X] Track:0, id=1/256, mimeType=video/avc, codecs=avc1.4D4028, res=1920x1080, supported=YES
    ]
  ]
  Renderer:1 [
    Group:0, adaptive_supported=N/A [
      [X] Track:0, id=1/257, mimeType=audio/mp4a-latm, channels=1, sample_rate=24000, supported=YES
    ]
  ]
  Renderer:2 [
    Group:0, adaptive_supported=N/A [
      [ ] Track:0, id=1/8448, mimeType=application/cea-608, supported=YES
    ]
  ]
]
downstreamFormat [eventTime=0.13, mediaPos=0.00, window=0, period=0, id=1/257, mimeType=audio/mp4a-latm, channels=1, sample_rate=24000]
decoderInitialized [eventTime=0.13, mediaPos=0.00, window=0, period=0, audio, OMX.google.aac.decoder]
decoderInputFormat [eventTime=0.13, mediaPos=0.00, window=0, period=0, audio, id=1/257, mimeType=audio/mp4a-latm, channels=1, sample_rate=24000]

[REQUIRED] Link to test content

[REQUIRED] A full bug report captured from the device

not device-specific

[REQUIRED] Version of ExoPlayer being used

[REQUIRED] Device(s) and version(s) of Android being used

I/ExoPlayerImpl: Init 24c3884 [ExoPlayerLib/2.11.2] [generic_x86, sdk_google_atv_x86, unknown, 28]

Tested on emulator API 28, reproduced on Sony TV (SVPDTV15_EU, API 24)

AquilesCanta commented 4 years ago

After looking a bit, it would seem that it's not trivial to fix this. The stream is using parametric stereo, which means we need to parse more of the ADTS content in order to find the configuration that overrides the initial channel_configuration field. I'll mark this as low priority for now, you are welcome to send a pull request our way.

If you are sending this stream via HLS, please consider just signalling the channel configuration in the manifest, which will also help the case of chunkless preparation.

Gerdorald commented 3 years ago

I have the same ID 257 (0x101) with Ac3 in .ts and also deal with a undesired Codec ID (129, but I'm looking for 6). I'm interested in the solution to this so please prioritize