Opened 4 years ago

Last modified 4 years ago

#2833 new enhancement

can't parse HLS subtitles and alternate audio

Reported by: sinkers Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: hls
Cc: underground78@gmail.com, anssi.hannula@iki.fi Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

ffmpeg doesn't appear to be able to parse HLS master playlists that include subtitles and alternate audio playlists which are defined as rendition groups according to the specification.

As such it is not possible to use these for mapping to outputs or for playback or probing. Looking at the hlsproto.c it doesn't seem to include the required tags to parse from the latest specification.
http://tools.ietf.org/html/draft-pantos-http-live-streaming-11#section-3.4.9.1

See this Apple reference URL:
https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8
It has multiple alternate audio and subtitle tracks identified by the #EXT-X-MEDIA tag however ffmpeg only identifies 5 program streams.

ffmpeg -i https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8
ffmpeg version N-54152-g730e07f Copyright (c) 2000-2013 the FFmpeg developers

built on Jul 24 2013 16:08:47 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libaacplus --enable-libcelt --enable-libfaac --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-openssl --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-libvidstab --prefix=/usr/local --enable-librtmp --cc=clang
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 16.100 / 55. 16.100
libavformat 55. 9.100 / 55. 9.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

Input #0, hls,applehttp, from 'https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8':

Duration: 00:28:32.00, start: 0.000000, bitrate: 0 kb/s
Program 0

Metadata:

variant_bitrate : 263851

Stream #0:0: Audio: aac ([15][0][0][0] / 0x000F), 22050 Hz, stereo, fltp, 41 kb/s
Metadata:

variant_bitrate : 263851

Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 416x234, 29.97 tbr, 90k tbn, 180k tbc
Metadata:

variant_bitrate : 263851

Stream #0:2: Audio: mp3 ([21][0][0][0] / 0x0015), 0 channels, s16p
Metadata:

variant_bitrate : 263851

Program 1

Metadata:

variant_bitrate : 577610

Stream #0:3: Audio: aac ([15][0][0][0] / 0x000F), 22050 Hz, stereo, fltp, 41 kb/s
Metadata:

variant_bitrate : 577610

Stream #0:4: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 29.97 tbr, 90k tbn, 180k tbc
Metadata:

variant_bitrate : 577610

Stream #0:5: Audio: mp3 ([21][0][0][0] / 0x0015), 0 channels, s16p
Metadata:

variant_bitrate : 577610

Program 2

Metadata:

variant_bitrate : 915905

Stream #0:6: Audio: aac ([15][0][0][0] / 0x000F), 22050 Hz, stereo, fltp, 41 kb/s
Metadata:

variant_bitrate : 915905

Stream #0:7: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 960x540, 29.97 tbr, 90k tbn, 180k tbc
Metadata:

variant_bitrate : 915905

Stream #0:8: Audio: mp3 ([21][0][0][0] / 0x0015), 0 channels, s16p
Metadata:

variant_bitrate : 915905

Program 3

Metadata:

variant_bitrate : 1030138

Stream #0:9: Audio: aac ([15][0][0][0] / 0x000F), 22050 Hz, stereo, fltp, 41 kb/s
Metadata:

variant_bitrate : 1030138

Stream #0:10: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1280x720, 29.97 tbr, 90k tbn, 180k tbc
Metadata:

variant_bitrate : 1030138

Stream #0:11: Audio: mp3 ([21][0][0][0] / 0x0015), 0 channels, s16p
Metadata:

variant_bitrate : 1030138

Program 4

Metadata:

variant_bitrate : 1924009

Stream #0:12: Audio: aac ([15][0][0][0] / 0x000F), 22050 Hz, stereo, fltp, 41 kb/s
Metadata:

variant_bitrate : 1924009

Stream #0:13: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080, 29.97 tbr, 90k tbn, 180k tbc
Metadata:

variant_bitrate : 1924009

Stream #0:14: Audio: mp3 ([21][0][0][0] / 0x0015), 0 channels, s16p
Metadata:

variant_bitrate : 1924009

Program 5

Metadata:

variant_bitrate : 41457

Stream #0:15: Audio: aac, 22050 Hz, stereo, fltp, 41 kb/s
Metadata:

variant_bitrate : 41457

For reference here is the output of the above reference URL's master playlist

#EXTM3U

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="bipbop_audio",LANGUAGE="eng",NAME="BipBop Audio 1",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="bipbop_audio",LANGUAGE="eng",NAME="BipBop Audio 2",AUTOSELECT=NO,DEFAULT=NO,URI="alternate_audio_aac/prog_index.m3u8"

#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="subtitles/eng/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English (Forced)",DEFAULT=YES,AUTOSELECT=YES,FORCED=YES,LANGUAGE="eng",URI="subtitles/eng_forced/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Français",AUTOSELECT=YES,FORCED=NO,LANGUAGE="fra",URI="subtitles/fra/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Français (Forced)",AUTOSELECT=YES,FORCED=YES,LANGUAGE="fra",URI="subtitles/fra_forced/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Español",AUTOSELECT=YES,FORCED=NO,LANGUAGE="spa",URI="subtitles/spa/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Español (Forced)",AUTOSELECT=YES,FORCED=YES,LANGUAGE="spa",URI="subtitles/spa_forced/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="日本人",AUTOSELECT=YES,FORCED=NO,LANGUAGE="jpn",URI="subtitles/jpn/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="日本人 (Forced)",AUTOSELECT=YES,FORCED=YES,LANGUAGE="jpn",URI="subtitles/jpn_forced/prog_index.m3u8"

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=263851,CODECS="mp4a.40.2, avc1.4d400d",RESOLUTION=416x234,AUDIO="bipbop_audio",SUBTITLES="subs"
gear1/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=28451,CODECS="avc1.4d400d",URI="gear1/iframe_index.m3u8"

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=577610,CODECS="mp4a.40.2, avc1.4d401e",RESOLUTION=640x360,AUDIO="bipbop_audio",SUBTITLES="subs"
gear2/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=181534,CODECS="avc1.4d401e",URI="gear2/iframe_index.m3u8"

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=915905,CODECS="mp4a.40.2, avc1.4d401f",RESOLUTION=960x540,AUDIO="bipbop_audio",SUBTITLES="subs"
gear3/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=297056,CODECS="avc1.4d401f",URI="gear3/iframe_index.m3u8"

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1030138,CODECS="mp4a.40.2, avc1.4d401f",RESOLUTION=1280x720,AUDIO="bipbop_audio",SUBTITLES="subs"
gear4/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=339492,CODECS="avc1.4d401f",URI="gear4/iframe_index.m3u8"

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1924009,CODECS="mp4a.40.2, avc1.4d401f",RESOLUTION=1920x1080,AUDIO="bipbop_audio",SUBTITLES="subs"
gear5/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=669554,CODECS="avc1.4d401f",URI="gear5/iframe_index.m3u8"

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=41457,CODECS="mp4a.40.2",AUDIO="bipbop_audio",SUBTITLES="subs"
gear0/prog_index.m3u8

Change History (5)

comment:1 Changed 4 years ago by cehoyos

  • Keywords hls added
  • Priority changed from normal to wish
  • Type changed from defect to enhancement
  • Version changed from unspecified to git-master

comment:2 Changed 4 years ago by klpu

When add this feature?

comment:3 Changed 4 years ago by Underground78

  • Cc underground78@gmail.com added

comment:4 Changed 4 years ago by anssi

Alternative audio support has been added in git master now, along with other HLS improvements.

Subtitle support is still work-in-progress.

There is a WIP branch with subtitle support at https://github.com/anssih/FFmpeg/tree/hls , but it will probably have to be rewritten before merging in since it is somewhat hacky.

comment:5 Changed 4 years ago by anssi

  • Cc anssi.hannula@iki.fi added
Note: See TracTickets for help on using tickets.