Repository navigation
mp4ff v0.61.0 decodes Apple Lossless (ALAC) sample entries with their magic cookie, encrypts VP9 with cenc, and round-trips QuickTime .mov files much better: video sample entry fields, movie and track header fields, the mvhd matrix, udta terminators and the SliceWriter path for QuickTime metadata and mfra. Many decoding and encoding paths now return errors instead of panicking on files that lack boxes, and 32-bit architectures are supported and tested.
Breaking change: DataBox now keeps its type and locale, so a DataBox built for text must set DataType: mp4.DataTypeUTF8; without it, it is written with type 0.
Added
alac(Apple Lossless) sample entries decode asAudioSampleEntryBoxandStsdBox.Alac, with the magic cookie as
AlacBoxinAudioSampleEntryBox.Alac, or inWaveBox.Alacfor QuickTime filesInitProtectandExtractInitProtectDatasupport VP9 (vp09) with scheme cenc, andGetVP9ProtectRanges
gives the subsample protection ranges of a VP9 sample
Changed
DecModeLazyMdatalso skips the payload offreeandskipboxes;FreeBox.Payloadis then nil and
FreeBox.Encodewrites zeros of the original payload sizeDataBoxkeeps its type and locale in the newDataType,CountryandLanguagefields instead of always writing
type 1 (UTF-8) and locale 0, so aDataBoxwith text needsDataType: DataTypeUTF8
Fixed
ExtractInitProtectDataacceptsavc3andhev1sample entries, asInitProtectalready doesDecodeFilewithDecModeLazyMdatreturns an error for an mdat size abovemath.MaxInt64instead of loopingSgpdBoxdecodes entries withdescriptionLength0, such astsas, and checks that every entry is exactly
descriptionLengthbytes- On 32-bit architectures,
hevc.ParseSPSNALUnitandhevc.ParseVPSNALUnitread the 48-bit constraint flags of
the profile, tier and level, and thebitsreaders and writers handle up to 32 bits at any bit position - On 32-bit architectures,
File.CopySampleDatacopies chunks of 2 GiB or more, and sizes beyond theintrange in
mdat,stsc,BoxSeekReader.Seek,ivf.Reader.ReadFrameand the IAMF parser give errors instead of wrong data bits.EBSPWriter.WriteExpGolombandbits.FixedSliceWriter.WriteExpGolombwrite values up to 2^32-1 at any bit
positionbits.FixedSliceReader.SkipBytesandbits.EBSPReader.ReadBytesset an error for a negative or too large length
instead of moving backwards or panickinghevc.DecodeHEVCDecConfRec,hevc.DecodeLHEVCDecConfRecandvvc.DecodeVVCDecConfRecstop at the end of the
record, instead of adding or allocating an empty NAL unit for each one that the record announces but does not hold- Decoding a
trafwithouttfhd, withDecodeBox,DecodeBoxSR,DecodeFileorFragmentDecoder, returns an
error instead of aTrafBoxwith a nilTfhd MoovBox.IsEncrypted,MoovBox.GetSinf,DecodeFile,DecodeFileSR,FragmentDecoderandInitDecodeStreamno
longer panic on a track without the boxes down to its sample entry or stts, or on an emptysaioor seigsgpdTrakBox.GetNrSamples,GetSampleData,GetRangesForSampleIntervalandFile.CopySampleDatareturn 0 or an
error instead of panicking or using chunk offset 0 when the track lacks a box of its sample tableMoofBox.Encode,File.UpdateSidx,MediaSegment.Fragmentify,InitSegment.GetMediaTypeand theFragmentmethods
Encode,GetSampleInterval,GetSampleNrFromTimeandAddSampleIntervalhandle missing boxes instead of panickingInitProtect,ExtractInitProtectData,DecryptInit,DecryptSegment,DecryptFragmentandRemoveEncryption
return an error instead of panicking when a box they need is missing, orExtractInitProtectDatagets a clear initmp4ff-crop,mp4ff-decrypt,mp4ff-mvhevc,mp4ff-nallister,mp4ff-pslisterandmp4ff-subslistergive an
error, or skip the track, instead of panicking on a file without a box they need- The segmenter example segments a video track without
stss, in which every sample is a sync sample, and gives an
error instead of panicking on a file without video track or without a box it needs hevc.ParseSPSNALUnitrefuses a coding tree block outside 16x16..64x64 or a picture size that is not a multiple of
the minimum coding block, andhevc.ParseSliceHeadergives an error instead of dividing by zero on such an SPS- cbcs encryption of AVC and HEVC in
GetAVCProtectRanges,GetHEVCProtectRangesandFragmentEncryptorparses
slice headers with the SPS and PPS that the samples carry, not only with those of the decoder configuration record MetaBox.EncodeSWwrites a QuickTimemetabox without version and flags, asEncodedoes, soFile.EncodeSWno
longer fails with an overflow on.movfiles with QuickTime metadataVisualSampleEntryBoxkeeps the QuickTime version, revision level, vendor, temporal and spatial quality, depth and
color table ID in new fields, instead of writing ISO defaults, so.movvideo sample entries round-tripFile.EncodeSWwrites themfrabox of a fragmented file, asFile.Encodedoesudtaboxes decode when fewer bytes than a box header follow the last child, such as the 32-bit zero that ends the
QuickTime user data list; the bytes are kept in the newUdtaBox.TrailingBytesand written backMvhdBoxkeeps its transformation matrix in the newMatrixfield instead of always writing the unity matrixMvhdBox,MdhdBoxandTkhdBoxkeep the values that QuickTime files may have in ISO pre_defined and reserved
fields: the preview, poster, selection and current times ofmvhd, the quality ofmdhdand atkhdreserved field