Commit Graph

243 Commits

Author SHA1 Message Date
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