Add .gitignore to exclude all node packages and lock files
This commit is contained in:
Generated
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
import { Mp4OutputFormat, QUALITY_HIGH, QUALITY_LOW, QUALITY_MEDIUM, QUALITY_VERY_HIGH, QUALITY_VERY_LOW, WebMOutputFormat, } from 'mediabunny';
|
||||
export const codecToMediabunnyCodec = (codec) => {
|
||||
switch (codec) {
|
||||
case 'h264':
|
||||
return 'avc';
|
||||
case 'h265':
|
||||
return 'hevc';
|
||||
case 'vp8':
|
||||
return 'vp8';
|
||||
case 'vp9':
|
||||
return 'vp9';
|
||||
case 'av1':
|
||||
return 'av1';
|
||||
default:
|
||||
throw new Error(`Unsupported codec: ${codec}`);
|
||||
}
|
||||
};
|
||||
export const containerToMediabunnyContainer = (container) => {
|
||||
switch (container) {
|
||||
case 'mp4':
|
||||
return new Mp4OutputFormat();
|
||||
case 'webm':
|
||||
return new WebMOutputFormat();
|
||||
default:
|
||||
throw new Error(`Unsupported container: ${container}`);
|
||||
}
|
||||
};
|
||||
export const getDefaultVideoCodecForContainer = (container) => {
|
||||
switch (container) {
|
||||
case 'mp4':
|
||||
return 'h264';
|
||||
case 'webm':
|
||||
return 'vp8';
|
||||
default:
|
||||
throw new Error(`Unsupported container: ${container}`);
|
||||
}
|
||||
};
|
||||
export const getQualityForWebRendererQuality = (quality) => {
|
||||
switch (quality) {
|
||||
case 'very-low':
|
||||
return QUALITY_VERY_LOW;
|
||||
case 'low':
|
||||
return QUALITY_LOW;
|
||||
case 'medium':
|
||||
return QUALITY_MEDIUM;
|
||||
case 'high':
|
||||
return QUALITY_HIGH;
|
||||
case 'very-high':
|
||||
return QUALITY_VERY_HIGH;
|
||||
default:
|
||||
throw new Error(`Unsupported quality: ${quality}`);
|
||||
}
|
||||
};
|
||||
export const getMimeType = (container) => {
|
||||
switch (container) {
|
||||
case 'mp4':
|
||||
return 'video/mp4';
|
||||
case 'webm':
|
||||
return 'video/webm';
|
||||
default:
|
||||
throw new Error(`Unsupported container: ${container}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user