Commit Graph
110 Commits
Author SHA1 Message Date
Vanilagy a15283eaa3 Add @mediabunny/flac-encoder extension, clean up some other code, fix incorrect top-level tsconfig 2026-03-04 21:21:52 +01:00
Vanilagy c4398fb88c Add @mediabunny/aac-encoder extension package 2026-03-04 17:05:34 +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 a97200f3f0 Add @mediabunny/ac3 extension package 2026-02-12 18:31:59 +01:00
Vanilagy 7cc26edacb Add Mediabunny Codec Registry 2026-02-12 11:56:37 +01:00
Vanilagy 4fae45ec40 Allow negative trim ranges for conversion, add OutputFormat.supportsTimestampedMediaData 2026-02-11 15:56:51 +01: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 cab92c55ec Fix a few things 2026-02-03 16:01:46 +01:00
Vanilagy e20f779ede Add InputTrack.number 2026-01-22 09:18:43 +01:00
Vanilagy 277290abe3 Fix tests and elaborate on point in docs 2026-01-19 14:11:02 +01:00
Vanilagy dbaaea255c Expand packet.clone(), make conversion start timestamp default to the input's start timestamp 2026-01-19 14:04:20 +01:00
Vanilagy c3a3eb6abf Merge remote-tracking branch 'origin/main' into mpeg-ts 2026-01-16 21:04:14 +01:00
Vanilagy 20e4610da4 Document MPEG-TS 2026-01-16 20:51:27 +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
Vanilagy 2ab1be3834 Add maximumPageDuration Ogg muxer option (closes #277) 2026-01-13 13:37:34 +01:00
Vanilagy 24af125415 Make Conversion.cancel() cause execute() to throw (closes #271) 2026-01-12 15:13:00 +01:00
Vanilagy 8d46d50c39 Document that ADTS is append-only 2025-12-30 14:11:32 +01:00
Vanilagy 15bdd072e1 Add options to VideoSample allocationSize and copyTo methods, add explicit error message when format is null (closes #256) 2025-12-17 15:10:25 +01:00
4dd747a0a6 Conversion.init(hardwareAcceleration) option (#254)
* Support Conversion.init(hardwareAcceleration) option passed down to the VideoEncodingConfig.

fix #253

* Few changes

---------

Co-authored-by: Raphaël Droz <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2025-12-17 10:28:29 +00:00
Vanilagy 84dec01dfd Add pause and resume methods to MediaStreamTrack sources (closes #241) 2025-12-11 15:51:18 +01:00
Vanilagy cc649ba192 Add allowRotationMetadata video conversion option (see #247) 2025-12-11 14:41:00 +01:00
Vanilagy 75096edb23 Update TypeScript, fix generic ArrayBufferView type errors, allow SharedArrayBuffer as input for BufferSource 2025-11-26 12:04:23 +01:00
Vanilagy 217b383f12 Add read/write support for track disposition information 2025-11-13 11:00:42 +01:00
Vanilagy e880f54553 Add custom processing to Conversion API 2025-10-17 14:52:13 +02:00
Vanilagy f2f9b2f0c3 Add FilePathTarget 2025-10-02 15:59:46 +02:00
Vanilagy de4c44021a Bump minor 2025-10-02 11:29:38 +02:00
David P.andGitHub 08658e7728 Merge branch 'main' into stop-retrying-on-cors-error 2025-10-02 10:59:54 +02:00
Vanilagy 7accface7b A few cleanups 2025-10-01 22:23:05 +02:00
AJ Funk dcd1f242b4 add keyFrameInterval to ConversionVideoOptions 2025-10-01 09:28:06 -07:00
JonnyBurger 26c1debb7a Update docs for getRetryDelay() 2025-09-30 15:03:29 +02:00
JonnyBurger d58b638277 Stop retrying UrlSource if CORS error is suspected 2025-09-30 14:11:17 +02:00
Vanilagy be151d3494 Add isValid field to Conversion if output track counts haven't been reached, improve error messages to be more clear (closes #148) 2025-09-26 13:11:35 +02:00
Vanilagy 1b8e4f9f4b Add alpha option to Conversion API 2025-09-26 11:12:48 +02:00
Vanilagy f71ba8bc9e Fix oopsie 2025-09-26 09:38:09 +02:00
Vanilagy a043f410fd Make samples disposable 2025-09-24 21:41:52 +02: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
Vanilagy 1b1dd24959 Add missing docs 2025-09-22 22:06:09 +02:00
Vanilagy 15db099caf Add fetchFn to UrlSourceOptions, allow Request as UrlSource input, pass error message to getRetryDelay, add fallback for Blob.stream() 2025-09-22 11:10:39 +02:00
Vanilagy 63145c9ced Improve docs 2025-09-21 23:41:10 +02:00
Vanilagy 608c769a7e Add explicit disposability to Inputs (#126) 2025-09-21 20:18:59 +02:00
420423bc0f feat: Add support for custom MP4 metadata with mdta format (#132)
* feat: Add support for custom MP4 metadata with mdta format

- Add metadataFormat option ('mdir' | 'mdta') to IsobmffOutputFormatOptions
- Implement complete mdta format with keys box generation
- Enable custom metadata fields readable by ffmpeg/ffprobe
- Maintain backward compatibility with default mdir format

* Refactor ISOBMFF metadata tag writing logic

* Autism

---------

Co-authored-by: tanfu <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2025-09-18 23:41:08 +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 f340e19baa Clarify docs 2025-09-18 10:11:27 +02:00
Vanilagy c5523516c7 Add fastStart: 'reserve' option (closes #119) 2025-09-17 12:26:24 +02:00
Vanilagy fcec67645a Allow object for tags field in conversion 2025-09-16 15:10:16 +02:00
Vanilagy d313a85053 Document cropping in more places 2025-09-12 17:30:31 +02:00
Vanilagy 684b7b7391 Fix order 2025-09-12 16:50:14 +02:00
Vanilagy c9433771e9 Fix description in docs 2025-09-12 16:49:46 +02:00
Vanilagy eba1f360d5 Clean up cropping logic 2025-09-12 16:48:35 +02:00
Vanilagy 4aca172d14 Merge branch 'main' into fork-branch 2025-09-12 15:46:12 +02:00