Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eb50305
progressive audio decoding for `useWindowedAudioData`
samohovets May 23, 2025
8524398
add `watchmediautils` script to package.json
samohovets May 23, 2025
be30cdc
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets May 26, 2025
61b6e4e
Merge branch 'main' into feature/windowed-audiodata-formats
JonnyBurger May 26, 2025
bc68fec
use createAudioDecoder, to be refined later
samohovets May 26, 2025
2bbe32e
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets May 28, 2025
d37f3fd
implement smart debouncing to avoid overfetching when seeknig
samohovets May 28, 2025
8e2743d
skip samples before requested time
samohovets May 28, 2025
83f65e0
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets May 30, 2025
4d2e15b
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets May 30, 2025
e8c76a6
wait until audio decoder has finished forming float32array
samohovets May 30, 2025
689fdca
add buffer to getPartialAudioData. now it works correctly!
samohovets May 30, 2025
d203329
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets Jun 2, 2025
12194f9
Update pnpm-lock.yaml
JonnyBurger Jun 24, 2025
23656f6
fix buffer
samohovets Jun 27, 2025
7f891f3
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets Aug 25, 2025
9b9624b
use getPartialAudioData from webcodecs
samohovets Aug 25, 2025
a587815
fix getPartialAudioData was not resolving if parser reached the end o…
samohovets Aug 26, 2025
673c991
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets Aug 26, 2025
88e96cd
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets Aug 27, 2025
58ff3e9
new package scripts
samohovets Aug 27, 2025
1a8f3d2
decoding start a bit earlier and end a bit later than the requested w…
samohovets Aug 27, 2025
79b83c8
`getSampleRate` for FLAC media parser: fall back to `Streaminfo` if 0…
samohovets Aug 27, 2025
95c59ed
fix getting channel count for flac in media parser
samohovets Aug 27, 2025
3a631ea
Fix reported problem
JonnyBurger Aug 28, 2025
22c6a88
use `useWindowedAudioData` everywhere in the music visualization temp…
samohovets Aug 28, 2025
553dee6
watchwebcodecs script
samohovets Aug 28, 2025
7c0875f
add proper cleanup for unmount
samohovets Aug 28, 2025
6357a36
Merge branch 'main' of https://github.com/remotion-dev/remotion into …
samohovets Aug 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"makewhisperweb": "turbo run make --filter='@remotion/whisper-web'",
"watchwhisperweb": "turbo watch make --experimental-write-cache --filter='@remotion/whisper-web'",
"makewebcodecs": "turbo run make --filter='@remotion/media-parser' --filter='@remotion/webcodecs'",
"watchwebcodecs": "turbo watch make --experimental-write-cache --filter='@remotion/media-parser' --filter='@remotion/webcodecs'",
"watchmediaparser": "turbo watch make --experimental-write-cache --filter='@remotion/media-parser'",
"watchmediautils": "turbo watch make --experimental-write-cache --filter='@remotion/media-utils'",
"watchwebrenderer": "turbo watch make --experimental-write-cache --filter='@remotion/web-renderer'",
"watchwebcodecs": "turbo watch make --experimental-write-cache --filter='@remotion/webcodecs'",
"makewebrenderer": "turbo run make --filter='@remotion/web-renderer'",
"makecore": "turbo run make --filter='remotion'",
"watchcore": "turbo watch make --experimental-write-cache --filter='remotion'",
Expand Down Expand Up @@ -58,4 +60,4 @@
"typescript": "5.8.2"
},
"packageManager": "[email protected]"
}
}
7 changes: 5 additions & 2 deletions packages/media-parser/src/containers/flac/get-block-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import type {BufferIterator} from '../../iterator/buffer-iterator';

export const getBlockSize = (
iterator: BufferIterator,
): number | 'uncommon-u16' | 'uncommon-u8' => {
): number | 'uncommon-u16' | 'uncommon-u8' | null => {
const bits = iterator.getBits(4);
if (bits === 0b0000) {
throw new Error('Reserved block size');
// Probably we are in the wrong spot overall, and just landed on a spot that incidentially hit the syncword.
// Don't throw an error, in the parent function just keep reading.
// Internal message with repro: https://discord.com/channels/@me/1314232261008162876/1410312296709881988
return null;
}

if (bits === 0b0001) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,12 @@ export const getChannelCount = (iterator: BufferIterator) => {
return 2;
}

// 0b1011..0b1111 are reserved per RFC 9639 §9.1.3 (Channels Bits).
// Some encoders/files in the wild may nonetheless use these values.
// Be lenient and treat them as stereo (2 channels) to keep parsing robust.
if (bits >= 0b1011 && bits <= 0b1111) {
return 2;
}

throw new Error(`Invalid channel count: ${bits.toString(2)}`);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getSampleRate = (
state: ParserState,
): number | 'uncommon-u8' | 'uncommon-u16' | 'uncommon-u16-10' => {
const mode = iterator.getBits(4);
if (mode === 0b0000) {
if (mode === 0b0000 || mode === 0b1111) {
const structure = state.structure.getFlacStructure();
const sampleRate =
structure.boxes.find((box) => box.type === 'flac-streaminfo')
Expand Down
4 changes: 4 additions & 0 deletions packages/media-parser/src/containers/flac/parse-flac-frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export const parseFrameHeader = ({
iterator.discard(2); // sync code
iterator.startReadingBits();
const blockSizeBits = getBlockSize(iterator);
if (blockSizeBits === null) {
return null;
}

const sampleRateBits = getSampleRate(iterator, state);
getChannelCount(iterator); // channel count
iterator.getBits(3); // bit depth
Expand Down
4 changes: 3 additions & 1 deletion packages/media-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"url": "https://github.com/remotion-dev/remotion/issues"
},
"dependencies": {
"@remotion/media-parser": "workspace:*",
"@remotion/webcodecs": "workspace:*",
"remotion": "workspace:*"
},
"peerDependencies": {
Expand All @@ -39,4 +41,4 @@
"access": "public"
},
"homepage": "https://www.remotion.dev/docs/media-utils"
}
}
75 changes: 0 additions & 75 deletions packages/media-utils/src/get-partial-wave-data.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/media-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ export {
getAudioDurationInSeconds,
} from './get-audio-duration-in-seconds';
export {getImageDimensions} from './get-image-dimensions';
export {getPartialWaveData} from './get-partial-wave-data';
export {getVideoMetadata} from './get-video-metadata';
export {getWaveformPortion} from './get-waveform-portion';
export {WaveProbe, probeWaveFile} from './probe-wave-file';
export * from './types';
export type {
AudioData,
Expand Down
145 changes: 0 additions & 145 deletions packages/media-utils/src/probe-wave-file.ts

This file was deleted.

Loading
Loading