1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

115 Commits

Author SHA1 Message Date
Steven Liu
1cfde7abd0 avformat/dashenc: add avpriv_io_move return value check
fix cid: 1424883

Suggested-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-04 12:06:26 +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
Karthick J
8c2b37e678 avformat/dashenc: Option to generate hls playlist as well
This is to take full advantage of Common Media Application Format(CMAF).
Now server can generate one content and serve both HLS and DASH players.

Reviewed-by: Steven Liu <lq@onvideo.cn>
2017-11-30 10:55:51 +08:00
Karthick J
a1f8f1340a avformat/dashenc: Associate mpd extension with dash muxer
Reviewed-by: 刘歧 <lq@chinaffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-25 02:32:33 +01:00
Karthick J
d24e08e978 avformat/dashenc: Added configuration to override HTTP User-Agent
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-21 03:13:03 +01:00
James Cowgill
0ecb1c53c8 avformat/dashenc: fix min_seg_duration option size
In the DASHContext structure, min_seg_duration is declared as an int,
but the AVOption list claimed it was an INT64. Change the option list
to use the correct size, which should fix some initialization errors
seen on big-endian platforms.

Signed-off-by: James Cowgill <jcowgill@debian.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-19 04:38:29 +01:00
James Almer
362372c46b Merge commit '4723c6226aa1ece4099338cc9b38a9cef4fa4846'
* commit '4723c6226aa1ece4099338cc9b38a9cef4fa4846':
  dashenc: fix bitrate estimation with correct scaling

Merged-by: James Almer <jamrial@gmail.com>
2017-11-12 00:15:57 -03:00
Peter Große
3c838e6442 dashenc: copy stream frame rate to output stream
Leads to setting of DefaultDuration in Matroska muxer based on frame rate instead of timebase.
Fixes playback in Chrome.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-29 18:28:40 +01:00
Anton Schubert
fe334712dd dashenc: Don't output frameRates at both AS and Representation-level. Only output maxFrameRate at AS-level.
Fix conformance regarding section "3.2.4. Presence of Attributes and
Element" of the "Guidelines for Implementation: DASH-IF Interoperability
Points V4.1" (http://dashif.org/guidelines/)

Signed-off-by: Anton Schubert <ischluff@mailbox.org>
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-29 18:28:40 +01:00
Peter Große
2911dabd51 dashenc: allow AdaptationSets to have different average frame rates
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-29 18:28:40 +01:00
Peter Große
1443859a8d dashenc: don't write header data before the first packet arrives
Fixes: 1b8ef01f04 ("dashenc: add webm support")
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-29 18:28:40 +01:00
Peter Große
44ede215b6 dashenc: set DASH related options for the subsequent matroska muxer when using webm
This patch is inspired by the ffmpeg webm_chunk muxer and fixes that all resulting
tracks have the same track number.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-29 18:28:40 +01:00
Anton Schubert
3dca4887ae dashenc: fix bitrate estimation with correct scaling
Signed-off-by: Anton Schubert <ischluff@mailbox.org>
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-29 18:28:40 +01:00
Peter Große
8edb9d4572 dashenc: move UTCTiming element to the end of the manifest
Required by comformance XSD [1].

[1] https://github.com/Dash-Industry-Forum/Conformance-and-reference-source/blob/master/conformance/MPDValidator/schemas/DASH-MPD.xsd

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-28 20:24:04 +02:00
Peter Große
3606c11417 dashenc: use av_dict_set_int instead of static function
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-28 20:24:04 +02:00
Anton Schubert
4723c6226a dashenc: fix bitrate estimation with correct scaling
Signed-off-by: Anton Schubert <ischluff@mailbox.org>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-10-27 19:52:48 +02:00
Rodger Combs
1b8ef01f04 Merge commit '7295b7373862ee54903b33d6ef3335531dfa93ad'
* commit '7295b7373862ee54903b33d6ef3335531dfa93ad':
  dashenc: add webm support

Merged-by: Rodger Combs <rodger.combs@gmail.com>
2017-09-26 14:13:09 -03:00
Rodger Combs
a9f51d19d6 Merge commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7'
* commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7':
  dashenc: use avio_dynbuf instead of packet_write callback

Merged-by: Rodger Combs <rodger.combs@gmail.com>
2017-09-26 14:12:19 -03:00
Rodger Combs
5c9373385d Merge commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e'
* commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e':
  dashenc: copy language and role metadata from streams assigned to sets

Merged-by: Rodger Combs <rodger.combs@gmail.com>
2017-09-26 14:11:50 -03:00
Rodger Combs
3f7a8bb67b Merge commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115'
* commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115':
  dashenc: default to one AdaptationSet per stream

Merged-by: Rodger Combs <rodger.combs@gmail.com>
2017-09-26 14:11:25 -03:00
Rodger Combs
c0fae3ff90 Merge commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99'
* commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99':
  dashenc: allow assigning all streams of a media type to an AdaptationSet

Merged-by: Rodger Combs <rodger.combs@gmail.com>
2017-09-26 14:11:02 -03:00
Rodger Combs
777d53c793 Merge commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61'
* commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61':
  dashenc: add support for assigning streams to AdaptationSets

Merged-by: Rodger Combs <rodger.combs@gmail.com>
2017-09-26 14:10:30 -03:00
Rodger Combs
3b9ef13588 Merge commit '9df9309d233f59d9706444a1e24ac24139f2640d'
* commit '9df9309d233f59d9706444a1e24ac24139f2640d':
  dashenc: calculate stream bitrate from first segment if not available

Merged-by: Rodger Combs <rodger.combs@gmail.com>
2017-09-26 14:02:44 -03:00
James Almer
52223ffe44 Revert "lavf/dashenc: update bitrates on dash_write_trailer"
This reverts commit 89c0fda5f4.

A different solution will be committed instead.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-26 13:59:56 -03:00
Steven Liu
837580f458 avformat/dash: move reused API to common file and header file
move from dashenc, move DASHTmplId and dash_fill_tmpl_params to
dash.c, they will be used by dash demuxer and dash muxer.

v2 fixed:
1. rename common file from dashcomm.* to dash.*
Suggested-by: Hendrik Leppkes <h.leppkes@gmail.com>

v3 fixed:
1. rename header file pre defined
2. add ff_ prefix for the internal API
Suggested-by: James Almer <jamrial@gmail.com>

Suggested-by: Timo Rothenpieler <timo@rothenpieler.org>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-09-01 10:20:56 +08:00
Martin Storsjö
d086e40459 lavf: Remove codec_tag from dashenc and smoothstreamingenc
Skip the codec_tag altogether here, to let the user (try to) set
whichever codec/tag is preferred; the individual chained muxer will
reject invalid codecs anyway.

(cherry picked from commit 61f589e31e)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-04 15:47:10 -04:00
Martin Storsjö
61f589e31e lavf: Remove codec_tag from dashenc and smoothstreamingenc
Currently, the tags enforced and set on the segmenter muxer level
mismatch what the mp4/ismv muxer uses (since 713efb2c0d).

Skip the codec_tag altogether here, to let the user (try to) set
whichever codec/tag is preferred; the individual chained muxer will
reject invalid codecs anyway.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-07-02 22:42:26 +03:00
Clément Bœsch
1a950f32ab Merge commit 'e519dcd937c7c98815ba9884867590e302272016'
* commit 'e519dcd937c7c98815ba9884867590e302272016':
  dashenc: separate segments based on current segment duration

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:55:22 +02:00
Clément Bœsch
e815111367 Merge commit '1920382aa9f21d7ed1a3c2214990da8d2b067a92'
* commit '1920382aa9f21d7ed1a3c2214990da8d2b067a92':
  dashenc: add option to provide UTC timing source

Also use E instead of AV_OPT_FLAG_ENCODING_PARAM to be consistent with
the other AVOption.

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:53:36 +02:00
Clément Bœsch
ba3adea957 Merge commit '3c2717e48dd8c5115f2be35c2afcabd8a1f67aee'
* commit '3c2717e48dd8c5115f2be35c2afcabd8a1f67aee':
  dashenc: increase buffer time hint in the manifest

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:39:10 +02:00
Clément Bœsch
77a20cff36 Merge commit '95f1004bdfdf2d26c330c1d4b7c4ac9352d60b18'
* commit '95f1004bdfdf2d26c330c1d4b7c4ac9352d60b18':
  dashenc: add mandatory id to AdaptationSet and Period in manifest

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:37:04 +02:00
Clément Bœsch
93bf0480c2 Merge commit '1ae6cb7d6e4fee30754a46bc91f40ff75ac4412a'
* commit '1ae6cb7d6e4fee30754a46bc91f40ff75ac4412a':
  dashenc: fix ISO8601 UTC parsing

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:32:20 +02:00
Clément Bœsch
549045254c Fix all -Wformat warnings raised by DJGPP 2017-03-29 14:49:29 +02:00
Przemysław Sobala
89c0fda5f4 lavf/dashenc: update bitrates on dash_write_trailer
Provides a way to change bandwidth parameter inside DASH manifest after a non-CBR H.264 encoding.
Caller now is able to compute the bitrate by itself, after all packets have been written, and then set that value in AVFormatContext->streams->codecpar->bit_rate before calling av_write_trailer. As a result that value will be set in DASH manifest.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-11 16:43:43 +01:00
Thomas Stephens
5fe2b43702 avformat/dashenc: Only use temporary files when outputting to file protocol
Skips using temporary files when outputting to a protocol other than
"file", which enables dash to output content over network
protocols. The logic has been copied from the HLS format.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-14 17:00:30 +01:00
Peter Große
7295b73738 dashenc: add webm support
Use webm muxer for VP8, VP9 and Opus codec, mp4 muxer otherwise.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:45:27 +02:00
Peter Große
01f1f017d8 dashenc: use avio_dynbuf instead of packet_write callback
The dash_write function drops data, if no IOContext is initialized.

Since the mp4 muxer is used in "frag_custom" mode, data is only
written when calling av_write_frame(NULL) explicitly and thus
there will be no data loss.

To add support for webm as subordinate muxer, which doesn't have
such a mode, a dynamic buffer is required to provide an always
initialized IOContext.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:38:29 +02:00
Peter Große
dce2929efa dashenc: copy language and role metadata from streams assigned to sets
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:38:28 +02:00
Peter Große
ca9bc9de69 dashenc: default to one AdaptationSet per stream
Previously all mapped streams of a media type (video, audio) where assigned
to a single AdaptationSet. Using the DASH live profile it is mandatory, that
the segments of all representations are aligned, which is currently not
enforced. This leads to problems when using video streams with different
key frame intervals. So to play safe, default to one AdaptationSet per stream,
unless overwritten by explicit assignment.

To get the old assignment scheme, use

  -adaptation_sets "id=0,streams=v id=1,streams=a"

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:33:07 +02:00
Peter Große
efd2fc41b3 dashenc: allow assigning all streams of a media type to an AdaptationSet
Using the characters "v" or "a" instead of stream index numbers for assigning
streams in the adaption_set option, all streams matching that given type will
be added to the AdaptationSet.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:24:14 +02:00
Peter Große
3d23a5f96a dashenc: add support for assigning streams to AdaptationSets
Also makes sure all streams are assigned to exactly one AdaptationSet.

This patch is originally based partially on code by Vignesh Venkatasubramanian.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:22:00 +02:00
Peter Große
9df9309d23 dashenc: calculate stream bitrate from first segment if not available
Bandwidth information is required in the manifest, but not always
provided by the demuxer. In that case calculate the bandwith based
on the size and duration of the first segment.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:08:21 +02:00
Peter Große
e519dcd937 dashenc: separate segments based on current segment duration
The current implementation creates new segments comparing

  pkt->pts - first_pts > nb_segs * min_seg_duration

This works fine, but if the keyframe interval is smaller than "min_seg_duration"
segments shorter than the minimum segment duration are created.

Example: keyint=50, min_seg_duration=3000000
 segment 1 contains keyframe 1 (duration=2s <  total_duration=3s)
                and keyframe 2 (duration=4s >= total_duration=3s)
 segment 2 contains keyframe 3 (duration=6s >= total_duration=6s)
 segment 3 contains keyframe 4 (duration=8s <  total_duration=9s)
                and keyframe 5 (duration=10s >= total_duration=9s)
 ...

Segment 2 is only 2s long, shorter than min_seg_duration = 3s.

To fix this, new segments are created based on the actual written duration.
Otherwise the option name "min_seg_duration" is misleading.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:08:21 +02:00
Peter Große
1920382aa9 dashenc: add option to provide UTC timing source
If set, adds a UTCTiming tag in the manifest.

This is part of the recommendations listed in the "Guidelines for
Implementations: DASH-IF Interoperability Points" [1][2]
Section 4.7 describes means for the Availability Time Synchronization.

A usable default is "https://time.akamai.com/?iso"

[1] http://dashif.org/guidelines/
[2] http://dashif.org/wp-content/uploads/2016/12/DASH-IF-IOP-v4.0-clean.pdf
    (current version as of writing)

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-31 00:08:09 +02:00
Anton Schubert
3c2717e48d dashenc: increase buffer time hint in the manifest
to avoid rebuffering on the clientside for difficult network conditions.

Signed-off-by: Anton Schubert <ischluff@mailbox.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-27 14:34:17 +02:00
Peter Große
95f1004bdf dashenc: add mandatory id to AdaptationSet and Period in manifest
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-27 14:27:40 +02:00
Anton Schubert
1ae6cb7d6e dashenc: fix ISO8601 UTC parsing
Appends Z to timestamp to force ISO8601 datetime parsing as UTC.
Without Z, some browsers (Chrome) interpret the timestamp as
localtime and others (Firefox) interpret it as UTC.

Signed-off-by: Anton Schubert <ischluff@mailbox.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-01-27 14:07:30 +02:00
Diego Biurrun
07cac07c0c dash: Use correct ISO C scanf conversion specifier 2016-10-28 13:29:52 +02:00
Rodger Combs
42cb050a05
lavf/movenc+dashenc: add automatic bitstream filtering
This is disabled by default when the empty_moov flag is enabled
2016-10-24 03:53:23 -05:00
Rodger Combs
c972a28fc3
lavf/dashenc: add deinit function 2016-10-24 03:53:23 -05:00