This release is the result of #636 and includes over 400 improvements and bug fixes spanning almost every area of Mediabunny. The goal was to make Mediabunny maximally robust and to fix its bugs before anyone runs into them. Many of these flaws were found by a thorough LLM-assited audit of the entire codebase which took multiple weeks to fully review and test. The result is a library that's more reliable, resilient, correct, and should "just work".
InputTrack.idis now the track's 1-based index ingetTracks()for every format, making it unique in multi-segment Matroska files. Previously, it was the container's own track ID (such as the MPEG-TS PID or the Ogg serial number).- Added
InputTrack.getFirstTimestampOrNull()andInputTrack.computeDurationOrNull(), which returnnullinstead of 0 for tracks without packets - Added
WavOutputFormatOptions.appendOnlyfor writing WAVE files in an append-only fashion - Added support for setting
HlsOutputFormatOptions.targetDurationtoInfinityoutside of live mode, giving each playlist only a single segment - Added support for hybrid fragmented MP4 files, which hold samples both in the
moovbox and in subsequent fragments (such as FFmpeg's-movflags frag_keyframeoutput). Previously, all fragments were ignored. - Added read support for 64-bit float PCM in ISOBMFF
- Added read support for MP3 in MOV files with a
.mp3sample entry - Added support for ISOBMFF files without an
ftypbox - Added support for the ISOBMFF
sratbox, fixing high sample rates being misreported foripcm/fpcmtracks - Added support for reading the Matroska segment title (
Info\Title) as metadata - Added support for E-AC-3 dependent substreams in MPEG-TS, fixing 7.1 E-AC-3 being read as 6 channels with doubled timing
- Added support for reading Ogg start trimming
- Added support for VBRI headers in MP3 files
- Added support for AAC with a program config element (channel configuration 0) in ADTS and MPEG-TS
- Added support for writing 6.1 and 7.1 AAC to ADTS and MPEG-TS
- Added detection of ADTS and MP3 files holding just a single frame
- Added support for ADTS files with junk before or between frames
- Improved input format detection
- Improved tree shaking
- Added support for ID3v2.2
TXXframes - Added support for
fLaCin HLSCODECSattributes - Fixed MOV output writing sample rates of 65536 Hz and above as 0
- Fixed reading sample rates of 65536 Hz and above from ISOBMFF files
- Fixed ISOBMFF PCM tracks losing most of their data when their samples span more than one PCM frame
- Fixed ISOBMFF fragments without
tfdtdrifting by the composition delay with every fragment - Fixed concurrent reads of the same ISOBMFF fragment returning a partially processed fragment, which could surface undecrypted data
- Fixed all-ones
mdhddurations not being treated as unknown - Fixed
saiooffsets in fragments being resolved relative to themoofbox instead of the base data offset - Fixed wrong sample data in fragmented MP4 files without base data offsets when an unsupported track comes before
- Fixed track-level
©namnames including their length and language prefix - Fixed
psshboxes differing only in their key IDs being deduplicated - Fixed fragmented MP4 muxer marking key frames in the middle of a fragment as non-key frames
- Fixed fragmented MP4 muxer sometimes writing the
moovbox before all tracks' start offsets were known, leading to missing edit lists and A/V desync - Fixed fragmented MP4
mdatboxes of 4 GiB and larger being written with the wrong size - Fixed rare corrupt chunk offsets in MP4 files over 4 GiB written with
fastStart: 'in-memory' - ISOBMFF muxer now throws for fragments whose track data begins 2 GiB or more after the
moofbox, and for CMAF segments of 2 GiB or more or longer than about 20.7 hours, instead of silently writing broken offsets and durations - Fixed
onMoofreporting incorrectly shifted fragment start timestamps - Fixed
fastStart: 'in-memory'not working withAppendOnlyStreamTarget - Fixed
fastStart: 'reserve'including the trailingfreebox in the data passed toonMoov - Reduced peak memory use when finalizing MP4 files with
fastStart: 'in-memory'into aStreamTarget - Fixed WebVTT cues with zero duration hanging the ISOBMFF muxer
- Fixed touching WebVTT cues producing zero-length samples in ISOBMFF
- Fixed the WebVTT
ctimbox being written in seconds instead of milliseconds - Fixed fragmented MP4 output failing to finalize with a short WebVTT or E-AC-3 track
- Fixed disc number being written under the
disckey instead ofdisk - Fixed PCM with more than 16 bits per sample in MP4 being written with a QuickTime-only sound description, making it unplayable in AVFoundation
- AC-3 and E-AC-3 in MOV are now wrapped in a
wavebox, fixing E-AC-3 playback in AVFoundation - MP3 in MOV is now written with a
.mp3sample entry, fixing playback in AVFoundation - Fixed the ISOBMFF muxer hanging on
finalize()afterstart()or a track close threw - Fixed VP8's
vpcCbox being written with a bit depth of 0 - Fixed MOV
hdlrcomponent names being written as C strings instead of counted strings - Fixed the sample entry of FLAC in MP4 always stating 16 bits per sample (making browsers reject 24-bit FLAC) and a sample rate of 0 above 65535 Hz (#630)
- Fixed HE-AAC in Matroska reporting half its sample rate, as
OutputSamplingFrequencywas ignored - Fixed reading AAC from old Matroska files with legacy codec IDs like
A_AAC/MPEG4/LC/SBRand noCodecPrivate - Fixed TrueHD in Matroska taking the container's key flags at face value, which could make seeking start without a restart point
- Fixed Matroska audio in blocks with references being read as delta packets
- Matroska muxer now writes AAC's core sample rate as
SamplingFrequencyand addsOutputSamplingFrequencywhen SBR doubles it - Matroska AV1 codec info is now read from the
av1CinCodecPrivate, falling back to the first packet only when it holds no sequence header - Matroska demuxer now respects
DisplayUnit, and a loneDisplayWidthorDisplayHeightis no longer dropped - Fixed wrong display dimensions for stereoscopic Matroska video
- Fixed a Matroska cluster cut off by the end of the file being dropped entirely
- Fixed wrong track numbers in multi-segment Matroska files
- Fixed an unknown-size Matroska segment followed by another file (such as concatenated live recordings) reading that file's clusters
- Fixed Matroska projection yaw, pitch and roll being applied as 2D flips and rotation to 360-degree video
- Fixed the Matroska projection pose being misread when its elements come before
ProjectionType - Fixed laced Matroska frames getting timestamps off the tick grid, which could make
getPacket(packet.timestamp)return the previous packet - Fixed Matroska files with a
DocTypeVersionabove 4 (such as mkvmerge's v5 output) being rejected - Fixed Matroska packet durations derived from
DefaultDurationnot being whole ticks - Fixed empty Matroska elements not taking their default values (an empty
TimestampScalethrew, an emptyFlagDefaultread as 0) - Fixed an empty Matroska
FileUIDthrowing - Fixed EBML lacing with a single frame throwing
- Fixed EBML unknown sizes of 2 to 7 bytes not being recognized
- Fixed Matroska muxer writing a negative segment duration when all timestamps are negative
- Fixed Matroska muxer writing corrupt files when an element such as an attachment or a frame was 256 MiB or larger
- Fixed Matroska muxer writing
BlockDurationon the last block in decode order instead of presentation order, giving the last frame a duration of 0 with B-frames - Matroska muxer now writes
MaxBlockAdditionIDfor tracks with block additions (video with alpha, WebVTT) - WebVTT in WebM output is now written the way the WebM spec defines it (
D_WEBVTT/SUBTITLES) - Fixed the Matroska muxer hanging on
finalize()afterstart(), a track close orfinalize()threw - Fixed the validation error for
MkvOutputFormatOptions.onSegmentHeadernaming the wrong option - Matroska muxer no longer patches the color space into VP9 key frames, which zeroed the color space for BT.2020, corrupted RGB streams and modified the caller's packet data
- Fixed MPEG-TS muxer writing a DTS greater than the PTS for B-frames, which made FFmpeg reject the files
- Fixed MPEG-TS muxer writing non-increasing DTS when B-frames first appear later in a video
- Fixed malformed HEVC access unit delimiters in MPEG-TS output, which broke FFmpeg's bitstream filters
- Fixed HEVC access unit delimiters in MPEG-TS output having the wrong temporal layer for temporally scalable video
- Fixed MPEG-TS PIDs depending on which track's data came first, which made them change between HLS segments
- Fixed a rejected first AAC packet leaving the MPEG-TS track half set up, making every following packet fail
- Fixed the MPEG-TS muxer hanging on
finalize()afterstart()or a track close threw - Fixed PAT and PMT sections with a pointer field losing the program or its last stream
- Fixed private sections on the PMT PID being parsed as the PMT
- Fixed the PMT still being guessed from other PIDs after the PAT had named it
- Fixed MPEG-TS captures joined mid-broadcast truncating a PES packet that straddles the PAT and PMT
- Fixed MPEG-TS packet lookups near the start of a track reading data from before the PMT
- Fixed MPEG-TS init inputs not being read before use, which made segments without parameter sets throw
- Fixed a race in MPEG-TS
getNextPacketthat could skip a packet when called concurrently for the same packet (#640) - Fixed wrong MPEG-TS packet durations with B-frames when retrieving the next packet of the same packet a second time
- Fixed
getPacketreturning null in MPEG-TS for open-GOP leading frames, which are presented before the first packet in decode order - Fixed a multi-packet non-PES section on a track's PID ending the MPEG-TS stream early
- Fixed false ADTS sync words in AAC payloads ending MPEG-TS audio streams early
- Fixed a tiny final AVC slice in MPEG-TS being dropped or merged into the previous frame
- Fixed HEVC end of sequence and end of bitstream NAL units starting a new frame in MPEG-TS
- Fixed audio timestamps drifting within MPEG-TS PES packets that hold several frames
- Fixed MPEG-TS packets without a successor ignoring the codec's frame duration (a lone AAC packet had a duration of 0)
- Fixed the last key packet of intra-only AVC in MPEG-TS having a duration of 0
- Fixed negative MPEG-TS timestamps following a positive first timestamp being read as about 95443 seconds
- Fixed MPEG-TS audio frames only becoming available once the next PES packet began, delaying live streams (#635)
- Ogg muxer now writes streams that begin before the codec's usual start instead of shifting them forward. Packets too far before the start to be represented are dropped with a warning.
OggOutputFormat.negativeTimestampSupportis now'prefer-non-negative', allowing forced copy conversions with trims into Ogg- Removed end trimming from Ogg reading and writing, as packet durations can't properly signal it
- Ogg demuxer now throws for empty packets in the middle of a stream, which no supported codec allows (the empty final packet VLC writes is still supported)
- Fixed the Vorbis comment header in Ogg output lacking its framing bit, making libvorbis reject the files
- Fixed the Ogg muxer interleaving tracks with different sample rates by sample counts instead of time
- Fixed the Ogg muxer writing header pages after data pages in multi-track files
- Fixed the last page of an Ogg track that ended early being held back until finalization
- Fixed the Ogg muxer hanging on
finalize()afterstart()or a track close threw - Fixed Ogg seeking using the granule position of the page a packet starts on instead of the one it ends on
- Fixed Ogg packet lookups returning the wrong packet in files with a broken page chain
- Fixed seeking to the last Vorbis packet ahead of an empty final packet (as written by VLC) giving it the wrong duration
- Fixed truncated Ogg files reporting a duration of 0 and failing to find their last packet
- Fixed the Ogg MIME type reading
codecs=""for streams without known codecs - FLAC muxer now supports total sample counts of 2^32 and above
- FLAC muxer now throws for PICTURE and Vorbis comment blocks larger than 16 MiB instead of writing broken block lengths
- Fixed FLAC files at 12 or 64 kHz having no packets
- Fixed FLAC total sample counts of 2^32 and above being misread
- Fixed FLAC frame sample numbers of 2^31 and above being misread
- Fixed concurrent
getFirstPacket()calls on FLAC files corrupting the packet index - Fixed FLAC
getPacket()sometimes returning the previous packet due to floating point error - Fixed MP3, ADTS and FLAC
getPacket()at a packet's end timestamp sometimes returning that packet instead of the next one - Fixed broken FLAC PICTURE blocks for MIME types or descriptions with non-ASCII characters
- Fixed single-frame FLAC output having a minimum block size of 0, which FFmpeg rejects
- Fixed missing validation for
FlacOutputFormatOptions.onFrame - Fixed reading WAVE files whose header overstates the data size from unsized sources, such as FFmpeg's pipe output
- Fixed WAVE files with a placeholder data size reporting a huge duration from metadata
- Fixed unfinalized WAVE files, whose sizes are still 0, failing to load
- Fixed WAVE files over 4 GiB with placeholder sizes (as written by FFmpeg) being cut off at 4 GiB
- Fixed chunks following the data chunk in RF64 files, such as metadata, not being read
- Fixed WAVE
getPacket()returning the previous packet when given a packet's exact timestamp - Fixed RIFF INFO years being read in local time instead of UTC
- Fixed UTF-8 RIFF INFO strings, such as the ones FFmpeg writes, being misread
- Fixed the WAVE muxer not padding odd-sized data chunks
- WAVE muxer now writes
WAVE_FORMAT_EXTENSIBLEwith a channel mask for more than two channels and for integer PCM above 16 bits - WAVE muxer now writes a
factchunk for float, A-law and mu-law audio, except in append-only mode - Fixed the Xing/Info frame count of MP3 output including the Xing frame itself, making every file one frame too long
- Fixed the Xing frame of MP3 output claiming a CRC it didn't have
- The Xing frame of MP3 output now has the same bitrate as the first audio frame where possible, so that CBR files are constant bitrate throughout
- MP3 muxer no longer writes a Xing frame for Layer I and II audio, where decoders would play it as audio
- Fixed MP3 frame headers with a reserved MPEG version or sample rate index being accepted, causing false syncs
- Fixed MP3 files starting with junk that resembles a frame header not being detected
- Fixed junk between MP3 frames being read as frames
- Fixed trailing ID3v1 and APEv2 tags counting toward the estimated duration of CBR MP3 files
- ADTS muxer now throws for AAC configurations and frames that ADTS can't represent instead of writing corrupt headers
- Fixed ADTS reading stopping at ID3v2 tags between frames
- ADTS and MP3 streams now end with a warning where the sample rate changes, since a track can only have one sample rate
- ID3v2
COMMframes with a description (like iTunNORM) are no longer read as the comment - Fixed ID3v2.2 and ID3v2.3 tags with whole-tag unsynchronisation being misread (#631)
- Fixed ID3v2.4 tags with non-synchsafe frame sizes (as written by iTunes) being misread
- Fixed ID3v2 frames with a grouping identity or data length indicator being misread, which could lose all tags (#631)
- Fixed ID3v2.3 tags with the footer flag set being misread
- Fixed ID3v2.4 extended header sizes being misread
- Fixed compressed ID3v2.2 tags being misread; they're now skipped with a warning
- Fixed empty UTF-16 strings in ID3v2 being misread
- ID3v2 comment and lyrics frames with an invalid text encoding now throw like other text frames, instead of silently reading as nothing
- Fixed ID3v2 cover art MIME types being decoded with the wrong text encoding (#631)
- Fixed ID3v2.3 dates being misread, as the year (
TYER) and day and month (TDAT) weren't combined - Fixed ID3v2.4 dates with a time being read in local time instead of UTC
- Fixed ID3 years below 100 being misread or giving invalid dates
- Date tags in Vorbis comments, MP4, Matroska and RIFF INFO are now consistently parsed as ISO 8601
- RIFF
IDITtags are no longer read as the date - Fixed invalid ID3 years giving invalid dates
- Fixed an ID3 BPM of 0 making conversions fail
- Fixed ID3v2 lyrics and cover art with non-Latin-1 text being written with the wrong frame size
- Fixed cover art being duplicated when converting MP3 to MP3
- Fixed missing validation for
AttachedImage.nameandAttachedImage.description - Fixed HLS variant streams referencing undefined media groups losing their tracks
- Fixed the HLS
CHANNELSattribute of object-based audio (such as Dolby Atmos) being read as the channel count - Fixed HLS master playlists with only I-frame variants failing to load
- Fixed directly loaded HLS I-frame playlists not reporting their tracks as having only key packets
- Fixed several cases of relative URLs in HLS playlists being resolved incorrectly, such as protocol-relative URLs,
data:URIs and URLs with query strings - Fixed relative HLS paths starting with
../losing that part when resolved - Improved HLS query parameter parsing
- Fixed sparse fMP4 HLS segments with large timestamps being shifted by a timestamp wrap
- Fixed HLS packet lookups before the first segment's playlist time returning null
- Fixed HLS packet lookups at a packet's exact timestamp sometimes returning the previous packet
- Fixed
EXT-X-MAPtags discarding the duration or byte range of the following segment - Fixed live HLS playlists getting a wrong timeline when the window slid past all known segments between playlist reloads
- Fixed new segments of live HLS playlists losing their init data after a playlist reload
- Fixed wrong timing after a discontinuity in live HLS segments that slid out of the window between playlist reloads
- Fixed live HLS playlists jumping to Unix timestamps when date-times first appear after a playlist reload
- Fixed ended HLS playlists without segments waiting a target duration on every query
- Fixed
getUnixTimeForTimestamp()waiting for live HLS playlists to reach the given timestamp - VOD HLS media playlists now all state the longest segment duration as their target duration. Previously, it differed between playlists and never went below
targetDuration. - Renditions with the same name in an HLS group now get unique names, like "Audio (2)"
- Fixed HLS output with
fastStart: 'reserve'MP4 segments failing - Fixed HLS output failing for paired tracks that no single segment format can hold together; they're now split into separate renditions
- Fixed HLS I-frame tracks being grouped as video renditions
- Fixed HLS MP3 segments each starting with a Xing frame, which players decoded as an extra frame of silence
- HLS I-frame playlists now hold one I-frame per segment, as the spec requires
- HLS variants now list the codecs of every rendition in their groups in
CODECS, as the spec requires - Fixed HLS playlists failing to load when a variant lists several codecs of the same type, such as for a group of renditions with different codecs
- Fixed doubled
BANDWIDTHvalues and duplicatedCODECSentries for HLS variants whose own playlist is one of their renditions - Fixed HLS
BANDWIDTHvalues being computed over the wrong window for non-integer target durations - Fixed the HLS
RESOLUTIONattribute using the display aspect ratio as the size (giving16x9) - Fixed HLS master playlists using WebCodecs codec strings for FLAC and MP3 instead of
fLaCandmp4a.40.34 - Fixed
FORCED=YESbeing written for HLS audio and video renditions - Fixed floating point error sometimes making the HLS target duration one too high
- Fixed the HLS muxer throwing when all tracks of a playlist are closed at once (#633)
- Fixed
HlsOutputFormatOptionsaccepting NaN fortargetDurationandmaxLiveSegmentCount - HLS output format no longer lists WebVTT as supported, as it can't write subtitles yet
- Fixed HLS errors for unsupported audio codecs with delta packets (such as TrueHD) suggesting different segment formats, which can't help
- Fixed
Input.computeDuration()counting tracks without packets as ending at 0 - Fixed
InputVideoTrack.hasHighDynamicRange()reporting wide-gamut SDR video as HDR InputTrack.computePacketStats()now reports infinite rates for packets that all sit at a single instant, and reads pasttargetPacketCountuntil the packets span some time- Fixed conversions to MP4 with
fastStart: 'reserve'throwing for tracks whose packets all sit at a single instant - Fixed frame rate detection missing constant frame rates when the container's timescale can't represent the frame times exactly (such as 60 FPS in Matroska)
- Fixed MOV files with a 64-bit
ftypbox size being detected as MP4 - Fixed a disposed
Inputthrowing an internal error instead ofInputDisposedError - Fixed failed source reads being cached, so that later reads never retried
- Fixed faulty LRU source cache eviction logic
RangedSourcenow always reports its specified length as its size, and throws when the underlying data is too short for it- Fixed several cases of reading near the end of a file hanging or failing
- Fixed
FilePathSource,RangedSourceandCustomPathedSourcenot emittingreadevents - Fixed
UrlSourcewith aRangeheader emittingreadevents at the wrong positions - Fixed
FilePathSourceleaking file handles in several cases - Fixed
FilePathSourcenot working properly with short reads - Fixed
FilePathSourcethrowing an internal error instead ofInputDisposedErrorwhen disposed while opening - Fixed
CustomSourcecallinggetSizeonce for every concurrent first read - Fixed
CustomSourcenot cancelling streams returned byreadthat hold more data than requested - Fixed
ReadableStreamSourcenot cancelling its stream when disposed before reading - Fixed
UrlSourceignoring the headers of aRequestpassed as its URL - Fixed
UrlSourcerequests for other files (like HLS segments) incorrectly inheriting the settings of the root request - Fixed
UrlSourcewith a relative URL throwing outside of a window when the server doesn't support range requests - Fixed
UrlSourcefailing to read empty resources - Fixed
UrlSourcetaking capped range responses for the end of resources of unknown size - Fixed
UrlSourceretrying failed response reads forever (#638) - Fixed
UrlSourcekeeping requests running after errors - Fixed
UrlSourceerror messages sometimes showing[object Request]instead of the URL - Canceling an output now also closes the streams of
StreamTargets that were never started, which leaked file handles forFilePathTarget - Fixed
Output.cancel()failing and leaving targets open when a source or target stream had errored - Fixed
Output.cancel()during finalization resolving before the resources were released - A failed
Output.start()now cancels the output and releases its resources, like a failedfinalize()does - Fixed targets requested during cancellation being written to after being closed, or never being closed
- Fixed
Output.getMimeType()never settling after the output was canceled - Fixed unhandled promise rejections from
Output.targetwith a failing asyncPathedTargetcallback and from closing discarded targets - Fixed
FilePathTargetleaking its file handle after a write failure - Fixed a stack overflow when a chunked
StreamTargetwith a smallchunkSizereceived a large write - Fixed
AppendOnlyStreamTargetnever emittingfinalized - Fixed format callbacks such as
onMoofsometimes receiving wrong data - Fixed missing validation for the result of
OutputOptions.initTarget - Fixed
Qualityaccepting names of inherited object properties, like'toString', as quality levels Qualitynow scales Opus and Vorbis bitrates with the channel count, fixing multichannel Vorbis failing to encode- Fixed a typo in the error for too many tracks
MediaStreamAudioTrackSourceandMediaStreamVideoTrackSourcenow count queued samples toward the encoder's load, so they drop samples sooner under backpressure instead of queuing them up without limit- Invalid adds to
VideoSampleSource,CanvasSource,AudioSampleSourceandAudioBufferSourcenow throw synchronously, like for the packet sources - Fixed media sources accepting data added while they were still closing
- Fixed rare race conditions related to closing tracks
- Fixed some media source race conditions
- Fixed
MediaStreamVideoTrackSourcefailing for frames arriving while it shuts down; they're now dropped, like for audio - Fixed
MediaSource.close()failures becoming unhandled rejections and makingfinalize()hang - Fixed custom encoders never being closed after a failed call
- Fixed encoders being created while canceling or closing and never being closed
- Fixed muxer errors for packets emitted during the final encoder flush being lost
- Fixed
Output.finalize()succeeding without a track whose encoder failed to initialize - Fixed errors thrown while handling encoder output being swallowed
- Fixed adding audio to an encoder that had failed throwing a misleading error
- Fixed the first video frame sometimes not being encoded as a key frame when its timestamp is negative
- Fixed
sizeChangeBehaviorset to'fill','contain'or'cover'not applying to frames of the original size - Fixed
VideoTransformOptions.alphabeing ignored - Fixed missing validation for
VideoTransformOptions.alpha - Fixed encoding video with alpha losing the source's color space
- Fixed
CanvasSourceandMediaStreamVideoTrackSourceleaking a video frame per frame whentransform.frameRateis set - Fixed an audio
processfunction returning its input sample closing the caller's sample - Fixed empty audio samples making the encoder throw
- Fixed a
MediaStreamVideoTrackSourcepaused before its first frame throwing repeatedly - Fixed
MediaStreamVideoTrackSourceaccepting non-finite frame rates, which could hang - Fixed
MediaStreamVideoTrackSourcefailing to start in Safari - Fixed the audio context fallback of
MediaStreamAudioTrackSourcenever being closed - Fixed VP8 and VP9 video with hidden frames stored as separate packets getting increasingly wrong timestamps (#642)
- Fixed video frame timestamps sometimes being shifted after seeking
- Fixed the first GOP of AVC and HEVC video with alpha decoding without alpha in Chromium
- Fixed alpha merging ignoring backpressure
- Fixed video with alpha losing its color space and display size
- Fixed decoders sometimes not being closed after errors
- Fixed sample iterators sometimes leaving their decoder open after
return()orthrow(), or when the mapping incanvases()orbuffers()threw - Fixed samples queued behind a failed alpha merge never being closed
- Fixed PCM sample timestamps drifting, which could duplicate samples
- Fixed PCM decoding sometimes returning no samples after a seek
- Fixed tiny PCM packets producing empty samples
- Fixed
AudioSamples created from raw data referencing that data instead of copying it - Fixed
VideoSamplelosing the last chroma column of odd-width subsampled formats when copied - Fixed
VideoSamples created from raw data ignoring the offset of their visible rect - Fixed
VideoSample.copyTo()with an RGB/BGR conversion corrupting pixels for layouts whose offset or stride isn't a multiple of 4, and overwriting the bytes before the layout's offset - Fixed
VideoSample.drawWithFit()not clamping the crop, and leaving the context transformed when throwing - Fixed
VideoSample.transform()dropping encode options - Fixed resource leaks when constructing a
VideoSampleorAudioSamplefailed, and when converting aVideoSamplefrom YUV to RGB failed - Fixed
VideoSamplethrowing internal errors instead of aTypeErrorfor wrong layout plane counts, empty visible rects and closedVideoFrames - Fixed
AudioSamplerejectingSharedArrayBufferdata - Fixed missing validation for negative
AudioSamplechannel counts - Fixed empty
AudioSamples not being copyable - Fixed interlaced AVC being reported at half its height (#634)
- Fixed HEVC SPS with inter-predicted short-term or long-term reference pictures being misparsed, giving wrong aspect ratios and colors
- Fixed several AVC SPS parsing issues
- Fixed VP9 RGB key frames (profiles 1 and 3) being misparsed, giving wrong codec strings
- Fixed some AV1 codec strings having a wrong level, which browsers could reject
- Fixed VP9 codec strings with level 0 when the file doesn't state a level, which browsers reject
- Fixed AV1 hidden key frames being determined as key packets
- Fixed avcC records of some AVC profiles (like 4:4:4 from x264) losing their extension fields
- Fixed hvcC records putting prefix and suffix SEI into one array
- HEVC is now encoded with
hvc1codec strings by default instead ofhev1 - HEVC codec strings read from ISOBMFF files now start with
hvc1orhev1depending on the file's sample entry, instead of alwayshev1 - Fixed missing color info for ProRes frames with a minimal frame header
- Fixed ProRes video with an unknown color matrix being treated as RGB
- Fixed 7.1 E-AC-3 being reported as 7 channels
- Fixed 7.1 E-AC-3 muxed into MP4 being declared as 5.1
- Fixed the way E-AC-3 is read from and written to ISOBMFF
- Fixed ambisonic Opus with a demixing matrix (channel mapping family 3) losing the matrix in ISOBMFF
- Fixed DTS-ES and DTS 96/24 being declared as plain DTS when written to ISOBMFF
- Fixed
canDecodeVideo()andcanDecodeAudio()returning cached results for configs that only differ in their description - Fixed
canDecodeVideo()ignoring the given size when choosing the codec string's level - Fixed
canEncodeVideo()leaking its probe encoder in Firefox - AAC encoding now defaults to AAC-LC at all sample rates instead of requesting HE-AAC at 24 kHz and below
- Fixed
canDecode()not returning a promise for subtitle codecs - Fixed cover art stored in Vorbis comments being duplicated in FLAC to FLAC conversions
- Conversion errors for tracks that can't be encoded now point to the DTS and TrueHD extension packages, and to
@mediabunny/serverin server-side environments - Fixed a conversion staying stuck in the executing state when starting it failed
- Fixed canceling a conversion early throwing a generic error instead of
ConversionCanceledError - Fixed unhandled promise rejections when writing a conversion's output failed
- Fixed conversions reaching the
'done'state before their output had finalized, or even when finalizing failed - Fixed the index passed to conversion track option callbacks not matching the track number when only primary tracks are converted
- Fixed zero-duration video frames inside the trim range being dropped when transcoding
- Fixed trimmed copies of audio with delta packets (such as TrueHD) losing audio at the start
- Fixed conversions discarding audio tracks instead of falling back to PCM when no compressed codec can be encoded
- Fixed conversion progress being reported as NaN when there's nothing to convert
- Fixed long gaps in audio allocating all of their silence padding at once, which could take gigabytes of memory
- Fixed a broken error message for requested codecs the output format can't contain
- Fixed conversions of implicitly signaled HE-AAC failing for formats like WAVE when the audio starts late
- Fixed
onceevent listeners being called twice during nested emits, and looping forever when re-registered while being emitted - Fixed
EncodedPacket.clone()keeping the originalbyteLengthwhen given new data - Fixed AES-128 encrypted HLS segments being kept in memory after a failed read
- Fixed a WebVTT cue without a payload at the end of the text taking the whole text as its payload
- Fixed WebVTT cues with hours above 99 being dropped
- Fixed WebVTT text starting with a byte order mark failing to parse
@mediabunny/server: Decoding and encoding now use multiple threads where the codec supports it, making them faster@mediabunny/aac-encoder,@mediabunny/flac-encoder,@mediabunny/mp3-encoder,@mediabunny/ac3,@mediabunny/dts,@mediabunny/truehd: Slightly faster encoding and decoding@mediabunny/aac-encoder,@mediabunny/flac-encoder,@mediabunny/mp3-encoder,@mediabunny/ac3,@mediabunny/dts,@mediabunny/truehd: Fixed a memory leak in browsers and Deno with every worker created@mediabunny/ac3,@mediabunny/dts,@mediabunny/truehd: Fixed a failure to create the codec worker breaking the extension for good instead of being retriable@mediabunny/ac3: Fixed E-AC-3 with several syncframes per packet failing to decode@mediabunny/ac3: Fixed the last decoded audio being dropped when flushing@mediabunny/ac3: Fixed wrong decoded timestamps when the stream's sample rate differs from the track's@mediabunny/ac3: Fixed decoding of streams with more than 8 channels@mediabunny/ac3: Fixed the last 256 samples being lost when encoding@mediabunny/ac3: Fixed 3 channels being encoded as 2.1, losing the third channel, and 4 channels as 4.0 instead of quad@mediabunny/ac3: Fixed support being claimed for channel counts, sample rates and bitrates the encoder rejects@mediabunny/ac3: Fixed slow encoding of very large samples@mediabunny/dts: Fixed encoded audio being 512 samples late and losing its end; the first packet now starts 512 samples before the input to account for the encoder delay@mediabunny/dts: Fixed wrong decoded timestamps when the stream's sample rate differs from the track's@mediabunny/dts: Fixed decoding of streams with more than 8 channels, such as DTS:X@mediabunny/dts: Fixed slow encoding of very large samples@mediabunny/dts: Fixed the encoder not being reusable after a flush@mediabunny/dts: Fixed float audio being truncated instead of rounded when encoding, which also overflowed at full scale@mediabunny/dts: Fixed low quality settings being unsupported for multichannel audio; such bitrates now encode at the lowest bitrate DTS allows@mediabunny/truehd: Fixed encoded streams shorter than 16 access units being unmuxable; they're now padded with silence@mediabunny/truehd: Fixed wrong decoded timestamps when the stream's sample rate differs from the track's@mediabunny/truehd: Fixed wrong decoded timestamps for packets holding several access units@mediabunny/truehd: Fixed float audio being truncated instead of rounded to 24 bits when encoding@mediabunny/aac-encoder: 7- and 8-channel audio is now encoded with channel configurations 11 and 12 instead of a program config element, which QuickTime silently dropped@mediabunny/aac-encoder: Fixed 3 channels being encoded as 2.1, losing the third channel@mediabunny/aac-encoder: Fixed 4 channels being encoded as 4.0 instead of quad@mediabunny/aac-encoder: Fixed the encoder not being reusable after a flush@mediabunny/aac-encoder: Fixed slow encoding of very large samples@mediabunny/flac-encoder: Fixed the encoder not being reusable after a flush@mediabunny/flac-encoder: Fixed float audio being truncated instead of rounded to 24 bits@mediabunny/mp3-encoder: Fixed packet timestamps drifting for large start timestamps@mediabunny/mp3-encoder: Fixed encoder errors producing garbage output instead of throwing@mediabunny/mp3-encoder: Fixed failures to initialize the encoder going unnoticed@mediabunny/prores: Fixed the pixel aspect ratio and color space set by the container being ignored@mediabunny/prores: Fixed corrupted alpha in Safari for frames whose coded height exceeds their visible height@mediabunny/prores: Fixed flushing resolving before the last frames were emitted@mediabunny/prores: Fixed 4:3 and 16:9 aspect ratios in the frame header being treated as pixel aspect ratios@mediabunny/server: 4-channel AAC can now be encoded as ADTS@mediabunny/server: Fixedrequire('@mediabunny/server')throwing@mediabunny/server: Fixed wrong decoded audio timestamps for some time bases@mediabunny/server: Fixed a crash for planar audio with more than 8 channels@mediabunny/server: FixedVideoSample.transform()emptying the source frame, dropping encode options and the color matrix and range, and leaking memory when copying failed@mediabunny/server: FixedVideoSample.transform()ignoringalpha: 'discard'@mediabunny/server: Fixed video with an unknown pixel aspect ratio throwing@mediabunny/server: Fixed I420AP12 video samples failing to convert@mediabunny/server: Fixed HEVC key frames forced close together being dropped@mediabunny/server: Fixed VP8 encoding with alpha failing@mediabunny/server: Fixed ProRes 4444 being encoded with 4:2:2 chroma subsampling@mediabunny/server: Fixed an AVC quantizer of 0 switching to lossless encoding, which could break decoding@mediabunny/server: Fixed precise video timestamps being lost or wrong after flushing@mediabunny/server: Fixed some AV1 streams that browsers can decode failing to decode@mediabunny/server: Fixed support being claimed for AAC, Opus, E-AC-3 and Vorbis channel counts and sample rates the encoders reject@mediabunny/server: Fixed 3- and 5-channel AAC, AC-3 and E-AC-3 encoding failing@mediabunny/server: Fixed 3- and 4-channel TrueHD being remixed instead of encoded losslessly@mediabunny/server: Fixed encoded DTS being 512 samples late@mediabunny/server: Fixed low quality settings being unsupported for DTS; such bitrates now encode at the lowest bitrate DTS allows@mediabunny/server: Fixed AC-3, E-AC-3 and DTS encoding losing the end of the audio@mediabunny/server: Fixed FLAC encoding reducing 24-bit and floating-point audio to 16 bits@mediabunny/server: Fixed FLAC and TrueHD encoding adding silence to the end of the audio@mediabunny/server: Fixed the video decoder ignoring the color space from the decoder config