2017-11-29 13:44:15 +02:00
|
|
|
/*
|
|
|
|
* Apple HTTP Live Streaming segmenter
|
|
|
|
* Copyright (c) 2012, Luca Barbato
|
|
|
|
* Copyright (c) 2017 Akamai Technologies, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2017-11-29 18:02:37 +02:00
|
|
|
#ifndef AVFORMAT_HLSPLAYLIST_H
|
|
|
|
#define AVFORMAT_HLSPLAYLIST_H
|
2017-11-29 13:44:15 +02:00
|
|
|
|
2017-11-29 18:09:23 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-11-29 13:44:15 +02:00
|
|
|
#include "libavutil/common.h"
|
2017-11-29 18:09:23 +02:00
|
|
|
#include "avformat.h"
|
|
|
|
#include "avio.h"
|
2017-11-29 13:44:15 +02:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
PLAYLIST_TYPE_NONE,
|
|
|
|
PLAYLIST_TYPE_EVENT,
|
|
|
|
PLAYLIST_TYPE_VOD,
|
|
|
|
PLAYLIST_TYPE_NB,
|
|
|
|
} PlaylistType;
|
|
|
|
|
|
|
|
void ff_hls_write_playlist_version(AVIOContext *out, int version);
|
2017-12-29 07:47:12 +02:00
|
|
|
void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup,
|
2019-08-30 05:45:39 +02:00
|
|
|
const char *filename, char *language, int name_id, int is_default);
|
avformat: add subtitle support in master playlist m3u8
Test with the following command for the webvtt subtitle:
$ ./ffmpeg -y -i input_with_subtitle.mkv \
-b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
-b:a:0 256k \
-c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0 -map 0:s:0 \
-f hls -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \
-master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \
10 -master_pl_publish_rate 10 -hls_flags \
delete_segments+discont_start+split_by_time ./tmp/video.m3u8
Check the master m3u8:
$ cat tmp/master.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitle",NAME="subtitle_0",DEFAULT=YES,URI="video_vtt.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33",SUBTITLES="subtitle"
video.m3u8
Check the result by convert to mkv:
$ ./ffmpeg -strict experimental -i ./tmp/master.m3u8 -c:v copy -c:a mp2 -c:s srt ./test.mkv
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-03-29 13:13:44 +02:00
|
|
|
void ff_hls_write_subtitle_rendition(AVIOContext *out, char *sgroup,
|
|
|
|
const char *filename, char *language, int name_id, int is_default);
|
2017-11-29 13:44:15 +02:00
|
|
|
void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
|
2019-08-30 05:45:39 +02:00
|
|
|
int bandwidth, const char *filename, char *agroup,
|
avformat: add subtitle support in master playlist m3u8
Test with the following command for the webvtt subtitle:
$ ./ffmpeg -y -i input_with_subtitle.mkv \
-b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
-b:a:0 256k \
-c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0 -map 0:s:0 \
-f hls -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \
-master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \
10 -master_pl_publish_rate 10 -hls_flags \
delete_segments+discont_start+split_by_time ./tmp/video.m3u8
Check the master m3u8:
$ cat tmp/master.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitle",NAME="subtitle_0",DEFAULT=YES,URI="video_vtt.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33",SUBTITLES="subtitle"
video.m3u8
Check the result by convert to mkv:
$ ./ffmpeg -strict experimental -i ./tmp/master.m3u8 -c:v copy -c:a mp2 -c:s srt ./test.mkv
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-03-29 13:13:44 +02:00
|
|
|
char *codecs, char *ccgroup, char *sgroup);
|
2017-11-29 13:44:15 +02:00
|
|
|
void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,
|
|
|
|
int target_duration, int64_t sequence,
|
2019-06-02 16:03:17 +02:00
|
|
|
uint32_t playlist_type, int iframe_mode);
|
2017-11-29 13:44:15 +02:00
|
|
|
void ff_hls_write_init_file(AVIOContext *out, char *filename,
|
|
|
|
int byterange_mode, int64_t size, int64_t pos);
|
2017-12-04 06:03:37 +02:00
|
|
|
int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
|
2017-11-29 13:44:15 +02:00
|
|
|
int byterange_mode,
|
|
|
|
double duration, int round_duration,
|
|
|
|
int64_t size, int64_t pos, //Used only if HLS_SINGLE_FILE flag is set
|
|
|
|
char *baseurl, //Ignored if NULL
|
2019-06-02 16:03:17 +02:00
|
|
|
char *filename, double *prog_date_time,
|
|
|
|
int64_t video_keyframe_size, int64_t video_keyframe_pos, int iframe_mode);
|
2017-11-29 13:44:15 +02:00
|
|
|
void ff_hls_write_end_list (AVIOContext *out);
|
|
|
|
|
|
|
|
#endif /* AVFORMAT_HLSPLAYLIST_H_ */
|