summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
Commit message (Collapse)AuthorAge
* avformat: introduce AVFormatContext io_close2 which returns an intMarton Balint2021-12-12
| | | | | | | | | | | | | | | | | Otherwise there is no way to detect an error returned by avio_close() because ff_format_io_close cannot get the return value. Checking the return value of the close function is important in order to check if all data was successfully written and the underlying close() operation was successful. It can also be useful even for read mode because it can return any pending AVIOContext error, so the user don't have to manually check AVIOContext->error. In order to still support if the user overrides io_close, the generic code only uses io_close2 if io_close is either NULL or the default io_close callback. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/dashenc: Don't use stack packetAndreas Rheinhardt2021-11-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Add AVStream parameter to check_bitstream() sigAndreas Rheinhardt2021-11-27
| | | | | | | | | | For most check_bitstream() functions this just avoids having to dereference s->streams[pkt->stream_index] themselves; but for meta-muxers it will allow to forward the packet to stream with a different stream_index (belonging to a different AVFormatContext) without using a spare packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dashenc: enabling streaming and hls_playlist for lhlsZhao Zhili2021-11-05
| | | | | | | Try to make the feature easier to use, especially since the user have enabled -strict experimental manually. The user shouldn't be surprised that hls_playlist is enabled for lhls automatically, so change the log level from warning to info for that.
* avformat/dashenc: enabling streaming automatically for ldashZhao Zhili2021-11-05
| | | | | | | | | There is a little chance that user specified contradicted options like -streaming 0 -ldash 1, however, it's more likely that user didn't know or forgot to enable streaming for ldash. So enabling streaming automatically to make the feature easier to use, similar like enable FF_MOV_FLAG_FRAGMENT/EMPTY_MOOV/DEFAULT_BASE_MOOF and so on for FF_MOV_FLAG_CMAF.
* avformat/dashenc: Fix comparing double with 0Limin Wang2021-11-03
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.hAndreas Rheinhardt2021-07-29
| | | | | | | | | | | | | It only uses an AVIOContext and an AVBPrint. When doing so, it turned out that several non-users of ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata() relied on libavformat/internal.h to include bprint.h or avstring.h for them. In order to avoid a repeat of this and in order to reduce unnecessary dependencies, a forward declaration of struct AVBPrint is used instead of including bprint.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Fix double write of DASH manifest in streaming modeKevin LaFlamme2021-07-14
| | | | | | | When streaming mode is enabled, the DASH manifest is written on the first packet for the segment so that the segment can be advertised immediately to clients. It was also still writing the manifest at the end of the segment leading to two duplicate writes.
* dashenc: Write out DASH manifest immediately in streaming modeKevin LaFlamme2021-06-14
| | | | | | | | | | | | | | When streaming mode is enabled with fMP4/CMAF for DASH output, the segment files are available to read by players as soon as the first byte is written instead of only after the file is fully written. The DASH manifest currently only gets written when the final write to the segment file occurs. This means that players cannot stream the first segment while it is being written. When -lhls is enabled with MP4 segments the HLS manifest is written immediately to advertise the in-flight segments. This change adds the same behavior for the DASH manifest so players can stream it immediately.
* avformat/dashenc: use av_match_ext()Limin Wang2021-06-14
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* Revert "avformat/dashenc: Disable writing CODECS tag for HEVC streams"Valerii Zapodovnikov2021-06-08
| | | | | | | | | This reverts commit d6d407d2d758b404af0ce6a8ff46bf164db020a1. Hack not needed after a2b1dd0ce301450a47c972745a6b33c4c273aa5d. Will fix #7480 and #8904. This will include e.g. CODECS="hvc1.2.4.L123.B0" into m3u8. Signed-off-by: Valerii Zapodovnikov <val.zapod.vz@gmail.com>
* lavf/dashenc.c: Fix creating audio-only HLS playlistsPrzemysław Sobala2021-06-01
| | | | | | | | With audio/video HLS playlists, audio chunklists are treated as alternative renditions for video chunklists. This is wrong for audio-only HLS playlists. fixes: 9252
* avio: do not export avpriv_io_{move,delete}Anton Khirnov2021-05-22
| | | | | They are private and not used by anything outside of lavf. There is no reason for them to be exported.
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-27
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: Remove deprecated min_seg_duration optionAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 01ba52852d2ada3c79fe02a7de5bc1fdc27d56e8. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: use the buffer_size_t typedef where requiredJames Almer2021-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* libavformat/dashenc: Reduce confusion in par error messageChris Miceli2020-08-31
| | | | | | | | | | In ticket #8754 there is discourse surrounding the error message which is printed upon a mismatched aspect ratio in derived encodings. This should make it clearer to the user as to the issues which they are experiencing. Reviewed-by: "Jeyapal, Karthick" <kjeyapal@akamai.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat/dashenc.c: Support mpd update periodSiyuan Huang2020-07-09
| | | | | | According ISO 23009-1, in live cases, mpd refresh period should be configurable Signed-off-by: Siyuan Huang <saber.huang@samsung.com>
* avformat/dashenc: Calculate average bitrate for adaptation sets in static ↵Przemysław Sobala2020-06-22
| | | | | | | | | manifest If stream's bitrate is not specified: - for static manifest: an average bitrate will be calculated and used, - for dynamic manifest: first segment's bitrate will be calculated and used, as before, for bandwidth setting in adaptation sets.
* Revert "avformat/dashenc: use AVStream timebase when computing missing bitrate"Przemysław Sobala2020-06-22
| | | | This reverts commit 2a9ffd89fcb09bd69b2130da039ad2caba79cf33 as duration is always in AV_TIME_BASE units
* avformat/dashenc: Add hls_master_name optionPrzemysław Sobala2020-06-15
|
* avformat/dashenc: use AVStream timebase when computing missing bitratePrzemysław Sobala2020-06-01
|
* avformat/dashenc: remove the arbitrary restrictions for filenameLimin Wang2020-05-01
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/dashenc: use av_reallocp_array()Limin Wang2020-04-29
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/dashenc: use local variable and avoid calculate duration multiple timesLimin Wang2020-04-29
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/dashenc: cosmeticsLimin Wang2020-04-29
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat: only allow a single bitstream filter when muxingMarton Balint2020-04-26
| | | | | | | | | | | | Current muxers only use a single bitstream filter, so there is no need to maintain code which operates on a list of bitstream filters. When multiple bitstream filters are needed muxers can simply use a list bitstream filter. If there is a use case in the future when different bitstream filters should be added at subsequent packets then a new API possibly involving reconfiguring the list bitstream filter can be added knowing the exact requirements. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/dashenc: add missing startWithSap attribute to AdaptationSet elementsJames Almer2020-04-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: add a PlaybackRate elementJames Almer2020-04-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: add a maxSegmentDuration attribute to the ManifestJames Almer2020-04-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: fix typo in ProducerReferenceTime elementsJames Almer2020-04-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: add subtitle support in master playlist m3u8Limin Wang2020-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | Test with the following command for the webvtt subtitle: $ ./ffmpeg -y -i input_with_subtitle.mkv \ -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \ -b:a:0 256k \ -c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0 -map 0:s:0 \ -f hls -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \ -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \ 10 -master_pl_publish_rate 10 -hls_flags \ delete_segments+discont_start+split_by_time ./tmp/video.m3u8 Check the master m3u8: $ cat tmp/master.m3u8 #EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitle",NAME="subtitle_0",DEFAULT=YES,URI="video_vtt.m3u8" #EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33",SUBTITLES="subtitle" video.m3u8 Check the result by convert to mkv: $ ./ffmpeg -strict experimental -i ./tmp/master.m3u8 -c:v copy -c:a mp2 -c:s srt ./test.mkv Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/dashenc: use a quieter log lever when informing prft was ↵James Almer2020-02-26
| | | | | | | automatically enabled Suggested-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: always attempt to enable prft in ldash modeJames Almer2020-02-22
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: write a capture time Producer Reference Time element when ↵James Almer2020-02-22
| | | | | | | | none is provided by the encoder This way, the element will be present in any scenario when the write_prft option is used. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: write the styp box when the first frame of a segment is readyJames Almer2020-02-22
| | | | | | | This ensures it's written at the beginning of a segment in non streaming mode when segment duration differs from fragment duration. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: warn if Producer Reference Time element option is missing ↵James Almer2020-02-17
| | | | | | when ldash mode is used Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: disable Resync elements when using DVB-DASH profileJames Almer2020-02-17
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: always set coding_dependency to 1 if a parser isn't usedJames Almer2020-02-16
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: include an availabilityTimeComplete element in all ↵James Almer2020-02-16
| | | | | | | | | streaming modes It's not exclusive for Low Latency streaming. The muxer will serve partial segments regardless of streaming mode. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: add Trick Mode support for AdaptationSetsJames Almer2020-02-16
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: make AdaptationSet id an integer valueJames Almer2020-02-16
| | | | | | | Unlike Representation id, it's defined as an integer in the spec, and not as a string. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: use AV_OPT_TYPE_DICT for http_optsMarton Balint2020-02-03
| | | | | | | | This changes the separator character from comma to colon, but since this option was only added recently I think it should be done for consistency with other similar options. Signed-off-by: Marton Balint <cus@passwd.hu>
* dashenc: check pts to prevent division by zero errorAlfred E. Heggestad2020-01-31
| | | | | | | | | | | | | | | | | | this usecase will cause a division by zero trap: 1. dashenc has received one frame 2. os->max_pts and os->start_pts have same value 3. delta between max_pts and start_pts is 0 4. av_rescale_q(0, x, y) returns 0 5. this value is used as denominator in division 6. Bang! -> segfault this fix checks that max_pts > start_pts. the fix has been tested and works. Signed-off-by: Alfred E. Heggestad <alfred.heggestad@gmail.com> Reviewed-by: Jeyapal, Karthick <kjeyapal@akamai.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: use ff_rename instead of avpriv_io_moveMarton Balint2020-01-19
| | | | | | ff_rename always logs the error message. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/dashenc: add an option to write a Latency elementJames Almer2020-01-15
| | | | | | | 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>
* dashenc: support setting arbitrary HTTP protocol optionsAnton Khirnov2020-01-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: allow setting custom movflags using format_optionsJames Almer2020-01-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>