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

[QUESTION] Can't receive audio track from HLS #8162

Closed
Psychical opened this issue Nov 4, 2020 · 10 comments
Closed

[QUESTION] Can't receive audio track from HLS #8162

Psychical opened this issue Nov 4, 2020 · 10 comments
Assignees

Comments

@Psychical
Copy link

[REQUIRED] Searched documentation and issues

[REQUIRED] Question

I'm trying to get audio tracks from hls strea but getting only one.

Using 'com.google.android.exoplayer:exoplayer:2.12.1'

My play code looks like this

rf.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER);
trackSelector = new DefaultTrackSelector(this);

exoPlayer = new SimpleExoPlayer.Builder(this, rf).setTrackSelector(trackSelector).build();
exoPlayer.addAnalyticsListener(new EventLogger(trackSelector));

playerView.setPlayer(null);
playerView.setPlayer(exoPlayer);
playerView.setUseController(false);

MediaItem mediaItem = new MediaItem.Builder().setUri(mCurrentURL).setMimeType(MimeTypes.APPLICATION_M3U8).build();

exoPlayer.setPlayWhenReady(true);

DataSource.Factory dataSourceFactory = new DefaultHttpDataSourceFactory();
HlsMediaSource hlsMediaSource = new HlsMediaSource.Factory(dataSourceFactory).setAllowChunklessPreparation(true).createMediaSource(mediaItem);

exoPlayer.setMediaSource(hlsMediaSource);
exoPlayer.prepare();

exoPlayer.addAnalyticsListener(new EventLogger(trackSelector)) throw this

LibvpxVideoRenderer []
MediaCodecVideoRenderer [
    Group:0, adaptive_supported=N/A [
        [X] Track:0, id=0, mimeType=video/avc, codecs=avc1.640028, res=1920x1080, supported=YES
    ]
]
LibflacAudioRenderer []
FfmpegAudioRenderer [
    Group:0, adaptive_supported=N/A [
        [X] Track:0, id=1/15, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, supported=YES
    ]
]
MediaCodecAudioRenderer []
TextRenderer [
    Group:0, adaptive_supported=N/A [
        [ ] Track:0, id=1/8219, mimeType=application/cea-608, supported=YES
    ]
]
MetadataRenderer [
    Group:0, adaptive_supported=N/A [
        [X] Track:0, id=null, mimeType=application/id3, supported=YES
    ]
]
CameraMotionRenderer []

Input files metadata:

Input #0, hls, from 'http://1.1.1.1/tv/viasathistory/stream.m3u8':
Duration: N/A, start: 4872.434667, bitrate: N/A
Program 0 
    Metadata:
        variant_bitrate : 0
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc
    Metadata:
        variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
        variant_bitrate : 0
    Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
        variant_bitrate : 0
Input #0, mpegts, from 'http://1.1.1.1/tv/viasathistory/file0000507.ts':
  Duration: 00:00:09.51, start: 5072.029333, bitrate: 4224 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 140 kb/s
    Stream #0:2[0x102]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 102 kb/s

I don't know or this is a bug or it's just my code problems, but I can't get audio tracks... I tried ask in StackOverflow, but noone helped -_-

@lcf87
Copy link

lcf87 commented Nov 4, 2020

Could you provide us with the media file/link that you are testing with?

@Psychical
Copy link
Author

Could you provide us with the media file/link that you are testing with?

I can't give link, because it's depend on ip, maybe if you can send me IP and I can set it for you. I can only attach file I get from urls.

m3u8.zip

@stevemayhew
Copy link
Contributor

Might be related to or fixed by the fix coming for this bug issue #7877

@Psychical
Copy link
Author

If I understood correctly it's happening when tracks is for the same language? I have changed tracks languages, but it's still the same. So I will wait for #7877 bug fix and try again.

m3u8 - lang with names.zip

@lcf87
Copy link

lcf87 commented Nov 5, 2020

I cannot unzip the file you uploaded on my Mac, or is it a zip file at all?

@Psychical
Copy link
Author

Sorry, my fault. Fixed.

m3u8 - lang with names.zip
m3u8.zip

@Psychical
Copy link
Author

Any news?

@AquilesCanta
Copy link
Contributor

AquilesCanta commented Dec 7, 2020

The media plays well for me on ExoPlayer, including the audio tracks. Are you saying that your device is not playing the audio track?

According to your log, the ffmpeg audio renderer should be playing it:

FfmpegAudioRenderer [
    Group:0, adaptive_supported=N/A [
        [X] Track:0, id=1/15, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, supported=YES
    ]
]

Have you tried playing your content on the ExoPlayer demo app?

@Psychical
Copy link
Author

Psychical commented Dec 7, 2020

The media plays well for me on ExoPlayer, including the audio tracks. Are you saying that your device is not playing the audio track?

According to your log, the ffmpeg audio renderer should be playing it:

FfmpegAudioRenderer [
    Group:0, adaptive_supported=N/A [
        [X] Track:0, id=1/15, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, supported=YES
    ]
]

Have you tried playing your content on the ExoPlayer demo app?

I see only 1 track, then I need to see at least 2... That's the problem. As you show it's just 1 track, but in my sample it have to be 2 tracks.

@AquilesCanta
Copy link
Contributor

ExoPlayer doesn't currently support multiple multiplexed audio tracks in HLS. Adding support for that is tracked by #2014. If you do some research starting from #2014 and going into other issues that reference it, you will find people customizing ExoPlayer to make it work, but it will require some research on your side.

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

No branches or pull requests

5 participants