Commit Graph

60 Commits

Author SHA1 Message Date
Steven Liu 2c21e8b1a4 lavf/hls: add hls_ts_option
Same as COMMITID 4f5493fe23.

Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2014-09-16 16:30:03 +02:00
Mika Raento f685f7d7a8 hlsenc: single_file, support HLS ver 4 byteranges
This adds a new option -hls_flags single_file that creates one .ts file
for HLS and adds byteranges to the .m3u8 file, instead of creating one
.ts file for each segment.

This is helpful at least for storing large number of videos, as the
number of files per video is drastically reduced and copying and storing
those files takes less requests and inodes.

This is based on work by Nicolas Martyanoff, discussed on ffmpeg-devel
in July 2014. That patch seems abandoned by the author, and contained
unrelated changes. This patch tries to add the minimum amount of code to
support the byterange playlists.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-15 22:16:44 +02:00
Nicolas Martyanoff 467e9d6186 avformat/hlsenc: add some empty lines to make the code easier to read
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 00:33:49 +02:00
Nicolas Martyanoff 706fcffce1 avformat/hlsenc: rename some identifers to make the code easier to read
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 00:31:49 +02:00
Nicolas Martyanoff 53f10e0368 avformat/hlsenc: Add some comments to make the code easier to read
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 00:04:05 +02:00
Nicolas Martyanoff 0c889da8cb avformat/hlsenc: fix cleanup after avformat_write_header()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-29 16:24:11 +02:00
Michael Niedermayer 351b22caae avformat/mux: support re-interleaving packets in ff_write_chained()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 22:39:22 +02:00
Nicolas Martyanoff 6cc1fec412 avformat/hlsenc: correctly compute target duration
With HLS, the duration of all segments must be lower or equal to the target
duration. Therefore floor(duration + 0.5) yields incorrect results.

For example, for duration = 1.35, floor(duration + 0.5) yields 1.0, but the
correct result is 2.0.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2014-07-10 01:31:04 +03:00
Michael Niedermayer be8f96e5eb Merge commit '34e2ce5dde073244ccb2b62f930e96fe612690f7'
* commit '34e2ce5dde073244ccb2b62f930e96fe612690f7':
  hlsenc: Set the default codecs to AAC and H264

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-17 03:13:05 +02:00
Martin Storsjö 34e2ce5dde hlsenc: Set the default codecs to AAC and H264
Most HLS implementation only support these codecs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-05-17 01:34:16 +03:00
Michael Niedermayer 554a1ecab7 Merge commit '7266e24f176389d2e81bfc7c829934f7c8ae361c'
* commit '7266e24f176389d2e81bfc7c829934f7c8ae361c':
  hls: Sync the file number with the start sequence

Conflicts:
	libavformat/hlsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 21:29:04 +02:00
Michael Niedermayer 5b4c8aac97 Merge commit 'a16431034d9bd44182bf844d6bbde2c98bc4e6b5'
* commit 'a16431034d9bd44182bf844d6bbde2c98bc4e6b5':
  hls: Factor the sequence computation

Conflicts:
	libavformat/hlsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 21:14:56 +02:00
Michael Niedermayer 8522dd380b Merge commit 'c7603b3c243331057300337a61464e6ac4a605cb'
* commit 'c7603b3c243331057300337a61464e6ac4a605cb':
  hls: Print start_number as first sequence value

Conflicts:
	libavformat/hlsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 20:52:58 +02:00
Michael Niedermayer f21f969a3f Merge commit '344f7b5a7e0d50573dec402dfe6228676f3889d9'
* commit '344f7b5a7e0d50573dec402dfe6228676f3889d9':
  hls: Report the current media sequence

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 20:03:06 +02:00
Luca Barbato 7266e24f17 hls: Sync the file number with the start sequence 2014-04-30 17:52:49 +02:00
Luca Barbato a16431034d hls: Factor the sequence computation 2014-04-30 17:52:33 +02:00
Luca Barbato c7603b3c24 hls: Print start_number as first sequence value
The option now behaves as expected.
2014-04-30 17:52:17 +02:00
Luca Barbato 344f7b5a7e hls: Report the current media sequence
Useful for debugging mostly.
2014-04-30 17:51:50 +02:00
Michael Niedermayer 217f6c53e5 Merge commit '5a70a783f04919514efec7751d710b64d8975fd7'
* commit '5a70a783f04919514efec7751d710b64d8975fd7':
  hls: Add an option to prepend a baseurl to the playlist entries

Conflicts:
	doc/muxers.texi
	libavformat/hlsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-29 16:37:22 +02:00
Luca Barbato 5a70a783f0 hls: Add an option to prepend a baseurl to the playlist entries
Useful to generate playlists with absolute paths.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-04-29 12:14:11 +02:00
Michael Niedermayer f359bac27c avformat/hlsenc: remove unneeded l prefix from %lf
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-03 00:27:53 +02:00
Senthilnathan M 96b8e7a9cd hlsenc: added floating point time support.
Necessary for HLS version 3 and above.  Fixes ticket #3505.

Signed-off-by: Senthilnathan M <senthil.codr@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-02 23:06:21 +02:00
Senthilnathan M 561bfce203 HLS: Handle the case when hls_list_size=0. Playlist file should contain all the segments. Fixes bug #3376.
Signed-off-by: Senthilnathan M <senthil.codr@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-01 15:13:23 +01:00
Michael Niedermayer d780fdb904 avformat/hlsenc: copy metadata
Fixes Ticket2296

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-12 18:41:39 +01:00
Michael Niedermayer ccdfa3e271 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Add missing #includes for *INT64_MAX and *INT64_C

Conflicts:
	ffmpeg.c
	ffmpeg_filter.c
	ffplay.c
	libavformat/assdec.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-24 05:21:19 +01:00
Diego Biurrun 8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Michael Niedermayer 50c0837801 Merge commit '09c93b1b957f2049ea5fd8fb0e6f4d82680172f2'
* commit '09c93b1b957f2049ea5fd8fb0e6f4d82680172f2':
  hlsenc: Append the last incomplete segment when closing the output

Conflicts:
	libavformat/hlsenc.c

See: 4630dfd1eb
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-16 14:03:44 +02:00
Carl Eugen Hoyos 9d86bfc259 hlsenc: Don't reset the number variable when wrapping
The counter itself shouldn't be wrapped, since it is used for
determining end_pts for the next segment - only wrap the number
used for the segment file name.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-15 22:41:19 +03:00
Stefano Sabatini 09c93b1b95 hlsenc: Append the last incomplete segment when closing the output
Also avoid comparing NOPTS values.

Bug-id: 551
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-15 22:41:18 +03:00
Carl Eugen Hoyos 75b9fb27f5 lavf/hlsenc: fix bogus hls segment index rewrapping logic
The counter should not be reset since it detects the
hls segment increasing timeframe.

Fixes ticket #2643.

Reviewed-by: Stefano Sabatini
2013-06-06 12:09:38 +02:00
Michael Niedermayer 54056c1493 Merge commit 'cf679b9476727a237c8006c685ace18acba149ab'
* commit 'cf679b9476727a237c8006c685ace18acba149ab':
  hls, segment: fix splitting for audio-only streams.

Conflicts:
	libavformat/hlsenc.c
	libavformat/segment.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-28 11:48:40 +02:00
Anton Khirnov cf679b9476 hls, segment: fix splitting for audio-only streams.
CC:libav-stable@libav.org
2013-04-27 10:19:04 +02:00
Stefano Sabatini 4630dfd1eb lavf/hlsenc: append last incomplete segment when closing the output
Also introduce missing check on PTS value in case of NOPTS value.
2013-01-21 19:21:21 +01:00
Michael Niedermayer aed58f6aae Merge commit '92e354b655613b88c3c202a7e19e7037daed37eb'
* commit '92e354b655613b88c3c202a7e19e7037daed37eb':
  rtpdec_vp8: Set the timestamp when returning a deferred packet
  hlsenc: Make the start_number option set the right variable

Conflicts:
	libavformat/hlsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 11:26:31 +01:00
Kanglin ba8cb33273 hlsenc: Make the start_number option set the right variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-08 17:33:56 +02:00
Michael Niedermayer 384dd9804d Merge commit '30a76487304e7250294c9c0e9fa179bf07fd822a'
* commit '30a76487304e7250294c9c0e9fa179bf07fd822a':
  hlsenc: make segment number unsigned
  hlsenc: make EXT-X-MEDIA-SEQUENCE always increase

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-30 14:21:55 +01:00
Michael Niedermayer 56c71cd599 Merge commit '9b1370aced385698bc783747917544ab69ecb373'
* commit '9b1370aced385698bc783747917544ab69ecb373':
  hlsenc: do not add timestamps in different timebases
  hlsenc: use the correct AV_TIME_BASE macro

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-30 14:11:17 +01:00
Michael Niedermayer 19e1c8e4f2 Merge commit '0448f26c97c5ab4858d31e456a4f1738ae783242'
* commit '0448f26c97c5ab4858d31e456a4f1738ae783242':
  hlsenc: keep the playlist to the correct number of items
  hlsenc: use the segment filename in the playlist entry

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-30 14:02:19 +01:00
Michael Niedermayer 2ce43b37fc Merge commit '6dd93ee6f1b050ad7c4b247899e83efa293ee405'
* commit '6dd93ee6f1b050ad7c4b247899e83efa293ee405':
  hlsenc: check append_entry return value
  hlsenc: use the basename to generate the list entries
  avstring: add av_basename and av_dirname

Conflicts:
	Changelog
	doc/APIchanges
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-30 13:54:50 +01:00
Luca Barbato 30a7648730 hlsenc: make segment number unsigned
It will overflow if somebody keeps streaming for a time long enough.
2012-12-29 17:26:30 +01:00
Luca Barbato 9b1370aced hlsenc: do not add timestamps in different timebases
start_time is in stream timebase units while end_time is
in AV_TIME_BASE ones.
2012-12-29 17:26:30 +01:00
Luca Barbato 0448f26c97 hlsenc: keep the playlist to the correct number of items
Consider the corner case with a list size larger than the wrap
number.
2012-12-29 17:26:30 +01:00
Kanglin 27a15e0af6 hlsenc: make EXT-X-MEDIA-SEQUENCE always increase 2012-12-29 17:26:30 +01:00
Kanglin 0d8cc7a3b2 hlsenc: use the correct AV_TIME_BASE macro
recording_time is in AV_TIME_BASE units.
2012-12-29 17:26:30 +01:00
Luca Barbato 6dd93ee6f1 hlsenc: check append_entry return value 2012-12-29 17:26:29 +01:00
Luca Barbato ae85d6c9c0 hlsenc: use the segment filename in the playlist entry
Avoid calling av_get_frame_filename twice, once to generate the
segment filename and once to generate the playlist.
2012-12-29 17:26:29 +01:00
Luca Barbato 66f7b4862f hlsenc: use the basename to generate the list entries
The segment path is desumed from the playlist path, recording a
relative path in the playlist while serving the file could lead
to misleading results.
2012-12-29 17:26:29 +01:00
Michael Niedermayer c6664242e0 Merge commit 'f5f1cf52240759208b42477e2157a7b4409ade10'
* commit 'f5f1cf52240759208b42477e2157a7b4409ade10':
  oggdec: K&R cosmetic formatting
  hlsenc: correctly report target duration

Conflicts:
	libavformat/oggdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-24 14:43:03 +01:00
Martin Storsjö 4a9f7d2bf9 hlsenc: Don't duplicate a string constant
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-24 00:02:48 +02:00
Stefano Sabatini 3193b13aa1 hlsenc: Allocate enough space for the pattern string
If s->filename doesn't contain any period/filename extension to strip
away, the buffer will be too small to fit both strings. This isn't
any buffer overflow since the concatenation uses av_strlcat with
the right buffer size.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-24 00:02:45 +02:00