Commit Graph

212 Commits

Author SHA1 Message Date
Marton Balint b5dba152ef avformat/dashenc: use ff_rename instead of avpriv_io_move
ff_rename always logs the error message.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-19 22:17:04 +01:00
James Almer 05b3460991 avformat/dashenc: add an option to write a Latency element
Allows to set an intended target latency while streaming that clients can use
to measure when using low latency mode.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:22 -03:00
Anton Khirnov bc4f0e713b dashenc: support setting arbitrary HTTP protocol options
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:22 -03:00
James Almer c96a9636c8 avformat/dashenc: allow setting custom movflags using format_options
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:21 -03:00
James Almer f63407a986 avformat/dashenc: implement DVB-DASH profile
Add new required elements and constrain presence and values for existing
ones based on the spec.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:21 -03:00
James Almer 21847e2a52 avformat/dashenc: add an option to enable low latency Dash manifest
In combination with the streaming option it constrains the value of a few elements,
to prevet clients from buffering too much data before starting presentation.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:20 -03:00
James Almer 7e5d143bb5 avformat/dashenc: Write a Producer Reference Time element
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:20 -03:00
James Almer ea5a910628 avformat/dashenc: allow splitting fragments following P-Frame reordering
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 12:22:29 -03:00
James Almer ceb236c1c5 avformat/dashenc: allow setting fragment durations
Implemented as as a frag_duration muxer option and key=value entry in the
adaptation_sets muxer option. It has the same syntax as the seg_duration option.
A new frag_type option is also introduced to select the kind of fragmentation.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 12:22:28 -03:00
James Almer 0c19dd2df4 avformat/dashenc: allow setting segment durations per AdaptationSet
Implemented as as a seg_duration key=value entry in the adaptation_sets muxer
option.
It has the same syntax as the global seg_duration option, and has precedence
over it if set.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 12:22:28 -03:00
Andreas Rheinhardt 8aeab0dbc1 avformat/dashenc: Fix leak of AVFormatContext on error
The Dash muxer uses submuxers and when one such submuxer has been allocated,
it is initially only stored in a temporary variable. Therefore it leaks
if an error happens between the allocation and storing it permanently.
This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: "Jeyapal, Karthick" <kjeyapal@akamai.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:32:26 +01:00
Marton Balint 59172164f3 avformat/dashenc: use AV_OPT_TYPE_DICT for format_options
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
Steven Liu b26225a3c7 avformat/dashenc: remove unused check of avformat_free_context
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Reviewed-by: Jeyapal, Karthick <kjeyapal@akamai.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-12-02 00:08:07 +08:00
James Almer 1cf2f040e3 avformat/dashenc: fix writing the AV1 codec string in mp4 mode
From https://aomediacodec.github.io/av1-isobmff/#codecsparam, the parameters
sample entry 4CC, profile, level, tier, and bitDepth are all mandatory fields.
All the other fields are optional, mutually inclusive (all or none).

Fixes ticket #8049

Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-03 12:33:15 -03:00
James Almer ce6a98e830 avformat/dashenc: update stream extradata from packet side data
codecpar->extradata is not going to change between packets. New extradata
is instead propagated using packet side data.

Use ff_alloc_extradata() as well.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-03 12:33:14 -03:00
Leo Zhang 116303cd24 avformat/dashenc: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.
Signed-off-by: leozhang <leozhang@qiyi.com>
2019-07-22 07:57:39 +05:30
Alfred E. Heggestad 2b634e7c23 avformat/dashenc: split extension for MP4 into .mp4 or .m4s 2019-06-25 15:07:44 +05:30
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
Michael Niedermayer 359d4e10a0 avformat/dashenc: use 64bit for handling the return of avio_tell()
The return code is 64bit, so this is more correct, especially in case it
actually would be a file of such large size

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-17 09:32:21 +05:30
Karthick J eeca67e023 avformat/dashenc: Fix a bug with writing "final" manifest
This bug was introduced in the commit 951561b64e
2019-04-22 11:31:25 +05:30
Karthick J bcde9ec020 avformat/dashenc: Disable streaming for webm output
Currently streaming for webm output doesn't work.
Disabling explicitly will make sure that the manifest will get generated correctly.
2019-04-16 15:59:05 +05:30
joepadmiraal 951561b64e libavformat/dashenc : Prevent writing manifest files multiple times 2019-04-10 12:32:17 +05:30
Karthick J 6aeaac3e1c avformat/dashenc: Add support for Global SIDX 2019-04-02 11:16:06 +05:30
joepadmiraal 056a2ac168 avformat/dashenc: Added #EXT-X-PROGRAM-DATE-TIME to HLS playlists 2019-03-06 10:58:57 +05:30
Karthick J 2e67f751b5 avformat/dashenc: Added comments
Added comments regarding usage of certain movflags in streaming mode.
2019-02-25 11:40:54 +05:30
Karthick J ca5ec4cbbc avformat/dashenc: Added option to repeatedly publish master playlist
The master playlist can be published at a specified interval with this option
2019-02-25 11:40:47 +05:30
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
Karthick J 1db30d6cec avformat/dashenc: Skip writing trailer for MP4 output when in streaming mode
In streaming mode mp4 trailer is not required for playout.
2019-01-28 11:07:10 +05:30
Karthick J b6d96a6bcc avformat/dashenc: Format xs:datetime in millisecond precision
For low latency streaming even milliseconds matter!
2019-01-21 14:50:23 +05:30
kjeyapal@akamai.com f22fcd4483 avformat/dashenc: Added support for Low-latency HLS(Experimental)
Apple doesn't have an official spec for LHLS. Meanwhile hls.js player folks are
trying to standardize a open LHLS spec. The draft spec is available in https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
This option will also try to comply with the above open spec, till Apple's spec officially supports it.
Applicable only when @var{streaming} and @var{hls_playlist} options are enabled.
2018-12-17 12:11:55 +05:30
kjeyapal@akamai.com d209a3d50f avformat/dashenc : Refactored HLS media playlist related code
Made it as a separate function, so that it could be reused (in future)
2018-12-17 12:11:18 +05:30
kjeyapal@akamai.com 876ed08b0d avformat/dashenc: Used the movenc option skip_sidx instead of global_sidx
Anyways the intended behaviour was to disable SIDX atom.
2018-12-11 10:53:18 +05:30
Andrey Semashev f176d6587b lavf/dashenc: Write media trailers when DASH trailer is written.
This commit ensures that all (potentially, long) filesystem activity is
performed when the user calls av_write_trailer on the DASH libavformat
context, not when freeing the context. Also, this defers media segment
deletion until after the media trailers are written.
2018-12-04 10:34:29 +05:30
Karthick J 4bbb6d1ae9 Revert "lavf/dashenc: Write media trailers when DASH trailer is written."
This reverts commit e444b3b184.
Causing build error due to rebasing. Sorry for about it.
2018-12-03 11:28:18 +05:30
Andrey Semashev a68a975584 lavf/dashenc: Use avpriv_io_delete to delete files.
This fixes incorrect handling of file pseudo-URIs (i.e. when the filename
starts with "file:").
2018-12-03 10:54:47 +05:30
Andrey Semashev e444b3b184 lavf/dashenc: Write media trailers when DASH trailer is written.
This commit ensures that all (potentially, long) filesystem activity is
performed when the user calls av_write_trailer on the DASH libavformat
context, not when freeing the context. Also, this defers media segment
deletion until after the media trailers are written.
2018-12-03 10:54:47 +05:30
Karthick J 0a80b39780 avformat/dashenc: Added proper logging when io_open fails for write 2018-12-03 10:54:47 +05:30
kjeyapal@akamai.com c32aad1961 avformat/dashenc: Added an option to ignore io errors
When dashenc has to run for long duration(say 24x7 live stream), one can enable this option to ignore the io failure of few segment's upload due to an intermittent network issues.
When the network connection recovers dashenc will continue with the upload of the current segments, leading to the recovery of the stream.
2018-12-02 19:14:37 +05:30
kjeyapal@akamai.com 6c1e124201 avformat/dashenc: Handled the error from dashenc_io_open() 2018-12-02 19:14:03 +05:30
Andrey Semashev 84c17449ce lavf/dashenc: Delete HLS manifests on trailer writing if remove_at_exit is set.
This fixes HLS manifests being left behind if remove_at_exit is set.
2018-12-02 19:07:30 +05:30
Andrey Semashev 2a5cf8a241 lavf/dashenc: Don't put non-mp4 streams in HLS manifests.
The only native HLS implementation in the wild (Safari browser) doesn't
support WebM. And at least some MSE-based players (e.g. shaka-player)
cannot handle WebM media segments when playing HLS. So just skip non-mp4
streams from HLS manifests. Note that such streams will still be described
by the DASH manifest and therefore consumed by players supporting DASH.
2018-12-02 19:06:54 +05:30
Andrey Semashev fa08345e88 lavf/dashenc: Fix segment duration overflow on fine time bases.
When stream time bases are very fine grained (e.g. nanoseconds), 32-bit
segment duration may overflow for even for rather small segment duration
(about 4 seconds long). Therefore we use 64-bit values for segment duration.
2018-11-23 14:15:32 +05:30
kjeyapal@akamai.com 4903662a1d avformat/dashenc : Handled error from ff_http_do_new_request() cleanly 2018-11-22 12:06:27 +05:30
Andrey Semashev d290bb0c54 lavf/dashenc: Fix AVDictionary leaks in case of various init errors. 2018-11-21 18:02:43 +05:30
Andrey Semashev 281a21ed50 lavf/dashenc: Add support for format-specific file extensions.
The file name template options now support a new "$ext$" placeholder,
which is replaced with a filename extension specific for the selected
file format. This is useful for the new "auto" format mode, when
different streams may use different file formats, and it is not
possible to specify the correct file name extension exactly.

Resolves warnings in the log about webm segments not having webm extensions.
2018-11-21 18:02:19 +05:30
Andrey Semashev 322e53f8ae lavf/dashenc: Add DASH segment type auto and make it the default
This commit restores the ability to create DASH streams with codecs
that require different containers that was lost after commit
2efdbf7367. It adds a new "auto" value for
the dash_segment_type option and makes it the default. When in this mode,
the segment format will be chosen based on the codec used in the stream:
webm for Vorbis, Opus, VP8 or VP9, mp4 otherwise.
2018-11-21 18:01:53 +05:30
Jan Ekström b31a4be15f lavf/dashenc: set FLAC manifest codec string to "flac"
Internally in ISOBMFF the FLAC-in-ISOBMFF draft uses "fLaC"
as the identifier for FLACSampleEntry, and there seems to be no
MPEG-DASH specification for the in-manifest identifier for FLAC.

After testing the browsers' implementations, it seems like all of
the major browser vendors have decided to utilize the MIME type for
FLAC ("audio/flac") as the identifier. This change set leads to
that string being utilized for FLAC streams instead of the sample
entry identifier ("fLaC"), which is the default behavior.

Verified by auri_ on IRC to play with the major browsers.
2018-11-14 20:45:02 +02:00
kjeyapal@akamai.com d6d407d2d7 avformat/dashenc: Disable writing CODECS tag for HEVC streams
For HEVC streams, only the FourCC tag is written without profile, level etc.,
This is breaking playout support in native Safari.
Native Safari playout expects the full info in CODECS tag or None at all.
2018-11-02 07:27:47 +05:30
kjeyapal@akamai.com de43c227fd avformat/dashenc: Support HTTP persistent for init segments as well 2018-10-26 11:49:47 +05:30
kjeyapal@akamai.com e715b8e10d avformat/dashenc: URL close unconditionally after DELETE segments
Fixes bug with HTTP DELETE when HTTP Persistent is ON.
Right now, HTTP Persistent connections is supported only for POSTs and PUTs.
HTTP DELETE will still open a new connection every time.
2018-10-21 16:26:32 +05:30