Opened 12 years ago
Closed 12 years ago
#2172 closed defect (fixed)
ffmpeg 1.1 breaks hls live streaming
Reported by: | devr | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | 1.1.1 | Keywords: | hls m3u8 segment |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
Summary of the bug:
ffmpeg 1.1 fails to produce a valid hls m3u8 live stream for iOS devices.
What happens:
The iOS device stops playing the video after the end of the current m3u8 file is reached.
What should happen(this is the behaviour in version 1.0.3):
The ios device checks cyclic for new content in m3u8 and plays the next segments and recalculates the length of the current stream.
How to reproduce:
Start streaming a video and begin watching while encoding happens.
Video will only play as far as the current progress of the encoding has been at the time of starting playing the file.
iOS Device does not seem to realize that new "content" has been added and stream length has changed while watching the video.
ffmpeg -i myvideo.avi -acodec libfaac -ar 48000 -vcodec libx264 -async 2 -map 0:0 -map 0:1 -f segment -segment_format mpegts -segment_list /tmp/video/output.m3u8 -segment_list_flags +live -segment_wrap 1080 -segment_time 10 out%03d.ts ffmpeg version: ffmpeg version git-2012-10-27-a9d97e1 Copyright (c) 2000-2012 the FFmpeg developers built on Oct 27 2012 01:47:25 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
This problem does not exist with:
ffmpeg version 1.0.3 Copyright (c) 2000-2012 the FFmpeg developers built on Jan 22 2013 23:09:49 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
Example m3u8 file with version 1.0.3(working as expected)
#EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-ALLOWCACHE:1 #EXT-X-TARGETDURATION:10 #EXTINF:12.501333, out000.ts #EXTINF:12.502667, out001.ts #EXTINF:12.504000, out002.ts . . . . #EXTINF:12.520000, out014.ts #EXTINF:1.400000, out015.ts #EXT-X-ENDLIST
Example m3u8 file with version 1.1(not working)
#EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-ALLOWCACHE:1 #EXT-X-TARGETDURATION:11 #EXTINF:10.432000, out000.ts #EXTINF:10.426000, out001.ts #EXTINF:10.420000, out002.ts #EXTINF:10.435333, out003.ts #EXTINF:10.429333, out004.ts #EXTINF:10.423333, out005.ts #EXTINF:10.417333, out006.ts #EXTINF:10.432667, out007.ts #EXTINF:1.850667, out008.ts #EXT-X-ENDLIST
Attachments (1)
Change History (5)
by , 12 years ago
Attachment: | 0001-lavf-segment-mark-EXT-X-ENDLIST-in-M3U8-only-at-the-.patch added |
---|
follow-up: 2 comment:1 by , 12 years ago
Analyzed by developer: | set |
---|---|
Component: | undetermined → avformat |
Keywords: | segment added |
Status: | new → open |
follow-up: 3 comment:2 by , 12 years ago
Replying to saste:
Replying to devr:
Summary of the bug:
ffmpeg 1.1 fails to produce a valid hls m3u8 live stream for iOS devices.
What happens:
The iOS device stops playing the video after the end of the current m3u8 file is reached.
What should happen(this is the behaviour in version 1.0.3):
The ios device checks cyclic for new content in m3u8 and plays the next segments and recalculates the length of the current stream.
How to reproduce:
Start streaming a video and begin watching while encoding happens.
Video will only play as far as the current progress of the encoding has been at the time of starting playing the file.
iOS Device does not seem to realize that new "content" has been added and stream length has changed while watching the video.
[...]
Please test the attached patch with latest FFmpeg git.
Patch works as expected! Thanks for the fast help. Will the patch be added to git?
follow-up: 4 comment:3 by , 12 years ago
Replying to devr:
Replying to saste:
[...]
Please test the attached patch with latest FFmpeg git.
Patch works as expected! Thanks for the fast help. Will the patch be added to git?
Sure, as soon as possible. I don't know if it would be feasible to backport the fix, given the many patches which went in since the last release. Thanks for reporting/testing.
comment:4 by , 12 years ago
Reproduced by developer: | set |
---|---|
Resolution: | → fixed |
Status: | open → closed |
Replying to saste:
Replying to devr:
Replying to saste:
[...]
Please test the attached patch with latest FFmpeg git.
Patch works as expected! Thanks for the fast help. Will the patch be added to git?
Sure, as soon as possible. I don't know if it would be feasible to backport the fix, given the many patches which went in since the last release. Thanks for reporting/testing.
Should be fixed in:
commit ca68acd7ac3720b76efcf37219700e76e111062c Author: Stefano Sabatini <stefasab@gmail.com> Date: Wed Jan 23 00:23:47 2013 +0100 lavf/segment: mark #EXT-X-ENDLIST in M3U8 only at the end of stream Should fix immediate playback termination. In particular, should fix trac ticket #2172.
Replying to devr:
[...]
Please test the attached patch with latest FFmpeg git.