Commit Graph

390 Commits

Author SHA1 Message Date
Steven Liu
07b4bf5f11 avformat/hlsenc: move the warning message from every segment upload to init part
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-09-06 12:29:56 +08:00
Steven Liu
f267a2ac9c avformat/hlsenc: avformat/hlsenc: reopen new http session for http_persistent
fix ticket: 7975

Tested-by: Ian Klassen <ian@virtualfunc.com>
Suggested-by: Ian Klassen <ian@virtualfunc.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-09-06 10:26:23 +08:00
Limin Wang
75aea52a10 lavf/hlsenc: refine the get_relative_url function to avoid extra malloc for relation path
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-09-02 13:28:08 +08:00
Steven Liu
17576fda65 avformat/hlsenc: remove unused value
CID: 1452644
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-26 11:06:48 +08:00
Steven Liu
80d2a7f5c6 avformat/hlsenc: fix memleak of filename
CID: 1452445
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-26 11:06:36 +08:00
Steven Liu
4ba82ecc12 avformat/hlsenc: fix memleak in hls_write_trailer
fix CID: 1426931

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-26 11:06:24 +08:00
Steven Liu
c66d468795 avformat/hlsenc: avformat/hlsenc: simplified code
simplified code for get dirname string in hls_delete_old_segments

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-21 16:46:35 +08:00
Steven Liu
fa78a6abb3 avformat/hlsenc: simplified code of use_localtime in hls_init
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-21 16:46:31 +08:00
Steven Liu
d1fe1344ea avformat/hlsenc: fix memleak in update_variant_stream_info
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-21 16:46:28 +08:00
Steven Liu
3708a2a909 avformat/hlsenc: reindent code
and remove redundant empty line
2019-08-20 09:56:38 +08:00
Steven Liu
939c17fcb3 avformat/hlsenc: remove unuse comment of the code 2019-08-20 09:45:47 +08:00
Jun Zhao
f36925201c lavf/hlsenc: free the old_filname to avoid memory leak
free the old_filname to avoid memory leak in error handle
path.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-08-20 08:44:42 +08:00
Limin Wang
eccb94c3ba lavf/hlsenc: fix one warning: unused variable 'filename' [-Wunused-variable]
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-08-20 08:23:53 +08:00
Steven Liu
cff309097a avformat/hlsenc: merge mpegts and fmp4 workflow to one workflow
write mpegts or fmp4 context into buffer, and flush the buffer into
output file when split fragment. merge two format split workflow into
one workflow

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-18 08:22:32 +08:00
Steven Liu
23678462c0 avformat/hlsenc: Fix overflow of int for durations compute
Fix ticket: 8037

Reported-by: DusanBrejka
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-29 19:48:06 +08:00
Steven Liu
234a5e058d avformat/hlsenc: use old way for fragment mp4 in HLS PUT method
fix ticket: 8015

Reported-by: Jun Zhao
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-15 21:56:04 +08:00
Steven Liu
33a8cd5925 avformat/hlsenc: use one handler for m3u8 and segments
Use one handler for m3u8 and segments.
Use two handler in byterange mode.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-11 09:38:39 +08:00
Bela Bodecs
1476d82e73 avformat/hlsenc: changing all filename length to MAX_URL_SIZE
Throughout hlsenc code, all filename related buffer lengths are set
hardcoded as 1024. This PATCH change it to general value as MAX_URL_SIZE
in internal.h

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
2019-07-01 10:24:21 +08:00
Bela Bodecs
098ab93257 avformat/hlsenc: temp_file usage for master playlist and vtt playlist
currently master playlist and subtitle playlist creation does not use
temporary files even when temp_file flag is set. Most of the use cases
it is not a problem because master playlist creation happens once on the
beginning of the whole process. But if master playlist is periodically
re-created because of master_pl_refresh_rate is set, non-atomic playlist
creation may cause problems in case of live streaming. This patch
correct this behavior by adding this functionality.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
2019-06-28 13:54:27 +08:00
Derek Buitenhuis
025fcee6fa hlsenc: Add option to set custom HTTP headers
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2019-06-27 12:16:14 +01:00
Bela Bodecs
2045dd0050 avformat/hlsenc: better error log message for var_stream_map content
When multiple variant streams are specified by var_stream_map option,
%v is expected either in the filename or in the last sub-directory name,
but only in one of them. When both of them contains %v string, current
error message only states half of the truth.
And even %v may appears several times inside the last sub-directory name
or in filename pattern.
This patch clarifies this in the log message and in the doc also.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
2019-06-24 17:43:39 +08:00
Bela Bodecs
1beeb3b877 avformat/hlsenc: better checking var_stream_map content
When multiple variant streams are specified by var_stream_map option,
implementation assumes that each elementary stream is assigned only once
to any variant. But this is not checked. This patch makes this checking.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Reviewed-by: Steven Liu<lq@onvideo.cn>
2019-06-22 18:02:42 +08:00
Bodecs Bela
86f04b918c avformat/hlsenc: enhanced %v handling with variant names
When multiple variant streams are specified by var_stream_map option, %v
placeholder in various names ensures that each variant has its unique
names. Currently %v is substituted by its variant index value (0, 1, 2
etc.). In some use cases it would be handy to specify names for variants
instead of numerical indexes. This patch makes it possible to use names
instead of default indexes. In var_stream_map option each or some of the
variant streams may use an optional name attributum (e.g.
-var_stream_map "v:0,a:0,name:sd v:1,a:1,name:720p") If a name is
specified for a variant, then this name value will be used as
substitution value of %v instead of the default index value.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2019-06-20 11:08:04 +08:00
Bodecs Bela
09a4853930 av_format/hlsenc: fix %v handling by format_name function
Hi All,

When multiple variant streams are specified by var_stream_map option, %v
placeholder in various names ensures that each variant has its unique
names. Most of %v handlng is done in format_name function. Currently
in this function the result buffer is the same as the
input pattern buffer, so you must allocate it before calling format_name
function. It also means, that it is silently assumed that the result
string will NOT be
longer that the pattern string. It is true most of the time, because %v
may appear only once in the pattern string and number of variant streams
is less than 100 in practical cases. But theoretically it will fail if
specified number of variant streams is greater than 100 (i.e. longer
than 2 digits).
This patch fixes this behaviour by altering format_name function to
allocate the
result buffer and return it to the caller.

Please, review this patch.

best,

Bela
>From 6377ebee8a106a9684d41b270c7d6c8e57cd3e7b Mon Sep 17 00:00:00 2001
From: Bela Bodecs <bodecsb@vivanet.hu>
Date: Mon, 17 Jun 2019 14:31:36 +0200
Subject: [PATCH] av_format/hlsenc: fix %v handling by format_name function

When multiple variant streams are specified by var_stream_map option, %v
placeholder in various names ensures that each variant has its unique
names. Most of %v handlng is done in format_name function. Currently
in this function the result buffer is the same as the input pattern
buffer, so you must allocate it before calling format_name function. It
also means, that it is silently assumed that the result string will NOT
be longer that the pattern string. It is true most of the time, because
%v may appear only once in the pattern string and number of variant
streams is less than 100 in practical cases. But theoretically it will
fail if specified number of variant streams is greater than 100. This
patch fixes this behaviour by altering format_name function to allocate
the result buffer and return it to the caller.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
2019-06-19 18:03:33 +08:00
Steven Liu
fa7a6dbd76 avformat/hlsenc: add EXT-X-I-FRAMES-ONLY tag support
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-06-14 10:53:23 +08:00
Steven Liu
4ef0bea292 doc/muxers: fix typo of the hls var_stream_map example
And fix typo of the 1833 of hlsenc.c

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2019-06-02 21:53:11 +08:00
Steven Liu
b18c8688dd avformat/hlsenc: flush packets before update split message
fix ticket: 7831

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-04-14 18:45:23 +08:00
Carl Eugen Hoyos
9461e4bc69 lavf: Constify AVOutputFormat pointer. 2019-03-20 18:38:48 +01:00
Steven Liu
9ec1f7634a avformat/hlsenc: fix fmp4_init_filename file name with %v problem
when set option fmp4_init_filename to init_%v.mp4
before patch:
the init file will be init_%v_0.mp4, init_%v_1.mp4
after patch:
the init file will be init_0.mp4, init_1.mp4

Reported-By: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-02-10 14:45:43 +08:00
Steven Liu
1e03d60054 avformat/hlsenc: add var_stream_map LANGUAGE field string parameter
use a:0,agroup:aud_low,default:Yes,language:CHN a:1,agroup:aud_low,language:ENG
        a:2,agroup:aud_high,default:YesYes,language:CHN a:3,agroup:aud_high,language:ENG
        v:0,agroup:aud_low v:1,agroup:aud_high
        create master m3u8 list.

result:
EXTM3U
EXT-X-VERSION:3
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_0",DEFAULT=YES,LANGUAGE="CHN",URI="out_0.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_1",DEFAULT=NO,LANGUAGE="ENG",URI="out_1.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_2",DEFAULT=YES,LANGUAGE="CHN",URI="out_2.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_3",DEFAULT=NO,LANGUAGE="ENG",URI="out_3.m3u8"
EXT-X-STREAM-INF:BANDWIDTH=1170400,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_low"
out_4.m3u8
EXT-X-STREAM-INF:BANDWIDTH=3440800,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_high"
out_5.m3u8

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-31 16:17:11 +08:00
Steven Liu
6a25bb5aa4 avformat/hlsenc: add var_stream_map DEFAULT field status parameter
use a:0,agroup:aud_low,default:Yes a:1,agroup:aud_low,
    a:2,agroup:aud_high,default:Yes a:3, agroup:aud_high,
    v:0,agroup:aud_low v:1,agroup:aud_high
    create master m3u8 list.

result:
EXTM3U
EXT-X-VERSION:3
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_0",DEFAULT=YES,URI="out_0.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_1",DEFAULT=NO,URI="out_1.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_2",DEFAULT=YES,URI="out_2.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_3",DEFAULT=NO,URI="out_3.m3u8"
EXT-X-STREAM-INF:BANDWIDTH=1170400,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_low"
out_4.m3u8
EXT-X-STREAM-INF:BANDWIDTH=3440800,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_high"
out_5.m3u8

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-31 16:17:02 +08:00
Steven Liu
62e8644bca avformat/hlsenc: make the EXT-X-MEDIA NAME field by stream id.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-31 16:16:53 +08:00
Steven Liu
b9523f2fd3 avformat/hlsenc: free variant streams after write all variant streams info
fix ticket: 7631

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-04 13:29:28 +08:00
Steven Liu
cef857da48 avformat/hlsenc: remove unused variable to fix compiler warning
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-12-26 19:29:18 +08:00
Adrian Guzowski
c822d70c3d Fix usage of temp_file flag in hls_flags option.
This is a regression introduced by 223d2bde22.
It appears that regression was introduced in 4.1, 4.0.x does not share
this behaviour.

Temp files were not created for MPEG-TS segments options - HLS_TEMP_FILE
flag was never set on AVFormatContext, it is however set on HLSContext object.
In order to fix this issue, proper flags field must be checked. In addition,
renaming code was messed up and apparently was working only for MP4 files.
2018-12-26 19:25:40 +08:00
Steven Liu
cdbf8847ea avformat/hlsenc: remove duplicate operation at hls_write_header
the options have set when avformat_init_output at hls_mux_init

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-12-24 13:25:58 +08:00
Karthick J
2349260330 avformat/hlsenc : Added an option to ignore IO errors
Useful for long duration runs with network output

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2018-12-10 14:19:23 +08:00
Karthick J
56503a6925 avformat/hlsenc: Handled error from ff_http_do_new_request() function
This patch fixes the segmentation fault issues due to
unhandled errors from ff_http_do_new_request function.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2018-12-10 14:17:55 +08:00
Steven Liu
f9ea493147 avformat/hlsenc: remove the cannot reach result
fix CID: 1441166
because the logic have checked the vtt_dirname before

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-11-25 18:35:57 +08:00
Carl Eugen Hoyos
fc94e9704e lavf/hlsenc: Do not mix declarations and code.
Fixes the following warnings:
libavformat/hlsenc.c: In function 'hls_write_trailer':
libavformat/hlsenc.c:2364:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
                 uint8_t *buffer = NULL;
                 ^~~~~~~
libavformat/hlsenc.c:2372:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
                 int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
                 ^~~
libavformat/hlsenc.c:2379:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
             int range_length = 0;
             ^~~
2018-11-16 22:03:37 +01:00
Steven Liu
43cc2e39c0 avformat/hlsenc: check dirname and fix vtt problem
fix ticket: 7527
check dirname before use it
refine webvtt code in the hls_delete_old_segments

Reported-by: caspy
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-11-12 17:42:12 +08:00
Charles Liu
1ff4bd59df avformat/hlsenc.c: fix the output's duration smaller than input's in sub-range mode.
In fmp4 & sub-range mode, the output's duration always smaller than expected,
because the size of the last #EXT-X-BYTERANGE is too small.

Signed-off-by: Charles Liu <liuchh83@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-10-30 11:11:27 +08:00
Charles Liu
76b8e42c1f avformat/hlsenc.c: the size of init.mp4 is zero.
The size of init.mp4 is zero in fmp4 mode,
when the input duraton smaller than the expected segment time.

fix ticket: 7166

Signed-off-by: Charles Liu <liuchh83@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-10-30 11:10:27 +08:00
Charles Liu
2365f47bf5 avformat/hlsenc.c: remove the useless variable fmp4_init_mode.
Signed-off-by: Charles Liu <liuchh83@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-10-30 11:09:14 +08:00
Charles Liu
e9dbd62cb5 avformat/hlsenc.c: fix memory leak in fmp4 mode.
Signed-off-by: Charles Liu <liuchh83@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-10-30 11:08:29 +08:00
Charles Liu
3d1b795493 avformat/hlsenc: fix the duration of m4s segment is unusually smaller than expected.
In fmp4 mode, the duration of the second m4s segment is
unusually smaller than the expected segment time.

Signed-off-by: Charles Liu <liuchh83@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-10-30 11:07:14 +08:00
Steven Liu
bb660800a5 avformat/utils: move mkdir_p to utils
Because it will be used by avformat/segment.c or other module which
need to automatically create sub-directories operation.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-09-25 21:57:49 +08:00
Steven Liu
fbd8746efa avformat/hlsenc: rename option from use_localtime to strftime
fix ticket: 7393
indent option name to segment

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-09-05 14:08:18 +08:00
Jun Zhao
c4608d225f lavf/hlsenc: fix mixed declarations and code warning.
fix the build warning for "ISO C90 forbids mixed declarations and code"

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-08-22 19:05:08 +08:00
Ronak Patel
223d2bde22 Improve hls VOD mode hls performance problem.
This fixes the creation of the hls manifest in hlsenc.c by writing the
entire manifest at the end for VOD playlists. Live & Event Playlists are unaffected.
This also fixes the behavior with HLS_TEMP_FILE to work correctly when
-hlsflags temp_file is specified, instead of always relying on use_rename, which caused these problems.

Files that would previously take over a week to fragment now take
1 minute on the same hardware. This was a 153 hour audio file (2.2GB of audio).

Signed-off-by: Ronak Patel <ronak2121@yahoo.com>
2018-08-19 09:57:44 +08:00
Steven Liu
bd8a5c6b7c avformat/hlsenc: improve compute after_init_list_dur
fix ticket: 7305
vs->sequence - hls->start_sequence - vs->nb_entries is the
after_init_list_dur fragment numbers
fix the wrong compute way vs->sequence - vs->nb_entries

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-07-11 13:28:14 +08:00
Steven Liu
50df4c958b avformat/hlsenc: support http method for hls fmp4
fix ticket: 7160

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-05-24 11:55:58 +08:00
Aman Gupta
18074b309f avformat/hlsenc: set AVFMT_NODIMENSIONS
Same as previous commit but for mpegts inside HLS.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-12 11:48:46 -07:00
Steven Liu
783df2eb59 avformat/hlsenc: avformat/hlsenc: add error message for encrypt fmp4 mode
and refine the warning message when use both hls_key_info_file and hls_enc

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-04-16 14:35:14 +08:00
Steven Liu
987026adda avformat/hlsenc: add option hls_delete_threshold
When using hls_list_size with hls_flags delete_segments, currently
hls_list_size * 2 +- segments remain on disk. With this new option,
the amount of disk space used can be controlled by the user.

fix ticket: #7131

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-04-13 15:39:49 +08:00
Jun Zhao
f1ccb4dbcf lavf/hlsenc: use ff_get_chomp_line
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-12 16:04:58 +08:00
Bela Bodecs
9825f77ac7 avformat/hlsenc: fix handling of delete_segments when %v is present
When var_stream_map option is used, %v must appear either in segment
name template or in the directory path. This latter case currently is
not handled and delete_segments flag of hls_flags is broken now. This
patch fix this. The root cause of the bug was that HLSSegment struct
only stores the final filename part, but not the final directory path.
Most of the cases, final path info is unneded, It only necessary when
you want to delete old segments (e.g in case of live streaming).
Without variant streams it was unnecessary to store the final directory
path, because all segment were stored into the same directory. But
introducing %v in directory names either require to store the final
directory path into HLSSegment or associate segments with their variant
streams to be able deleting them later. I have choosen the second
solution and introduced a variant index data member into the segment
struct.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2018-04-11 11:15:54 +08:00
Timo Rothenpieler
3914c8e0e6 avformat/hlsenc: initialize saveptrs
av_strtok calls strspn on a non-NULL *saveptr, so not NULL initializing
it is an issue.
Fixes CID #1428568

Reviewed-by: Karthick Jeyapal <kjeyapal@akamai.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-27 06:56:27 +08:00
Jan Ekström
5b31dd1c6b avformat/hlsenc: use stream's maximum bit rate as fall-back advertised rate
Enables having proper bit rate values being written into the master
playlist in case of hard-constrained VBR where the maximum bit
rate utilized is known before hand.

Does the same thing as movenc.c, for example.

Signed-off-by: Jan Ekström <jan.ekstrom@aminocom.com>
2018-03-25 01:07:10 +02:00
Steven Liu
f19b0c6aee avformat/hlsenc: reindent after previous commits
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:17 +08:00
Steven Liu
c8f625f529 avformat/hlsenc: fix fmp4 single init file problem
fix ticket: #7021

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:17 +08:00
Steven Liu
c608669264 avformat/hlsenc: fix memleak problem about fmp4_init_filename
move fmp4_init_filename init in if else for first fmp4_init_filename set
value operation.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:17 +08:00
Steven Liu
10a0436dca avformat/hlsenc: reindent after previous commits
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:09 +08:00
Steven Liu
a92ca3c07c avformat/hlsenc: fix write wrong init file URI string problem
fmp4_init_filename should append after base_output_dirname

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-18 19:05:05 +08:00
Ravindra
6010537956 avformat/hlsenc: Option to set timeout for socket I/O operation
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-14 19:59:34 +08:00
Vishwanath Dixit
9c249110ea avformat/hlsenc: fix for zero EXTINF tag duration
This is the fix for bug https://trac.ffmpeg.org/ticket/7073

Tested-by: Brainiarc7
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2018-03-12 23:17:58 +08:00
Steven Liu
aa294ad00a avformat/hlsenc: add reference stream index for split segment
fix ticket: #7044
Get the first video stream to reference for split segment
when there have more than one video stream

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Reviewed-by: Karthick Jeyapal <kjeyapal@akamai.com>
2018-03-02 10:56:36 +08:00
Bela Bodecs
85e6a33bdf hlsenc: Fixing HLS_TEMP_FILE usage with HLS_SECOND_LEVEL_SEGMENT_...
Currently using HLS_TEMP together with HLS_SECOND_LEVEL_SEGMENT_DURATION
or HLS_SECOND_LEVEL_SEGMENT_SIZE gives error at end of each segment
writing and the final segment file names do not contain the desired
data. This patch fixes this bug by delaying the initilization of
original segment filename after actual temp file renaming will skip the
interfering.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
2018-02-23 21:36:11 +08:00
Marton Balint
45ec2e44be avformat/hls: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Marton Balint
dc5d151568 avformat/hlsenc: use av_bprintf without buffer limit in replace_int_data_in_filename
In preparation for the deprecation of AVFormatContext->filename.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Vishwanath Dixit
1948b76a1b avformat/hlsenc: closed caption tags in the master playlist 2018-01-24 11:42:57 +08:00
Brendan McGrath
2472dbc7a7 avformat/hlsenc: Check that data is set
If codecpar->extradata is not set (for example, when the stream goes
through the 'tee' muxer), then a segfault occurs.
This patch ensures the data variable is not null before attempting
to access it
Before the var_stream_map option was available - I was using the tee
muxer to create each resolution as an individual stream.
When running this configuration after the most recent hlsenc change
I hit a segfault
The most simple command which recreates the segfault is:
ffmpeg -i in.ts -map 0:a -map 0:v -c:a aac -c:v h264 -f tee [select=\'a,v\':f=hls]tv_hls_hd.m3u8

Signed-off-by: Brendan McGrath <redmcg@redmandi.dyndns.org>
2018-01-21 13:16:42 +08:00
Karthick Jeyapal
0afa171f25 avformat/hlsenc: Add CODECS attribute to master playlist 2018-01-19 17:03:09 +08:00
Vishwanath Dixit
41e51fbcd9 avformat/hlsenc: creation of variant streams in subdirectories
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2018-01-02 10:46:48 +08:00
Vishwanath Dixit
e872befdb5 avformat/hlsenc: configurable variant stream index position in filenames 2018-01-02 10:46:17 +08:00
Vishwanath Dixit
26e1efb04f avformat/hlsenc: revamped master playlist url creation logic 2018-01-02 10:45:28 +08:00
Karthick Jeyapal
e8f71ef338 avformat/hlsenc, utils: Moved is_http_proto from hlsenc to utils for re-use
Reviewed-by: Aman Gupta <aman@tmm1.net>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2017-12-29 18:11:09 +08:00
Karthick Jeyapal
8fd2bdd072 avformat/hlsplaylist: Audio rendition's name and defaultness made configurable
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-29 13:47:12 +08:00
Karthick Jeyapal
9e25fe4204 avformat/hlsenc: Modularized audio rendition playlist write to allow reuse
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-29 13:45:31 +08:00
Steven Liu
2aee5a8723 avformat/hlsenc: fix resource leak
fix CID: 1426931 1426929
2017-12-25 23:51:25 +08:00
Karthick Jeyapal
be2da4c522 avformat/hlsenc: Signal http end of chunk(http_shutdown) during hlsenc_io_close()
Currently http end of chunk is signalled implicitly in hlsenc_io_open().
This mean playlists http writes would have to wait upto a segment duration to signal end of chunk causing delays.
This patch will fix that problem and improve performance.
2017-12-25 12:08:06 +08:00
Vishwanath Dixit
d02289c386 avformat/hlsenc:addition of #EXT-X-MEDIA tag and AUDIO attribute
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-23 13:42:00 +08:00
Karthick J
93a0e47876 avformat/hlsenc: set EXT-X-TARGETDURATION use lrint(EXTINF) 2017-12-22 07:43:54 +08:00
Karthick J
3ac76d890d avformat/hlsenc: Fix a memory leak when http_persistent is 1
Reviewed-by: Steven Liu <lq@onvideo.cn>
2017-12-21 11:39:24 +08:00
Steven Liu
7feae7be5b avformat/hlsenc: reindent after previous commits
Reviewed-by: Karthick J <kjeyapal@akamai.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-21 11:17:08 +08:00
Steven Liu
8318f60845 avformat/hlsenc: fix first fragment mp4 do not split bug
fix ticket id: 6888

Tested-by: beloko <beloko@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-21 11:14:32 +08:00
Karthick J
b2d27d912b avformat/hlsenc: Extend persistent http connections to playlists
Before this patch persistent http connections would work only for media segments.
The playlists were still opening a new connection everytime.
This patch extends persistent http connections to playlists as well.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-15 22:15:07 +08:00
Karthick J
6ae18228cd avformat/hlsenc: Handle NULL input in IO open and close utility functions
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-15 22:14:54 +08:00
Karthick J
deceb7d9ae avformat/hlsenc: Call avio_flush during persistent http connections
Since close is not called, during http persistent connection,
flush needs to be called so that output is written on time.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-15 22:14:43 +08:00
Steven Liu
0e5260226a avformat/hlsenc: reindent after previous commits 2017-12-12 11:50:23 +08:00
Steven Liu
08d28ee182 avformat/hlsenc: move init operations from write_header to init
Reviewed-by: Vishwanath Dixit <vdixit@akamai.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-11 11:03:25 +08:00
Steven Liu
d67c1dda40 avformat/hlsenc: fix compiling error when disable-network 2017-12-04 23:52:17 +08:00
Steven Liu
071f47649c avformat/hlsplaylist: add int type of API ff_hls_write_file_entry
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-04 12:03:37 +08:00
Robert Nagy
31b351ea81 avformat/hlsenc: fix baseurl missing last char
Reviewed-by: Steven Liu <lq@onvideo.cn>
2017-12-04 12:00:13 +08:00
Karthick J
3684b5e56a avformat/hlsenc: Refactored 'get_int_from_double' function to allow reuse 2017-11-30 10:54:54 +08:00
Karthick J
da49cdf640 avformat/hlsenc: Modularized playlist creation to allow reuse 2017-11-29 19:44:15 +08:00
Jeyapal, Karthick
815e34b5b4 libavformat/hlsenc: Persistent HTTP connections supported as an option 2017-11-29 14:33:07 +08:00
Karthick J
d5d2632e3a avformat/hlsenc: Fixed initial setting for end_pts
This patch fixes Bug #6868
Sometimes end_pts is getting initialized to audio stream's
first pts, while the duration is calculated based on video stream's pts.
In this patch the end_pts is initialized with the correct stream's first pts.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Tested-by: beloko
2017-11-28 20:03:15 +08:00
Karthick J
efb51c8ebb avformat/hlsenc: Added option to add EXT-X-INDEPENDENT-SEGMENTS tag 2017-11-24 06:57:36 +08:00
Karthick J
241c1192d6 avformat/hlsenc: Refactor an inconsistent variable name 2017-11-24 06:42:35 +08:00
Karthick J
f335efc0ad avformat/hlsenc: Minor fix in setting http options for master playlist 2017-11-24 06:41:25 +08:00
Steven Liu
25aff9d820 avformat/hlsenc: use FFABS to instead of abs
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-11-20 10:51:57 +08:00
Vishwanath Dixit
77ab1d7bae avformat/hlsenc: creation of hls master playlist file
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2017-11-20 10:04:34 +08:00
Vishwanath Dixit
92a32d0747 avformat/hlsenc: creation of hls variant streams in a single hlsenc instance
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2017-11-20 10:02:11 +08:00
Steven Liu
880b299381 avformat/hlsenc: write fmp4 init header after first AV frame
fix ticket id: 6825

Signed-off-by: Steven Liu <lq@onvideo.cn>
Tested-by: Aman Gupta <aman@tmm1.net>
2017-11-14 10:31:26 +08:00
Timo Rothenpieler
3ee63f3fb7 avformat/hlsenc: allocate space for terminating null
Fixes CID #1420394
2017-11-13 10:44:16 +08:00
Steven Liu
c7360512c2 avformat/hlsenc: reindent hlsenc code
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-11-02 22:30:06 +08:00
Steven Liu
c52beb4839 avformat/hlsenc: check hls segment mode for ignore the init filename
ignore the fmp4_init_filename when in normal hls segment mode

Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-11-02 22:29:28 +08:00
Steven Liu
073986c5ae avformat/hlsenc: reindent hlsenc code
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-10-29 12:32:24 +08:00
Steven Liu
c3e279e752 avformat/hlsenc: fix missing first segment bug in fmp4 mode
fix ticket id: #6776
fix code logic error, need not check first segment.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-10-29 12:31:49 +08:00
Steven Liu
f520830761 avformat/hlsenc: fix base_output_dirname is null when basename_size is 0 bug
fix ticket id: #6777
when use argument hls_segment_filename, the basename_size will be 0

Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-10-29 12:30:44 +08:00
Steven Liu
c34c0e3a64 avformat/hlsenc: support http method for hls fmp4 init file
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-09-21 23:10:57 +08:00
Steven Liu
7e9cdd3f49 avformat/hlsenc: fix CID 1418106
fix the "Uninitialized scalar variable (UNINIT)" problem.

Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-09-21 23:08:00 +08:00
Aman Gupta
73bf0f42e3 avformat/hlsenc: fix segfault when using -hls_segment_type fmp4 with -hls_segment_filename
previously, specifying -hls_segment_filename meant
s->base_output_dirname was never set, causing a segfault:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x00007fffbf7d82d0 libsystem_platform.dylib`_platform_strcmp + 80
frame #1: 0x00000001005f4dcf libavformat.57.dylib`io_open_default(s=0x000000010481cc00, pb=0x0000000104806020, url=0x0000000000000000, flags=2, options=0x0000000000000000) at options.c:107
frame #2: 0x0000000100528968 libavformat.57.dylib`hls_mux_init(s=0x000000010481cc00) at hlsenc.c:595
frame #3: 0x00000001005273cb libavformat.57.dylib`hls_write_header(s=0x000000010481cc00) at hlsenc.c:1518
frame #4: 0x00000001005c08d0 libavformat.57.dylib`write_header_internal(s=0x000000010481cc00) at mux.c:486
frame #5: 0x00000001005c0774 libavformat.57.dylib`avformat_write_header(s=0x000000010481cc00, options=0x00000001029026e8) at mux.c:539
2017-09-16 10:32:28 +08:00
Karthick J
837c55e072 avformat/hlsenc: Added configuration to override HTTP User-Agent
Signed-off-by: Karthick J <kjeyapal@akamai.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-09-05 23:30:52 +08:00
Steven Liu
20a6b198b4 avformat/hlsenc: move free fmp4_init_filename after hls_window operation
fix ticket id: 6599

Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-08-22 10:21:42 +08:00
DeHackEd
eabeb9093a avformat/hlsenc: allow dynamic encryption key rotation
Makes behaviour of 805ce25b1d optional, re-enables
HLS key rotation feature

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: DHE <git@dehacked.net>
2017-08-06 15:10:35 +08:00
Steven Liu
738b29cfb6 avformat/hlsenc: support fmp4 single file mode
add byterange mode of the hls fmp4

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-08-04 21:38:55 +08:00
Steven Liu
805ce25b1d avformat/hlsenc: improve hls encrypt get key file operation
get key file only once time is ok, no need more times.
Ticket-id: #6545

Found-by: JohnPi
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-07-25 10:31:29 +08:00
Steven Liu
f21457f8e0 avformat/hlsenc: fix hls fmp4 extention name bug
ticket-id: #6541
when use hls fmp4 muxer, the extention name is not .m4s, this
code can fix it.

Found-by: JohnPi
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-07-24 19:55:19 +08:00
Derek Buitenhuis
2d417076a2 avformat/hlsenc: Add missing error check
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-07 10:08:18 +08:00
Steven Liu
23e21130bb avformat/hlsenc: add warn message when use both fmp4 and single_file
have not implementation the fmp4 single file yet before this commit.

Suggested-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-07-07 10:05:54 +08:00
Steven Liu
1fe40e73a6 avformat/hlsenc: copy codec_tag when stream copy
when use fmp4 segment type in hls and use codec copy,
there have an error message.
error message:
   [mp4 @ 0x25df020] Tag avc1 incompatible with output codec id '28' ([33][0][0][0])
   [hls @ 0x2615c80] Some of the provided format options in '(null)' are not recognized
   Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
this patch can fix it.

Signed-off-by: Liu Qi <w_liuqi@kingsoft.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-07-05 11:20:21 +08:00
Steven Liu
d01b8f8683 avformat/hlsenc: optimize help message default value.
show the hls_segment_type default always 0, show the flag name better

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-07-05 11:15:20 +08:00
Steven Liu
274bd1670b avfomat/hlsenc: support fmp4 format in hls
add the fmp4 format into hlsenc
because the fmp4 format add into hls from version 7.
the spec link is:
https://tools.ietf.org/html/draft-pantos-http-live-streaming-20
and the describe on WWDC
https://developer.apple.com/videos/play/wwdc2017/515/

Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-07-03 20:20:44 +08:00
Steven Liu
3996ae9302 avformat/hlsenc: donnot show duplicate segment warning at byterange mode
When the hlsenc at BYTERANGE mode, it should not show the warning message:
"Duplicated segment filename detected:"

Reported-by: Marco <marco@worldcast.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-06-19 10:35:41 +08:00
Steven Liu
7355c1dda2 avformat/hlsenc: move old_filename free operation earlier
Suggested-by: Aaron Levinson <alevinsn@aracnet.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-05-11 10:15:08 +08:00
Steven Liu
cbfd44a922 avformat/hlsenc: fix CID 1405135
Fixes Coverity CID: 1405135

Reviewed-by: Rodger Combs <rodger.combs@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-28 10:18:44 +08:00
Steven Liu
363e4f0810 avformat/hlsenc: hold old key info when append list
fix ticket id: #6353

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-28 10:17:40 +08:00
Steven Liu
5caaa3a49e avformat/hlsenc: add hls encrypt options
refer to:
https://git.libav.org/?p=libav.git;a=commitdiff;h=0a4b9d0ccd10b3c39105f99bd320f696f69a75a2
add hls encrypt options looks like libav's libavformat/hlsenc.c

Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-14 23:30:29 +08:00
Steven Liu
e90ad88281 avformat/hlsenc: fix duration wrong when no pkt duration
when cannot get pkt duration, hlsenc segments duration will
be set to 0, this patch can fix it.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-03-15 07:37:11 +08:00
Steven Liu
d3ce067e76 avformat/hlsenc: fix ticket 6231
check if the hls_flags is byterange_mode and check if should close fd

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-03-14 10:16:00 +08:00
Steven Liu
33e997d992 avformat/hlsenc: second_levels flags process function extract
the SECOND_LEVEL* flags process and name is too long
extract all of them output to funtions, make code clear

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-03-13 11:58:34 +08:00
Steven Liu
4507f29e4a avformat/hlsenc: move the segment files handler close to before temp flags process
fix ticket: #6204

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-03-04 09:27:56 +08:00
Hendrik Leppkes
3aef2fceff avformat/hlsenc: don't use %s for strftime on msvc
MSVC doesn't support the %s time format, and instead of returning an
error the invalid parameter handler is invoked which (by default)
terminates the process.

Reviewed-by:Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2017-02-25 11:23:50 +08:00
Steven Liu
f73ef3748e avformat/hlsenc: fix hls_flags temp_file bug
refer to ticket id: #6170

rename file from temp to origin name after complete current segment

Reviewed-by: Aman Gupta <ffmpeg@tmm1.net>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-02-25 10:59:05 +08:00
Steven Liu
0c0aef1caf avformat/hlsenc: fix cid 1401346 Dereferencing pointer error
check if proto is null before av_strcasecmp
CID:  1401346

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-02-21 23:38:39 +08:00
Steven Liu
965f35b111 avformat/hlsenc: set default http method to PUT when method is null
When the http method is not set, the method will use POST for ts,
PUT for m3u8, it is not unify, now set it unify.
This ticket id: #5315

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-02-18 09:42:51 +08:00
Bela Bodecs
2b9f92fcc5 avformat/hlsenc: fix stream level metadata handling
hls-encoder currenlty does not provide stream level metadata to mpegts
muxer. This patch fixes track #3848 bug.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-02-13 07:33:48 +08:00
Steven Liu
d96ebc5ef8 avformat/hlsenc: deprecate hls_wrap option
When user use the hls_wrap, there have many problem:
1. some platform refersh the old but usefull segment
2. CDN(Content Delivery Network) Deliver HLS not friendly

The hls_wrap is used to wrap segments for use little space,
now user can use hls_list_size and hls_flags delete_segments
instead it.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-02-11 12:32:31 +08:00
Aman Gupta
606eac7b07 avformat/hlsenc: add hls_flag option to write segments to temporary file until complete
Adds a `-hls_flags +temp_file` which will write segment data to
filename.tmp, and then rename to filename when the segment is complete.

This patch is similar in spirit to one used in Plex's ffmpeg fork, and
allows a transcoding webserver to ensure incomplete segment files are
never served up accidentally.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Bodecs Bela <bodecsb@vivanet.hu>
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-02-07 11:58:43 +08:00
Steven Liu
1033f56b07 avformat/hlsenc: improve to write m3u8 head block
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-24 22:25:29 +08:00
Steven Liu
2f7cc21b61 avformat/hlsenc: refine the code readable for time unit
Reviewed-by: Bodecs Bela <bodecsb@vivanet.hu>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-24 12:29:01 +08:00
Steven Liu
1c1031003b avformat/hlsenc: fix too many open files bug
When use http method to delete the old segments,
there is only io_open, hove not io_close yet,
this patch is used to fix it

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-20 12:12:02 +08:00
Steven Liu
b05d0274ce avformat/hlsenc: fix bug of hlsenc http delete old segments
when push hls to http server, the old segemnts can not delete by hls formats.
so add the http option into hls_delete_old_segments

Reported-by: Yin Jiaoyuan <yinjiaoyuan@163.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-19 07:06:50 +08:00
Steven Liu
83a9cf3603 avformat/hlsenc: remove debug message used error level log
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-18 23:18:41 +08:00
Steven Liu
3222786c5a avformat/hlsenc: refine the hlsenc code
because the oc have been  potint to hls->avf or hls->vtt_avf
here is not needed point once again

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-13 07:59:48 +08:00
Steven Liu
b97e9cba0b avformat/hlsenc: fix hlsenc bug at windows system
when hlsenc use flag second_level_segment_index,
second_level_segment_size and second_level_segment_duration,
the rename is ok but the output filename always use the old filename
so move the rename operation after the close the ts file and
before open new segment

Reported-by: Christian Johannesen <chrisjohannesen@gmail.com>
Reviewed-by: Bodecs Bela <bodecsb@vivanet.hu>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-13 07:57:22 +08:00
Nicolas George
57789cfb9d lavf/hlsenc: fix typo in last commit. 2017-01-12 14:01:22 +01:00
Bodecs Bela
8811d6d9a0 avformat/hlsenc: hls_start_number_source and start_number
start_number option starts the playlist sequence number
(#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags
single_file is set, it also specifies starting sequence numbers of
segment and subtitle filenames. Sometimes it is usefull to have unique
starting numbers at each run, but currently it is only achiveable by
setting this parameter manually.
This patch enables to specify start_number source parameter by
introducing hls_start_number_source with 3 possible values:
generic/epoch/datetime. This ensures to set start sequence number
automatically for practically unique numbers. Generic option is the
default and this is the curent behaviour: start_number option value
specifies the start sequence number. (start_number default value is 0)
If hls_start_number_source is set to epoch, then the start number will
be the seconds since epoch (1970-01-01 00:00:00). If set to datetime,
then the start sequence number will be based on the current date/time
value as YYYYmmddHHMMSS. e.g. 20161231235659.
Hls speficication allows 64 bit integers as sequence numbers. This patch
also changes some code where only 32 bit integer values were handled
correctly.

Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-12 20:43:10 +08:00