Skip to content

v0.61.0

Latest

Choose a tag to compare

@tobbee tobbee released this 27 Oct 13:52
· 30 commits to master since this release

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 as AudioSampleEntryBox and StsdBox.Alac, with the magic cookie as
    AlacBox in AudioSampleEntryBox.Alac, or in WaveBox.Alac for QuickTime files
  • InitProtect and ExtractInitProtectData support VP9 (vp09) with scheme cenc, and GetVP9ProtectRanges
    gives the subsample protection ranges of a VP9 sample

Changed

  • DecModeLazyMdat also skips the payload of free and skip boxes; FreeBox.Payload is then nil and
    FreeBox.Encode writes zeros of the original payload size
  • DataBox keeps its type and locale in the new DataType, Country and Language fields instead of always writing
    type 1 (UTF-8) and locale 0, so a DataBox with text needs DataType: DataTypeUTF8

Fixed

  • ExtractInitProtectData accepts avc3 and hev1 sample entries, as InitProtect already does
  • DecodeFile with DecModeLazyMdat returns an error for an mdat size above math.MaxInt64 instead of looping
  • SgpdBox decodes entries with descriptionLength 0, such as tsas, and checks that every entry is exactly
    descriptionLength bytes
  • On 32-bit architectures, hevc.ParseSPSNALUnit and hevc.ParseVPSNALUnit read the 48-bit constraint flags of
    the profile, tier and level, and the bits readers and writers handle up to 32 bits at any bit position
  • On 32-bit architectures, File.CopySampleData copies chunks of 2 GiB or more, and sizes beyond the int range in
    mdat, stsc, BoxSeekReader.Seek, ivf.Reader.ReadFrame and the IAMF parser give errors instead of wrong data
  • bits.EBSPWriter.WriteExpGolomb and bits.FixedSliceWriter.WriteExpGolomb write values up to 2^32-1 at any bit
    position
  • bits.FixedSliceReader.SkipBytes and bits.EBSPReader.ReadBytes set an error for a negative or too large length
    instead of moving backwards or panicking
  • hevc.DecodeHEVCDecConfRec, hevc.DecodeLHEVCDecConfRec and vvc.DecodeVVCDecConfRec stop 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 traf without tfhd, with DecodeBox, DecodeBoxSR, DecodeFile or FragmentDecoder, returns an
    error instead of a TrafBox with a nil Tfhd
  • MoovBox.IsEncrypted, MoovBox.GetSinf, DecodeFile, DecodeFileSR, FragmentDecoder and InitDecodeStream no
    longer panic on a track without the boxes down to its sample entry or stts, or on an empty saio or seig sgpd
  • TrakBox.GetNrSamples, GetSampleData, GetRangesForSampleInterval and File.CopySampleData return 0 or an
    error instead of panicking or using chunk offset 0 when the track lacks a box of its sample table
  • MoofBox.Encode, File.UpdateSidx, MediaSegment.Fragmentify, InitSegment.GetMediaType and the Fragment methods
    Encode, GetSampleInterval, GetSampleNrFromTime and AddSampleInterval handle missing boxes instead of panicking
  • InitProtect, ExtractInitProtectData, DecryptInit, DecryptSegment, DecryptFragment and RemoveEncryption
    return an error instead of panicking when a box they need is missing, or ExtractInitProtectData gets a clear init
  • mp4ff-crop, mp4ff-decrypt, mp4ff-mvhevc, mp4ff-nallister, mp4ff-pslister and mp4ff-subslister give 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.ParseSPSNALUnit refuses a coding tree block outside 16x16..64x64 or a picture size that is not a multiple of
    the minimum coding block, and hevc.ParseSliceHeader gives an error instead of dividing by zero on such an SPS
  • cbcs encryption of AVC and HEVC in GetAVCProtectRanges, GetHEVCProtectRanges and FragmentEncryptor parses
    slice headers with the SPS and PPS that the samples carry, not only with those of the decoder configuration record
  • MetaBox.EncodeSW writes a QuickTime meta box without version and flags, as Encode does, so File.EncodeSW no
    longer fails with an overflow on .mov files with QuickTime metadata
  • VisualSampleEntryBox keeps the QuickTime version, revision level, vendor, temporal and spatial quality, depth and
    color table ID in new fields, instead of writing ISO defaults, so .mov video sample entries round-trip
  • File.EncodeSW writes the mfra box of a fragmented file, as File.Encode does
  • udta boxes 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 new UdtaBox.TrailingBytes and written back
  • MvhdBox keeps its transformation matrix in the new Matrix field instead of always writing the unity matrix
  • MvhdBox, MdhdBox and TkhdBox keep the values that QuickTime files may have in ISO pre_defined and reserved
    fields: the preview, poster, selection and current times of mvhd, the quality of mdhd and a tkhd reserved field