Commit Graph
37 Commits
Author SHA1 Message Date
Vanilagy f767b6f601 Fix AVC software decoder sometimes dropping B-frames (fixes #488) 2026-09-09 16:55:06 +02:00
Vanilagy a1ba54d337 Implement more powerful copy conversions, add conversion copy config, add OutputFormat.negativeTimestampSupport, fix Matroska duration from metadata computation 2026-09-08 14:42:03 +02:00
Vanilagy da18ceeb24 Add smpte170m vp9 test for CI stability, add missing VP9 color spaces in parser 2026-08-29 20:08:57 +02:00
Vanilagy d44253c7d3 Fix incomplete parsing and generation of AacAudioSpecificConfig (fixes #471) 2026-08-26 13:40:14 +02:00
0f9dc1f91b Fix tenc fallback for encrypted ISOBMFF files (#470)
* fix tenc fallback

* Add test case

---------

Co-authored-by: Vanilagy <[email protected]>
2026-08-24 14:12:04 +02:00
Vanilagy 6b5ae29252 Add Annex B in MP4 test 2026-08-21 20:12:50 +02:00
Vanilagy 914907b5db Define DTS codec, add muxing and demuxing support across ISOBMFF, Matroska, and MPEG-TS, add DTS encode/decode support to @mediabunny/server 2026-08-15 16:19:12 +02:00
Vanilagy dc068a0aa8 Add computeFrameRateMetrics and heuristics to determine a video's true frame rate 2026-08-12 16:10:28 +02:00
Vanilagy bfd4059c22 Add advanced access unit delimination logic to MPEG-TS demuxer (fixes #414), ignore irrelevant PIDs in MPEG-TS metadata reading 2026-06-17 17:16:39 +02:00
Vanilagy 85a80972a0 Make MP3 next frame location more strict for better recovery (fixes #382), fix Date timezone for ID3 tags 2026-05-22 11:31:26 +02:00
Vanilagy a0574fa09a Fix decoded audio always starting at 0, fix startTimestamp=0 for ranged media iterators (fixes #370) 2026-05-13 18:54:45 +02:00
Vanilagy 2e933ee5fc Merge branch 'main' into sample-resources 2026-05-04 17:23:45 +02:00
Vanilagy 2f576aa486 Add fan-out API to Conversion API, fix erroneous track count validation 2026-04-14 16:27:02 +02:00
Vanilagy 587e98391e Merge branch 'main' into hls 2026-03-19 16:52:00 +01:00
Vanilagy 0d50526ff6 Fix incorrectly-written video rotation metadata even when rotation is baked into the video (fixes #329) 2026-03-19 14:25:40 +01:00
Vanilagy b0604150c1 Merge branch 'main' into hls 2026-02-26 15:53:46 +01:00
Vanilagy bb4749cd8d Add support for reading/writing non-square pixel video frames (fixes #309) 2026-02-25 17:16:33 +01:00
Vanilagy 68b3ae7155 A BUNCH of HLS (and related) progress
- Add support for fMP4 segments
- Add initInput (supported by ISOBMFF and MPEG-TS)
- Input.isSupported()
- Refactored file size retrieval logic, the file size can now be retrieved alongside the first read.
- Add support for unsized UrlSources
- Add support for multiple trun boxes in a row for the same track (as the spec literally says lol)
- Add support for more M3U8 features
- Fix faulty line reader
- MPEG-TS improvements: support video parameters not in first packet, support better key frame detection, support extension PES packets without PTS
- Fix reorder buffer being 1 element too small
2026-02-20 19:56:20 +01:00
2876197631 Fix WaveDemuxer reading too far in corrupted ID3 chunk (#301)
* Update read-mp4.test.ts

* Fix the bug

* Delete read-wav.test.ts

* Submit test file

* Small adjustments

---------

Co-authored-by: Vanilagy <[email protected]>
2026-02-16 10:48:07 +00:00
417c85d8ed feat(codec): add detection support for AC-3, E-AC-3 audio codecs (#275)
* ac3/eac3 detection

* fix tests

* review pass + follow codebase comments style

* Add ac3/eac3 to docs

* WIP mpeg-2

* Set registration_descriptor

* add support for ac3 system b in mpeg-ts

* Update docs with ac3 in .ts support

* fix formatting

* Remove default to fix linter

* Add eac3 to mpeg-ts

* fix formatting

* Fix failing test

* Refactor AC3/EAC3 code a little

---------

Co-authored-by: Vanilagy <[email protected]>
2026-02-11 15:23:12 +01:00
Vanilagy 92454b28f7 Use random_access_indicator for key packet detection, rewrite packet lookup algorithm to use a chunked approach to perform better over the network 2026-01-23 13:16:41 +01:00
Vanilagy 6c78a0ff09 Fix HEVC not being encodable in CI 2026-01-19 10:25:57 +01:00
Vanilagy c3a3eb6abf Merge remote-tracking branch 'origin/main' into mpeg-ts 2026-01-16 21:04:14 +01:00
Vanilagy e8b27768a9 Add MPEG-TS muxer, fix a demuxer bug, remove Infinity from output format track counts 2026-01-16 16:33:28 +01:00
Vanilagy e3ee9d91a9 Add MP3 support to MPEG-TS demuxer 2026-01-16 10:28:00 +01:00
Vanilagy c0f2693cb3 Add HEVC support to MPEG-TS demuxer 2026-01-16 10:05:40 +01:00
Vanilagy 045df3b9a5 Make ADTS demuxer spit out ADTS packets instead of AAC, make ADTS muxer accept both AAC and ADTS input 2026-01-14 13:52:46 +01:00
Vanilagy 888441232d Implement the bulk of the MPEG-TS demuxer, add a bunch of tests, and a few other things 2026-01-14 12:05:39 +01:00
Igor Samokhovets a89101ff40 Fix OGG Vorbis decoding error for files with empty EOS pages (VLC-encoded) 2026-01-13 13:45:43 +01:00
Vanilagy 700a95ac35 Merge branch 'main' into sample-resources 2025-12-30 17:22:40 +01:00
Vanilagy c86af052f5 Add test for Annex B to length-prefixed conversion 2025-12-19 16:04:27 +01:00
Vanilagy 81d3d1e6a4 Add VideoSampleResource and AudioSampleResource 2025-12-17 11:14:12 +01:00
David P.andGitHub fa4e064345 Transparent video read/write support (#145)
* Add support for reading transparent Matroska and implement alpha side data & decode

* Few fixes

* Implement alpha encoding

* Gracefully handle inability to acquire WebGL context, properly clean up WebGL contexts

* Improve touch device detection

* Test test

* Test test #2

* Test test 3

* Test test 4

* Test test 5

* Test test 6

* Test test 7

* Test test 8

* Test test 9

* Test test 10

* Test test 11

* Test test 12

* Test test 13

* Test test 14

* Test test 15

* Test test 16

* Test test 17

* Test test 18

* Test test 19

* Test test 20

* Fix type errors, improve MetadataTags docs

* Do a bunch of docs work

* Test test?

* "Unexpected only modifier 🤓"

* Add InputVideoTrack.canBeTransparent()

* Some clean-up

* Adjust CI to be less spammy in PRs

* Fix broken license headers
2025-09-24 21:20:14 +02:00
6aee4e6a6a Fix WAV files with embedded ID3 metadata returning empty tags (#110)
* Read ID3v2 tags from WAV file

* remove js import

Co-authored-by: David P. <[email protected]>

* revert slicing in wave-demuxer.ts and add id3.ts for further sharing

* Add `writeId3Tag` to the `WavOutputFormat` constructor options

* add more context in private and public APIs that it's non-standard

* compare actual values in the test with real file

* remove unnecesarry double slice requesting

* trim test audio file (i tried my best to preserve ID3, including artwork)

* Couple of code cleanups

* const -> using

* Fix linting errors

---------

Co-authored-by: David P. <[email protected]>
2025-09-22 14:06:06 +02:00
d426d36386 FLAC container support (#95)
* add a test

* recognize as input format

* scaffold flac demuxer

* implement getting metadata

* Implement mime type

* read all metadata + deduplicate stubs

* Read first packet

* copyright headers

* read the first packet

* Get entire first packet, work on advancing

* iterate over all samples

* testable with bun

* stub out metadata support

* parse descriptive metadata

* All in 1 file

seems more appropriate to the philosophy

* some parameters are not needed anymore all within 1 class

* skip over bytes we are sure are not the syncword

* run prettier

* timestamp is determined based on passed blocks, not maximumBlockSize

* no binary search needed!

* simplifications

* Finish demuxer reading sequentially

* more tests + add a file with a seektable

* don't throw if (this.audioInfo.minimumBlockSize !== this.audioInfo.maximumBlockSize

* Add docs

* Update format compatibility table

* Simplification

* confirm conversion is working

* Finish

* Resolve TODO comment

* Support images (read-only)

* Returning description as Uint8Array

* Cleanup of demuxer

* Misc renames

* Object on same line

* Resolve first batch of comments

* Throw errors on corrupt blocks, correctly use requestSlice()

* Fix description field

* Explain why last frame is a bit shorter

* Add FLAC to README

* Put track backings below demuxer

* convert to methods

* Reorder container checking

* getBlockSize() -> readBlockSize()

* bitStream -> bitstream

* better naming for bytes

* use .skip()

* Don't return blockSize twice in readFlacFrameHeader

* Use enum + switch to distinguish Flac block types

* Use else-if

* Use else-if

* Compressed switch statement

* readCodedNumber

* Update flac-misc.ts

* We don't need the bits variable at all

* reorder functions in flac-demuxer

* Handle gracefully not being able to load another sample

* Update flac-demuxer.ts

* blockingbit null

* use async instead of promise.resolve

* use binary search

* Replace recursion with while loop

* Add mutex to getPacket()

* Load more data not in getPacketAtIndex, but outside

* Apply suggestion from @Vanilagy

Co-authored-by: David P. <[email protected]>

* computeDuration() reads last packet

* Update flac-demuxer.ts

* share vorbis comment reading logic

* reuse vorbis comment writing logic, set vendor always to "Mediabunny"

* flush after writign

* Use FileSlice.tempFromBytes

* assert !== null

* fixing nitpicks

* apply suggestions

* fix ogg

* We are now muxing images

* apply suggestion

* Update src/flac/flac-muxer.ts

Co-authored-by: David P. <[email protected]>

* apply suggestion

* readSampleRate()

* seek outside writeHeader()

* mention vorbis metadata +  add to metadatatags comment

* should be able to -> can

* Add test in metadata tags

* Add test for packets being byte identical after remuxing

* compare to null

* no casting to uint8array

* make test pass

* Update flac-muxer.ts

* Call validateAudioChunkMetadata() and validateAndNormalizeTimestamp()

* `onFrame` option

* emit frames using onFrame

* Run prettier over files

* Fix FLAC PICTURE block logic, small other changes

* Update docs

* Remove .only modifier

* fix remuxing and add test

* Don't throw error if parsing fails in header, since hitting a syncword might just be coincidential

* Fix remaining type errors

---------

Co-authored-by: David P. <[email protected]>
2025-09-18 21:05:09 +02:00
Vanilagy bd99d8f28f Add metadata tests, fix a few bugs 2025-09-05 21:42:26 +02:00
Jonny BurgerandGitHub f13a2e6732 Merge pull request #86 from JonnyBurger/url-source-allow-reading-small-files
Do not make UrlSource fail if the size of the file is smaller than 512kb (+ add a Vitest browser mode test)
2025-09-03 18:13:42 +02:00