Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(*): LU-3384 vp9 webm #58

Merged
merged 7 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lumen5/framefusion",
"version": "1.0.5",
"version": "1.0.6",
"type": "module",
"scripts": {
"docs": "typedoc framefusion.ts",
Expand Down
7 changes: 7 additions & 0 deletions src/backends/beamcoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ const createDecoder = ({
});
}

if (demuxer.streams[streamIndex].codecpar.name === 'vp9') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooo nice, I wonder if this also fixes that one off scene design Kanwar had to re-encode

return beamcoder.decoder({
...commonParams,
name: 'libvpx-vp9',
});
}

return beamcoder.decoder({
...commonParams,
demuxer: demuxer,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 23 additions & 2 deletions test/framefusion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,31 @@ describe('FrameFusion', () => {
await extractor.dispose();
});

it('can get frame from webm with alpha', async() => {
it('can get frame from vp8 encoded webm with alpha', async() => {
// Arrange
const extractor = await BeamcoderExtractor.create({
inputFileOrUrl: './test/samples/webm-with-alpha.webm',
inputFileOrUrl: './test/samples/vp8-webm-with-alpha.webm',
threadCount: 8,
});

// Act and Assert
const imageData = await extractor.getImageDataAtTime(100);
const canvasImageData = createImageData(imageData.data, imageData.width, imageData.height);

const canvas = createCanvas(imageData.width, imageData.height);
const ctx = canvas.getContext('2d', { alpha: true });

ctx.putImageData(canvasImageData, 0, 0);
expect(canvas.toBuffer('image/png')).toMatchImageSnapshot();

// Cleanup
await extractor.dispose();
});

it('can get frame from vp9 encoded webm with alpha', async() => {
// Arrange
const extractor = await BeamcoderExtractor.create({
inputFileOrUrl: './test/samples/vp9-webm-with-alpha.webm',
threadCount: 8,
});

Expand Down
Binary file added test/samples/vp9-webm-with-alpha.webm
Binary file not shown.
Loading