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

AAC HLS stream is not playing #540

Closed
4 tasks done
waster opened this issue Jul 1, 2016 · 11 comments
Closed
4 tasks done

AAC HLS stream is not playing #540

waster opened this issue Jul 1, 2016 · 11 comments

Comments

@waster
Copy link

waster commented Jul 1, 2016

Environment
Steps to reproduce
  1. Open test link above

Stream is generated with ffmpeg version N-79790-g017d42e:
ffmpeg -i [URL] -c:a libfdk_aac -b:a 128k -af volume=-6dB -ar 44100 -f segment -segment_list /tmp/hls/test/aac/128/out.m3u8 -segment_list_flags live -segment_time 2 -segment_list_size 10 -segment_wrap 20 -segment_format adts /tmp/hls/test/aac/128/out%01d.aac

Expected behavior

Player should play stream

Actual behavior

Player could not play stream
What's wrong with the generated aac segments?

Console output
[log] > loadSource: http://hlsserverdev.hostingradio.ru:8080/test/aac/128/out.m3u8" hls.js:8695:7
[log] > trigger BUFFER_RESET hls.js:8695:7
[log] > set autoLevelCapping:-1 hls.js:8695:7
[log] > attachMedia hls.js:8695:7
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create hls.js:6559:415
[log] > media source opened hls.js:8695:7
[log] > manifest loaded,1 level(s) found, first bitrate:undefined hls.js:8695:7
[log] > startLoad hls.js:8695:7
[log] > demuxing in webworker hls.js:8695:7
[log] > switching to level 0 hls.js:8695:7
[log] > (re)loading playlist for level 0 hls.js:8695:7
[log] > live playlist, reload in 2854 ms hls.js:8695:7
[log] > level 0 loaded [741,750],duration:19.99238 hls.js:8695:7
[log] > live playlist - first load, unknown sliding hls.js:8695:7
[log] > find SN matching with pos:10.99238:746 hls.js:8695:7
[log] > Loading 746 of [741 ,750],level 0, currentTime:10.99238,bufferEnd:10.992 hls.js:8695:7
[log] > Loaded  746 of level 0 hls.js:8695:7
[log] > Demuxing 746 of [741 ,750],level 0, cc 0 hls.js:8695:7
[log] > recoverMediaError hls.js:8695:7
[log] > detachMedia hls.js:8695:7
[log] > attachMedia hls.js:8695:7
MediaSource detached... demo:499:11
[log] > media source opened hls.js:8695:7
[log] > startLoad hls.js:8695:7
[log] > demuxing in webworker hls.js:8695:7
[log] > same live playlist, reload twice faster hls.js:8695:7
[log] > live playlist, reload in 1389 ms hls.js:8695:7
[log] > level 0 loaded [741,750],duration:19.99238 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > live playlist, switching playlist, unknown, load middle frag : 746 hls.js:8695:7
[log] > find SN matching with pos:10.99238:746 hls.js:8695:7
[log] > Loading 746 of [741 ,750],level 0, currentTime:10.99238,bufferEnd:10.992 hls.js:8695:7
[log] > Loaded  746 of level 0 hls.js:8695:7
[log] > Demuxing 746 of [741 ,750],level 0, cc 0 hls.js:8695:7
[log] > swapAudioCodec hls.js:8695:7
[log] > recoverMediaError hls.js:8695:7
[log] > detachMedia hls.js:8695:7
[log] > attachMedia hls.js:8695:7
MediaSource detached... demo:499:11
[log] > media source opened hls.js:8695:7
[log] > startLoad hls.js:8695:7
[log] > demuxing in webworker hls.js:8695:7
[log] > configure startPosition @10.99238 hls.js:8695:7
[log] > resuming video hls.js:8695:7
[log] > live playlist, switching playlist, unknown, load middle frag : 746 hls.js:8695:7
[log] > find SN matching with pos:10.99238:746 hls.js:8695:7
[log] > Loading 746 of [741 ,750],level 0, currentTime:10.99238,bufferEnd:10.992 hls.js:8695:7
[log] > same live playlist, reload twice faster hls.js:8695:7
[log] > live playlist, reload in 1406 ms hls.js:8695:7
[log] > level 0 loaded [741,750],duration:19.99238 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > Loaded  746 of level 0 hls.js:8695:7
[log] > swapping playlist audio codec hls.js:8695:7
[log] > Demuxing 746 of [741 ,750],level 0, cc 0 hls.js:8695:7
Parsing Error:no demux matching with content found,cannot recover, last media error recovery failed ... demo:499:11
[log] > live playlist, reload in 2943 ms hls.js:8695:7
[log] > level 0 loaded [742,751],duration:19.99238 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > same live playlist, reload twice faster hls.js:8695:7
[log] > live playlist, reload in 1433 ms hls.js:8695:7
[log] > level 0 loaded [742,751],duration:19.99238 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > live playlist, reload in 2944 ms hls.js:8695:7
[log] > level 0 loaded [743,752],duration:20.015600000000003 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > same live playlist, reload twice faster hls.js:8695:7
[log] > live playlist, reload in 1445 ms hls.js:8695:7
[log] > level 0 loaded [743,752],duration:20.015600000000003 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > live playlist, reload in 2950 ms hls.js:8695:7
[log] > level 0 loaded [744,753],duration:20.0156 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > same live playlist, reload twice faster hls.js:8695:7
[log] > live playlist, reload in 1443 ms hls.js:8695:7
[log] > level 0 loaded [744,753],duration:20.0156 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > same live playlist, reload twice faster hls.js:8695:7
[log] > live playlist, reload in 1415 ms hls.js:8695:7
[log] > level 0 loaded [744,753],duration:20.0156 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > same live playlist, reload twice faster hls.js:8695:7
[log] > live playlist, reload in 1442 ms hls.js:8695:7
[log] > level 0 loaded [744,753],duration:20.0156 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
[log] > live playlist, reload in 2951 ms hls.js:8695:7
[log] > level 0 loaded [745,754],duration:20.0156 hls.js:8695:7
[log] > live playlist - outdated PTS, unknown sliding hls.js:8695:7
render_id: 15
player_id: 1
pipeline_state: kStopped
event: WEBMEDIAPLAYER_DESTROYED
url: blob:http%3A//dailymotion.github.io/74868513-1628-4688-84f2-4e89dc09f194
pipeline_error: demuxer: could not open
@phloxic
Copy link
Contributor

phloxic commented Jul 1, 2016

Did you also try the ffmpeg hls muxer: http://www.ffmpeg.org/ffmpeg-formats.html#hls-1 ?

@waster
Copy link
Author

waster commented Jul 1, 2016

@blacktrash sure I tried successfully, it generates TS segments with MPEG-TS muxer, but I need to generate ADTS AAC segments for audio only stream and hls.js is presented with AAC container support for such streams. The main cause of this is that audio tag can be played inline on iPhone (4 < iOS).

@phloxic
Copy link
Contributor

phloxic commented Jul 1, 2016

The TS segments are ADTS when created with the hls muxer.
This seems to work: http://dailymotion.github.io/hls.js/demo/?src=http%3A%2F%2Fd12zt1n3pd4xhr.cloudfront.net%2Ffp%2Ftest%2Fhyperion_ff.m3u8&enableStreaming=true&autoRecoverError=true&enableWorker=true&levelCapping=-1&defaultAudioCodec=undefined

ffmpeg cli:

ffmpeg -i in.aif -vn -dn -sn -filter:a aresample=44100 \
-c:a libfdk_aac -profile:a aac_he -b:a 64k -f mpegts - | \
ffmpeg -i - -c copy -f hls -hls_time 10 \
-hls_playlist_type vod -hls_segment_filename %02d.ts pl.m3u8

Disclaimer: I have no experience with segmenting live streams.

@nhjm449
Copy link
Contributor

nhjm449 commented Jul 1, 2016

com.apple.streaming.transportStreamTimestamp ID3 PRIV tags must be in each AAC fragment to let the player know what the PTS of the fragment is. And a simple code search shows that nothing in ffmpeg generates said tag.

TS fragments are perfectly capable of being audio-only, btw.

And if you do switch to TS, you may run into subtle continuity_counter discontinuity issues on certain platforms (Android) if not using the ffmpeg hls formatter, as the segment formatter will reset it to 0 for each fragment.

@waster
Copy link
Author

waster commented Jul 2, 2016

Yes, I'm successfully using audio-only TS fragments generated with ffmpeg hls. But I'm confusing if <audio> tag could play such TS fragments and it has been written in a spec somewhere?

@mangui
Copy link
Member

mangui commented Jul 5, 2016

your use HLS with AAC ES. as stated by @nhjm449 com.apple.streaming.transportStreamTimestamp ID3 PRIV tags must be in each AAC fragment. this is stated in HLS spec

@mangui mangui added the Question label Jul 5, 2016
@waster
Copy link
Author

waster commented Jul 5, 2016

@mangui ah, I see, thank you for the explanation. BTW, just wondering if it is possible to insert timed metadata with ffmpeg in TS or AAC ES, because currently I can not find the right way to do that?

@mangui
Copy link
Member

mangui commented Jul 5, 2016

yes, hls.js supports Timed Metadata in ID3 format, carried in MPEG2-TS
I don't know about ffmpeg usage, but a bunch of people are using this.
if fragment boundary precision is enough for you, you can listen to FRAG_CHANGED event and also retrieve any custom tags from stream manifest.

@waster
Copy link
Author

waster commented Jul 5, 2016

hm, interesting idea, you suggest to use manifest instead timed metadata in chunks, but what about html5 native support then (Safari, etc)? And is timed metadata also supported with native HTML5 playback?

@nhjm449
Copy link
Contributor

nhjm449 commented Jul 5, 2016

Pretty sure Safari native playback will present the data as TextTracks. A simple way to listen for cues is probably: http://stackoverflow.com/a/31433502

@stale
Copy link

stale bot commented Jun 16, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Wontfix label Jun 16, 2018
@stale stale bot closed this as completed Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants