mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-22 04:50:29 +08:00
Translated 85 skill sub-reference files to achieve full parity with the English source: - skills/angular-developer/references/ — 35 files (all references) - skills/remotion-video-creation/rules/ — 28 files (all rules) - skills/tinystruct-patterns/references/ — 5 files - skills/openclaw-persona-forge/references/ — 6 files - skills/skill-comply/prompts/ — 3 files - skills/lead-intelligence/agents/ — 4 files - skills/brand-voice/references/ — 1 file - skills/frontend-slides/ — 2 files - hooks/memory-persistence/README.md — 1 file English source parity: 0 missing files (excluding rules/zh/, internal docs, and experimental examples absent from zh-CN)
69 lines
1.7 KiB
Markdown
69 lines
1.7 KiB
Markdown
---
|
||
name: get-video-dimensions
|
||
description: Mediabunnyを使用して動画ファイルの幅と高さを取得する
|
||
metadata:
|
||
tags: dimensions, width, height, resolution, size, video
|
||
---
|
||
|
||
# Mediabunnyによる動画寸法の取得
|
||
|
||
Mediabunnyは動画ファイルの幅と高さを抽出できます。ブラウザ、Node.js、Bun環境で動作します。
|
||
|
||
## 動画寸法の取得
|
||
|
||
```tsx
|
||
import { Input, ALL_FORMATS, UrlSource } from "mediabunny";
|
||
|
||
export const getVideoDimensions = async (src: string) => {
|
||
const input = new Input({
|
||
formats: ALL_FORMATS,
|
||
source: new UrlSource(src, {
|
||
getRetryDelay: () => null,
|
||
}),
|
||
});
|
||
|
||
const videoTrack = await input.getPrimaryVideoTrack();
|
||
if (!videoTrack) {
|
||
throw new Error("No video track found");
|
||
}
|
||
|
||
return {
|
||
width: videoTrack.displayWidth,
|
||
height: videoTrack.displayHeight,
|
||
};
|
||
};
|
||
```
|
||
|
||
## 使用方法
|
||
|
||
```tsx
|
||
const dimensions = await getVideoDimensions("https://remotion.media/video.mp4");
|
||
console.log(dimensions.width); // 例: 1920
|
||
console.log(dimensions.height); // 例: 1080
|
||
```
|
||
|
||
## ローカルファイルとの使用
|
||
|
||
ローカルファイルの場合は、`UrlSource` の代わりに `FileSource` を使用します:
|
||
|
||
```tsx
|
||
import { Input, ALL_FORMATS, FileSource } from "mediabunny";
|
||
|
||
const input = new Input({
|
||
formats: ALL_FORMATS,
|
||
source: new FileSource(file), // 入力またはドラッグ&ドロップからのFileオブジェクト
|
||
});
|
||
|
||
const videoTrack = await input.getPrimaryVideoTrack();
|
||
const width = videoTrack.displayWidth;
|
||
const height = videoTrack.displayHeight;
|
||
```
|
||
|
||
## RemotionのstaticFileとの使用
|
||
|
||
```tsx
|
||
import { staticFile } from "remotion";
|
||
|
||
const dimensions = await getVideoDimensions(staticFile("video.mp4"));
|
||
```
|