summaryrefslogtreecommitdiff
path: root/libavformat/isom.h
Commit message (Collapse)AuthorAge
* Add support for playing Audible AAXC (.aaxc) files [PATCH v4]Vesselin Bontchev2020-11-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AAXC container format is the same as the (already supported) Audible AAX format but it uses a different encryption scheme. Note: audible_key and audible_iv values are variable (per file) and are externally fed. It is possible to extend https://github.com/mkb79/Audible to derive the audible_key and audible_key values. Relevant code: def decrypt_voucher(deviceSerialNumber, customerId, deviceType, asin, voucher): buf = (deviceType + deviceSerialNumber + customerId + asin).encode("ascii") digest = hashlib.sha256(buf).digest() key = digest[0:16] iv = digest[16:] # decrypt "voucher" using AES in CBC mode with no padding cipher = AES.new(key, AES.MODE_CBC, iv) plaintext = cipher.decrypt(voucher).rstrip(b"\x00") # improve this! return json.loads(plaintext) The decrypted "voucher" has the required audible_key and audible_iv values. Update (Nov-2020): This patch has now been tested by multiple folks - details at the following URL: https://github.com/mkb79/Audible/issues/3 Signed-off-by: Vesselin Bontchev <vesselin.bontchev@yandex.com>
* avformat/mov: Only read the mfra size once during sidx parsingDerek Buitenhuis2020-09-03
| | | | | | | | | | | On files with more than one sidx box, like live fragmented MP4 files, it was previously re-reading and seeking on every singl sidx box, leading to extremely poor performance on larger files, especially over the network. Only do it on the first one, and stash its result. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* libavformat/mov: fix multiple trun per trafJohn Stebbins2020-04-11
| | | | | | | | | dts would start over at the beginning of each trun when they should be computed contiguously for each trun in a traf Fixes ticket 8070 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: parse sdtp atom and set the pkt disposable flag accordinglyMatthieu Bouron2019-10-12
| | | | | | Allows the creation of the sdtp atom while remuxing MP4 to MP4. This atom is required by Apple devices (iPhone, Apple TV) in order to accept 2160p medias.
* avformat/mov.c: require tfhd to begin parsing trunchcunningham2019-02-08
| | | | | | | | | | Detecting missing tfhd avoids re-using tfhd track info from the previous moof. For files with multiple tracks, this may make a mess of the avindex and fragindex, which can later trigger av_assert0 in mov_read_trun(). Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Use QT format for audio sample descriptors depending on stsd version.Justin Ruggles2018-09-09
| | | | | | | | | | | | | | | | | ISOBMFF does not allow AudioSampleEntryV1 in stsd version 0, so assume the descriptor format is QTFF SoundDescriptionV1. ISOBMFF does not define a version 2. This fixes audio decoding for some MP4 files generated with Apple tools. The additional fields present in SoundDescriptionV1/V2 need to be read in order to correctly read additional boxes that contain information required for decoding the stream. Fixes #7376. Also see: https://github.com/HandBrake/HandBrake/issues/1555 Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavf/mov: add AVCodecTag entry for GoPro metadataJohn Stebbins2018-09-08
| | | | | | This allows for validation of the track type Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/isom: Make auxiliary_offsets consistently uint64_t.Carl Eugen Hoyos2018-07-25
| | | | | | | | Fixes a compilation warning if size_t != uint64_t: libavformat/mov.c: In function ‘mov_read_saio’: libavformat/mov.c:6207:45: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] encryption_index->auxiliary_offsets = auxiliary_offsets; ^
* avformat/mov: Fix parsing of saio/siaz atoms in encrypted content.Jacob Trimble2018-04-21
| | | | | | | This doesn't support saio atoms with more than one offset. Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Remove old encryption info methods.Jacob Trimble2018-04-19
| | | | | Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Increase support for common encryption.Jacob Trimble2018-04-19
| | | | | | | | | | | | | | | | | | - Parse schm atom to get different encryption schemes. - Allow senc atom to appear in track fragments. - Allow 16-byte IVs. - Allow constant IVs (specified in tenc). - Allow only tenc to specify encryption (i.e. no senc/saiz/saio). - Use sample descriptor to detect clear fragments. This doesn't support: - Different sample descriptor holding different encryption info. - Only first sample descriptor can be encrypted. - Encrypted sample groups (i.e. seig). - Non-'cenc' encryption scheme when using -decryption_key. Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov.c: Use the correct offset to shift timestamp when seeking.Sasi Inguva2018-03-10
| | | | | | | | Fixes seek for files with empty edits and files with negative ctts (dts_shift > 0). Added fate samples and tests. Signed-off-by: Sasi Inguva <isasi@isasi.mtv.corp.google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/movenc: add sdtp (sample dependency) boxJohn Stebbins2017-12-02
| | | | | | The sdtp is required by the AppleTV 4K in order to play 2160p60 video. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '604fbb3132e88727e496c96c92cfe02748c25a1a'James Almer2017-10-26
|\ | | | | | | | | | | | | * commit '604fbb3132e88727e496c96c92cfe02748c25a1a': mov: Move code shared with CAF to a separate file Merged-by: James Almer <jamrial@gmail.com>
| * mov: Move code shared with CAF to a separate fileDiego Biurrun2017-04-03
| |
* | mov: fix decode of fragments that overlap in timeJohn Stebbins2017-10-23
| | | | | | | | | | | | | | | | | | | | | | | | When keyframe intervals of dash segments are not perfectly aligned, fragments in the stream can overlap in time. The previous sorting by timestamp causes packets to be read out of decode order and results in decode errors. Insert new "trun" index entries into index_entries in the order that the trun are referenced by the sidx. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/mov: Allow reading very large files.Pablo Montilla2017-09-28
| | | | | | | | | | | | | | The Sample count in the time-to-sample table is defined as 32-bit unsigned integer by the QT specification. Fixes ticket #6700.
* | Merge commit '53ea595eec984e3109310e8bb7ff4b5786d91057'James Almer2017-09-27
|\| | | | | | | | | | | | | | | | | * commit '53ea595eec984e3109310e8bb7ff4b5786d91057': mov: Rework stsc index validation See e26e6240b6700c5e8c16d0f092f1ad46805a723c. Merged-by: James Almer <jamrial@gmail.com>
| * mov: Rework stsc index validationVittorio Giovara2017-02-10
| | | | | | | | | | In order to avoid potential integer overflow change the comparison and make sure to use the same unsigned type for both elements.
| * Add missing #includes for standalone spherical-information-related headersDiego Biurrun2016-12-08
| |
| * mov: Export spherical informationVittorio Giovara2016-12-07
| | | | | | | | | | | | | | This implements Spherical Video V1 and V2, as described in the spatial-media collection by Google. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * mov: Evaluate the movie display matrixVittorio Giovara2016-11-01
| | | | | | | | | | | | | | | | | | | | | | This matrix needs to be applied after all others have (currently only display matrix from trak), but cannot be handled in movie box, since streams are not allocated yet. So store it in main context, and apply it when appropriate, that is after parsing the tkhd one. Fate tests are updated accordingly. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * mov: Remove ancient heuristic hackDerek Buitenhuis2016-08-29
| | | | | | | | | | | | | | | | | | This breaks files with legitimate single-entry edit lists, and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b, has no link to any known sample in its commit message. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | avformat/mov: Fix trampling of ctts during seeks when sidx support is enabled.Dale Curtis2017-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sidx box support is enabled, the code will skip reading all trun boxes (each containing ctts entries for samples inthat box). If seeks are attempted before all ctts values are known, the old code would dump ctts entries into the wrong location. These are then used to compute pts values which leads to out of order and incorrectly timestamped packets. This patch fixes ctts processing by always using the index returned by av_add_index_entry() as the ctts_data index. When the index gains new entries old values are reshuffled as appropriate. This approach makes sense since the mov demuxer is already relying on the mapping of AVIndex entries to samples for correct demuxing. As a result of this all ctts entries are now 1-count. A followup change will be submitted to remove support for > 1 count entries which will simplify seeking. Notes for future improvement: Probably there are other boxes (stts, stsc, etc) that are impacted by this issue... this patch only attempts to fix ctts since it completely breaks packet timestamping. This patch continues using an array for the ctts data, which is not the most ideal given the rearrangement that needs to happen (via memmove as new entries are read in). Ideally AVIndex and the ctts data would be set-type structures so addition is always worst case O(lg(n)) instead of the O(n^2) that exists now; this slowdown is noticeable during seeks. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mov: add support for reading Content Light Level BoxJames Almer2017-05-27
| | | | | | | | | | | | | | | | As defined in "VP Codec ISO Media File Format Binding v1.0" https://github.com/webmproject/vp9-dash/blob/master/VPCodecISOMediaFileFormatBinding.md Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat/mov: add support for reading Mastering Display Metadata BoxJames Almer2017-05-27
| | | | | | | | | | | | | | | | As defined in "VP Codec ISO Media File Format Binding v1.0" https://github.com/webmproject/vp9-dash/blob/master/VPCodecISOMediaFileFormatBinding.md Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | lavf/mov.c: Add -advanced_editlist option for mov format.Sasi Inguva2017-03-31
| | | | | | | | | | | | | | Adding an MOV format option to turn on/off the editlist supporting code, introduced in https://github.com/FFmpeg/FFmpeg/commit/ca6cae73db207f17a0d5507609de12842d8f0ca3 Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | mov: fix decryption with edit listerankor2017-02-01
| | | | | | | | | | | | | | | | | | | | Retain the ranges of frame indexes when applying edit list in mov_fix_index. The index ranges are then used to keep track of the frame index of the current sample. In case of a discontinuity in frame indexes due to edit, update the auxiliary info position accordingly. Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Add missing #includes for standalone spherical-information-related headersDiego Biurrun2016-12-14
| | | | | | | | | | (cherry picked from commit f912fd767e55bbb5a1554bd99bacab007659609c) Signed-off-by: James Almer <jamrial@gmail.com>
* | mov: Export spherical informationVittorio Giovara2016-12-07
| | | | | | | | | | | | | | This implements Spherical Video V1 and V2, as described in the spatial-media collection by Google. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | mov: Evaluate the movie display matrixVittorio Giovara2016-11-30
| | | | | | | | | | | | | | | | | | This matrix needs to be applied after all others have (currently only display matrix from trak), but cannot be handled in movie box, since streams are not allocated yet. So store it in main context, and apply it when appropriate, that is after parsing the tkhd one. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavf/mov.c: Use the first sidx for tracks without sidx.Sasi Inguva2016-11-03
| | | | | | | | | | | | | | | | According to spec ISO_IEC_15444_12 "For any media stream for which no segment index is present, referred to as non‐indexed stream, the media stream associated with the first Segment Index box in the segment serves as a reference stream in a sense that it also describes the subsegments for any non‐indexed media stream." Signed-off-by: Sasi Inguva <isasi@google.com> Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/mov: improve `tref/chap` chapter handlingRodger Combs2016-10-24
| | | | | | | | | | | | | | | | | | 3 parts: - Supports multiple chapter streams - Exports regular text chapter streams as opaque data. This prevents consumers from showing chapters as if they were regular subtitle streams. - Exports video chapter streams as thumbnails, and provides the first one as an attached_pic.
* | mov: Remove ancient heuristic hackDerek Buitenhuis2016-08-25
| | | | | | | | | | | | | | | | This breaks files with legitimate single-entry edit lists, and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b, has no link to any known sample in its commit message. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | Merge commit '76729970049fe95659346503f7401a5d869f9959'Matthieu Bouron2016-07-13
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '76729970049fe95659346503f7401a5d869f9959': mov: Implement support for multiple sample description tables Notes: * The sc->stsc_data[index].id checks have been moved from the mov_read_stsc to mov_read_packet before the value is used in mov_change_extradata to not break playback of samples with broken stsc entries (see sample of ticket #1918). * sc->stsc_index is now checked against sc->stsc_count - 1 before it is incremented so it remains lesser than sc->stsc_count. Fixes a crash with: ./ffmpeg -i matrixbench_mpeg2.mpg -t 1 -frag_duration 200k test.mov ./ffprobe -show_packets test.mov Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
| * mov: Implement support for multiple sample description tablesVittorio Giovara2016-06-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Store data from each stsd in a separate extradata buffer, keep track of the stsc index for read and seek operations, switch buffers when the index differs. Decoder is notified with an AV_PKT_DATA_NEW_EXTRADATA packet side data. Since H264 supports this notification, and can be reset midstream, enable this feature only for multiple avcC's. All other stsd types (such as hvc1 and hev1) need decoder-side changes, so they are left disabled for now. This is implemented only in non-fragmented MOVs. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * mov: Add an option to toggle dref openingDerek Buitenhuis2016-01-21
| | | | | | | | | | | | | | | | | | This feature is mostly only used by NLE software, and is both of dubious value being enabled by default, and a possible security risk. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * mov: Add option to keep exact packet sequence after seekingDerek Buitenhuis2015-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current behavior may produce a different sequence of packets after seeking, compared to demuxing linearly from the beginning. This is because the MOV demuxer seeks in each stream individually, based on timestamp, which may set each stream at a slightly different position than if the file would have been read sequentially. This makes implementing certain operations, such as segmenting, quite hard, and slower than need be. Therefore, add an option which retains the same packet sequence after seeking, as when a file is demuxed linearly.
* | mov - support seek in encrypted mp4erankor2016-03-06
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | mov: Add an option to toggle dref openingDerek Buitenhuis2016-01-20
| | | | | | | | | | | | | | | | | | This feature is mostly only used by NLE software, and is both of dubious value being enabled by default, and a possible security risk. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mov: support cenc (common encryption)erankor2015-12-31
| | | | | | | | | | | | | | | | | | | | support reading encrypted mp4 using aes-ctr, conforming to ISO/IEC 23001-7. a new parameter was added: - decryption_key - 128 bit decryption key (hex) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mov: Enable parser for mp3s by old HandBrakeMichael Niedermayer2015-12-13
| | | | | | | | | | | | Fixes Ticket5047 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavformat/mov.c: allow QuickTime metadata to come after traksNeil Birkbeck2015-12-05
| | | | | | | | | | | | | | QuickTime metadata can come after trak data. Add indicator for which trak is being parsed (-1 if none) so that global metadata after the trak can be parsed. Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mov: Add option to ignore chapters during parsingBryan Huh2015-11-10
| | | | | | | | | | | | | | | | | | | | Chapter-indexing can be expensive since chapters may be interspersed throughout the entire file and may require many seeks - especially costly when consuming a video over a remote protocol like http. Furthermore it is often unnecessary, especially when only trying to get video info (e.g. via ffprobe). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | mov: Add support parsing QuickTime Metadata Keys.Tinglin Liu2015-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Apple dev specification: https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html Basically the structure is like: |--meta |----hdlr |----keys |----ilst 1) The handler type in the metadata handler atom is ‘mdta’. 2) The key and value are stored separately for each key-value pair. The 'keys' atom stores the key table, while 'ilst' atom stores the values corresponding to the indices in the key table. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | lavf/mov: add support for sidx fragment indexesRodger Combs2015-10-09
| | | | | | | | Fixes trac #3842
* | Add support for Audible AAX (and AAX+) filesVesselin Bontchev2015-07-19
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | mov: Add option to keep exact packet sequence after seekingDerek Buitenhuis2015-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current behavior may produce a different sequence of packets after seeking, compared to demuxing linearly from the beginning. This is because the MOV demuxer seeks in each stream individually, based on timestamp, which may set each stream at a slightly different position than if the file would have been read sequentially. This makes implementing certain operations, such as segmenting, quite hard, and slower than need be. Therefore, add an option which retains the same packet sequence after seeking, as when a file is demuxed linearly.
* | avformat/mov: move edit list heuristics into mov_build_index()Clément Bœsch2015-01-02
| | | | | | | | | | mov_read_elst() is now only responsible from storing the table in a data structure; this is consistent with other table readers functions.
* | avformat/mov: check atom nesting depthMichael Niedermayer2014-12-16
| | | | | | | | | | | | | | Fixes call stack overflow Fixes: case1_call_stack_overflow.mp4 Found-by: Michal Zalewski <lcamtuf@coredump.cx> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>