summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* movenc: Use LIBAVFORMAT_IDENT instead of LIBAVCODEC_IDENTMartin Storsjö2022-03-13
| | | | | | | | The muxer seems to have had one seemingly accidental use of LIBAVCODEC_IDENT, while LIBAVFORMAT_IDENT probably is the relevant one (which is used multiple times in the same file). Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/movenc: Simplify creating chapter track extradataAndreas Rheinhardt2022-03-11
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: add DFPWM WAV container supportJack Bruienne2022-03-10
| | | | | | | | | | | | | | | | | | | This commit adds support for storing DFPWM audio in a WAV container. It uses the WAVEFORMATEXTENSIBLE structure, following these conventions: https://gist.github.com/MCJack123/90c24b64c8e626c7f130b57e9800962c The implementation is very simple: it just adds the GUID to the list of WAV GUIDs, and modifies the WAV muxer to always use WAVEFORMATEXTENSIBLE format with that GUID. This creates a standard container format for DFPWM besides raw data. It will allow users to transfer DFPWM audio in a standard container format, with the sample rate and channel count contained in the file as opposed to being an external parameter as in the raw format. This format is already supported in my AUKit library, which is the CC analog to libav (albeit much smaller). Support in other applications is TBD. Signed-off-by: Jack Bruienne <jackbruienne@gmail.com>
* avformat: add DFPWM raw formatJack Bruienne2022-03-10
| | | | | | | | | | | | | This patch builds on my previous DFPWM codec patch, adding a raw audio format to be able to read/write the raw files that are most commonly used (as no other container format supports it yet). The muxers are mostly copied from the PCM demuxer and the raw muxers, as DFPWM is typically stored as raw data. Please see the previous patch for more information on DFPWM. Signed-off-by: Jack Bruienne <jackbruienne@gmail.com>
* avformat/avidec: Check heightMichael Niedermayer2022-03-08
| | | | | | | Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: Ticket8486 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/rmdec: Better duplicate tags checkMichael Niedermayer2022-03-08
| | | | | | | | Fixes: memleaks Fixes: 44810/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5619494647627776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpegtsenc: fix muxing pcm-blurayPaul B Mahol2022-03-06
|
* avformat/mov: reindent after previous commitClément Bœsch2022-03-04
|
* avformat/mov: fix seeking with HEVC open GOP filesClément Bœsch2022-03-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was tested with medias recorded from an iPhone XR and an iPhone 13. Here is how a typical stream looks like in coding order: ┌────────┬─────┬─────┬──────────┐ │ sample | PTS | DTS | keyframe | ├────────┼─────┼─────┼──────────┤ ┊ ┊ ┊ ┊ ┊ │ 53 │ 560 │ 510 │ No │ │ 54 │ 540 │ 520 │ No │ │ 55 │ 530 │ 530 │ No │ │ 56 │ 550 │ 540 │ No │ │ 57 │ 600 │ 550 │ Yes │ │ * 58 │ 580 │ 560 │ No │ │ * 59 │ 570 │ 570 │ No │ │ * 60 │ 590 │ 580 │ No │ │ 61 │ 640 │ 590 │ No │ │ 62 │ 620 │ 600 │ No │ ┊ ┊ ┊ ┊ ┊ In composition/display order: ┌────────┬─────┬─────┬──────────┐ │ sample | PTS | DTS | keyframe | ├────────┼─────┼─────┼──────────┤ ┊ ┊ ┊ ┊ ┊ │ 55 │ 530 │ 530 │ No │ │ 54 │ 540 │ 520 │ No │ │ 56 │ 550 │ 540 │ No │ │ 53 │ 560 │ 510 │ No │ │ * 59 │ 570 │ 570 │ No │ │ * 58 │ 580 │ 560 │ No │ │ * 60 │ 590 │ 580 │ No │ │ 57 │ 600 │ 550 │ Yes │ │ 63 │ 610 │ 610 │ No │ │ 62 │ 620 │ 600 │ No │ ┊ ┊ ┊ ┊ ┊ Sample/frame 58, 59 and 60 are B-frames which actually depends on the key frame (57). Here the key frame is not an IDR but a "CRA" (Clean Random Access). Initially, I thought I could rely on the sdtp box (independent and disposable samples), but unfortunately: sdtp[54] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0 sdtp[55] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0 sdtp[56] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0 sdtp[57] is_leading:0 sample_depends_on:2 sample_is_depended_on:0 sample_has_redundancy:0 sdtp[58] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0 sdtp[59] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0 sdtp[60] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0 sdtp[61] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0 sdtp[62] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0 The information that might have been useful here would have been is_leading, but all the samples are set to 0 so this was unusable. Instead, we need to rely on sgpd/sbgp tables. In my case the video track contained 3 sgpd tables with the following grouping types: tscl, sync and tsas. In the sync table we have the following 2 entries (only): sgpd.sync[1]: sync nal_unit_type:0x14 sgpd.sync[2]: sync nal_unit_type:0x15 (The count starts at 1 because 0 carries the undefined semantic, we'll see that later in the reference table). The NAL unit types presented here correspond to: libavcodec/hevc.h: HEVC_NAL_IDR_N_LP = 20, libavcodec/hevc.h: HEVC_NAL_CRA_NUT = 21, In parallel, the sbgp sync table contains the following: ┌────┬───────┬─────┐ │ id │ count │ gdi │ ├────┼───────┼─────┤ │ 0 │ 1 │ 1 │ │ 1 │ 56 │ 0 │ │ 2 │ 1 │ 2 │ │ 3 │ 59 │ 0 │ │ 4 │ 1 │ 2 │ │ 5 │ 59 │ 0 │ │ 6 │ 1 │ 2 │ │ 7 │ 59 │ 0 │ │ 8 │ 1 │ 2 │ │ 9 │ 59 │ 0 │ │ 10 │ 1 │ 2 │ │ 11 │ 11 │ 0 │ └────┴───────┴─────┘ The gdi column (group description index) directly refers to the index in the sgpd.sync table. This means the first frame is an IDR, then we have batches of undefined frames interlaced with CRA frames. No IDR ever appears again (tried on a 30+ seconds sample). With that information, we can build an heuristic using the presentation order. A few things needed to be introduced in this commit: 1. min_sample_duration is extracted from the stts: we need the minimal step between sample in order to PTS-step backward to a valid point 2. In order to avoid a loop over the ctts table systematically during a seek, we build an expanded list of sample offsets which will be used to translate from DTS to PTS 3. An open_key_samples index to keep track of all the non-IDR key frames; for now it only supports HEVC CRA frames. We should probably add BLA frames as well, but I don't have any sample so I prefered to leave that for later It is entirely possible I missed something obvious in my approach, but I couldn't come up with a better solution. Also, as mentioned in the diff, we could optimize is_open_key_sample(), but the linear scaling overhead should be fine for now since it only happens in seek events. Fixing this issue prevents sending broken packets to the decoder. With FFmpeg hevc decoder the frames are skipped, with VideoToolbox the frames are glitching.
* avformat/mov: add parsing for the sgpd sync boxClément Bœsch2022-03-04
| | | | | | | | | | | sgpd means Sample Group Description Box. For now, only the sync grouping type is parsed, but the function can easily be adjusted to support other flavours. The sbgp (Sample to Group Box) sync_group table built in previous commit contains references to this table through the group_description_index field.
* avformat/mov: add support for sync group in sbgp boxClément Bœsch2022-03-04
|
* avformat/mov: prepare sbgp parsing for other grouping typesClément Bœsch2022-03-04
|
* avformat/avisynth: fix fallbacks for four framepropsStephen Hutchinson2022-03-02
| | | | | | | | | | If _FieldBased, _Matrix, _ColorRange, or _ChromaLocation haven't been set, that absence would be interpreted as 0, leading to those being set to case 0 instead of default. There is no case 0 for _Primaries and _Transfer, so those were correctly falling back to the default case. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/mov: Disallow empty sidxMichael Niedermayer2022-03-02
| | | | | | | | | | It appears this is not allowed "Each Segment Index box documents how a (sub)segment is divided into one or more subsegments (which may themselves be further subdivided using Segment Index boxes)." Fixes: Null pointer dereference Fixes: Ticket9517 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/av1: reduce the scope of some variablesJames Almer2022-02-28
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/av1: support av1C extradata in ff_av1_parse_seq_header()James Almer2022-02-28
| | | | | | Fixes dash manifest creation for av1 streams with av1C formatted extradata. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: always compile isom_tagsJames Almer2022-02-28
| | | | | | | It's needed for avformat_get_mov_video_tags() and avformat_get_mov_audio_tags(), both public symbols defined in avformat.h Signed-off-by: James Almer <jamrial@gmail.com>
* configure: stop allowing disabling lzoJames Almer2022-02-26
| | | | | | The module is now always compiled in. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/argo_cvg:: Fix order of operations in error check in ↵Michael Niedermayer2022-02-25
| | | | | | argo_cvg_write_trailer() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/argo_asf: Fix order of operations in error check in ↵Michael Niedermayer2022-02-25
| | | | | | argo_asf_write_trailer() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskadec: Check durationMichael Niedermayer2022-02-25
| | | | | | | | | Fixes: -nan is outside the range of representable values of type 'long' Fixes: 44614/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6216204841254912 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-24
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove obsolete version.h inclusionsAndreas Rheinhardt2022-02-24
| | | | | | | Forgotten in e7bd47e657bbf9e1ce9915e93bc80cb1a29fb7f3. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/log: Don't include avutil.hAndreas Rheinhardt2022-02-24
| | | | | | | | | | | | It has been included since af5f434f8c0fb3b4ee3b206ebc1946ca660a8abe for deprecation reasons, but removing it has been forgotten after it had served is purpose. So remove it. For convenience, include version.h instead as LIBAVUTIL_VERSION_INT is supposed to be used when creating AVClasses. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avio: Don't include common.hAndreas Rheinhardt2022-02-24
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avisynth: remove framedata variableStephen Hutchinson2022-02-23
| | | | | | | | It's just a simple index. Addresses Coverity issue 1500290 Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: remove unused variable 'frameprop'Stephen Hutchinson2022-02-23
| | | | | | | Since the check got simplified and stdbool was no longer necessary to include, neither is that variable. Silences a warning. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/nutdec: Add check for avformat_new_streamJiasheng Jiang2022-02-23
| | | | | | | Check for failure of avformat_new_stream() and propagate the error code. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/imf: document IMFVirtualTrackResourcePlaybackCtxPierre-Anthony Lemieux2022-02-20
|
* avformat/imf: fix packet pts, dts and muxingPierre-Anthony Lemieux2022-02-20
| | | | | | | | | | The IMF demuxer does not set the DTS and PTS of packets accurately in all scenarios. Moreover, audio packets are not trimmed when they exceed the duration of the underlying resource. imf-cpl-with-repeat FATE ref file is regenerated. Addresses https://trac.ffmpeg.org/ticket/9611
* avformat/imf: open resources only when first neededPierre-Anthony Lemieux2022-02-20
| | | | | | | | IMF CPLs can reference thousands of files, which can result in system limits for the number of open files to be exceeded. The following patch opens and closes files as needed. Addresses https://trac.ffmpeg.org/ticket/9623
* avformat/avisynth: fix frameprop version checkStephen Hutchinson2022-02-18
| | | | | | | | | | | Trying to be clever about determining between interface version 8 and 8.1 ended up with pre-8.1 versions of AviSynth+ segfaulting. The amount of time between interface version 8.1 and 9 is small, so just restrict the frameprop awareness to version 9 and call it a day. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/utils: fix logic error in ff_mkdir_pPeter Ross2022-02-16
| | | | | | Fix ticket# 9605 Signed-off-by: Peter Ross <pross@xvid.org>
* avformat/argo_cvg: Fix checksumMichael Niedermayer2022-02-15
| | | | | | Reviewed-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Corner case encryption error cleanup in mov_read_senc()Michael Niedermayer2022-02-15
| | | | | | | | Fixes: memleak Fixes: 42341/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4566632823914496 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/id3v2: Add Grouping frame to id3v2.4 metadata tableWolfgang Müller2022-02-15
| | | | | | | | | | | | | | | | | The ID3v2.4.0 standard defines TIT1 as the "Content group description" tag [1]. This frame is usually referred to as the "Grouping" tag and in de-facto use under that name by Vorbis and APEv2 [2]. This commit introduces a mapping from "TIT1" to "grouping" in the id3v2.4 metadata conversion table. This will enable software to access it using that name. In particular, MPD will now read this tag correctly when using the ffmpeg decoder plugin. [1] https://id3.org/id3v2.4.0-frames (4.2.1) [2] https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html#grouping-3 Signed-off-by: Wolfgang Müller <wolf@oriole.systems> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/gnutls: Use the systems default crypto policyAndreas Schneider2022-02-15
| | | | | | | | We should use the systems crypto policy by default. If there is no system policy, gnutls will use the "NORMAL" policy. Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avisynth: use AviSynth+'s frame properties to set various fieldsStephen Hutchinson2022-02-13
| | | | | | | | | | | | | | | * Field Order * Chroma Location * Color Transfer Characteristics * Color Range * Color Primaries * Matrix Coefficients The existing TFF/BFF detection is retained as a fallback for older versions of AviSynth that can't access frame properties. The other properties have no legacy equivalent to detect them. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avisynth: corrected interlace detectionemcodem2022-02-13
| | | | | | | | | | | | | | | AviSynth works on frame-based video by default, which can be either progressive or interlaced. Some filters can break frames into half-height fields, at which point it considers the clip to be field-based (avs_is_field_based can be used to check for this situation). To properly detect the field order of a typical video clip, the frame needs to have been weaved back together already, so avs_is_field_based should actually report 'false' when checked. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/udp: remove IPPROTO_IPV6 macroLimin Wang2022-02-12
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: Fix IP_MULTICAST_TTL for BSD compatibilityLimin Wang2022-02-12
| | | | | | | | | | Suggested by zhilizhao, vlc project has solved the compatibility by the same way, so I borrowed the comments from vlc project. Fixes ticket #9449 Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: use one setsockopt for ipv4/ipv6Limin Wang2022-02-12
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: properly check for valid ttl in urlLimin Wang2022-02-12
| | | | | | | Zhao Zhili added a ttl upper bound in commit 9daac85da8, but the check for ttl in url is missing still. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* http: Send a Range header even when the offset is 0Justin Ruggles2022-02-11
| | | | | | | Using Range allows for getting the full file size from the Content-Range header in the response, even if the server sends back the response using chunked Transfer-Encoding, which does not allow using Content-Length.
* http: Improve handling of Content-Range with Transfer-Encoding:chunkedJustin Ruggles2022-02-11
| | | | | | | When Transfer-Encoding:chunked is used, the client must ignore a Content-Length header, if present. However, it should not ignore a Content-Range header, which also includes the full size of the entity.
* avformat/mpegts: initialize max_packet_size when sub-demuxerGyan Doshi2022-02-10
| | | | | | | | | | | bca30570d2 added a user option to set max_packet_size replacing a hardcoded value. This had a side-effect of leaving the field set to 0 when packet demuxing is carried out from another demuxer using avpriv functions, which could lead to demux failure. Hardcoded max_packet_size inside avpriv_mpegts_parse_open to 2048000 to avoid this. Value chosen to be 10x that of default value to accommodate large payloads.
* avformat/hls: Use unsigned for iv computationMichael Niedermayer2022-02-09
| | | | | | | | | Fixes: signed integer overflow: 9223372036854775748 + 60 cannot be represented in type 'long' Fixes: 44417/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-5802443881971712 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskadec: Check desc_bytesMichael Niedermayer2022-02-09
| | | | | | | | Fixes: Division by 0 Fixes: 44035/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4826721386364928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Fix invalid NULL pointer operation in ff_parse_key_value()Michael Niedermayer2022-02-09
| | | | | | | | Fixes: pointer index expression with base 0x000000000000 overflowed to 0xffffffffffffffff Fixes: 44012/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-5670607746891776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskadec: Fix infinite loop with bz decompressionMichael Niedermayer2022-02-09
| | | | | | | | | | | The same check is added to zlib too, it seems not needed there though Fixes: Infinite loop Fixes: 43932/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6175167573786624 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>