FFmpeg
このプラグインは、FFmpegの依存関係を提供し、開発者に広範な画像、ビデオ、オーディオのエンコードとデコード機能を提供します。
注意: この機能は Eagle 4.0 beta 7 以降でのみ使用できます。
FFmpeg Dependency Pluginの紹介
"FFmpeg Dependency Plugin"は、ブラウザプラグイン開発者向けのツールキットで、FFmpegの強力なマルチメディア処理機能を使いやすい依存パッケージにカプセル化しています。このツールキットを使用すると、開発者は自分のプラグインで画像、ビデオ、オーディオ形式のエンコードとデコード、ストリーミングメディア処理、形式変換などの高度な機能を簡単に実装できます。"FFmpeg Dependency Plugin"を統合することで、開発者は自分のプラグインのマルチメディア処理機能をシームレスに拡張し、ユーザーにより創造的で実用的な機能を提供できます。
FFmpeg Dependency Pluginのインストール
プラグインセンターに入る
FFmpegプラグインを検索して見つける
FFmpegプラグインをインストールするためにクリックする
FFmpeg Dependency Pluginの使用方法
プラグインでFFmpeg関連の機能を使用したい場合は、プラグインのmanifest.json
ファイルにdependencies
定義を追加する必要があります。これにより、Eagleシステムはこのプラグインが追加の拡張機能を必要とすることを認識します。以下に示します:
{
"id": "LBCZE8V6LPCKD",
"version": "1.0.0",
"platform": "all",
"arch": "all",
"name": "Window Plugin",
"logo": "/logo.png",
"keywords": [],
"dependencies": ["ffmpeg"],
"devTools": false,
"main":
{
"url": "index.html",
"width": 640,
"height": 480,
}
}
Window Pluginの例
以下に示すように、eagle.extraModule.ffmpeg
を使用してFFmpeg依存プラグインが提供する機能を呼び出すことができます:
eagle.onPluginCreate(async (plugin) => {
// FFmpeg依存プラグインがインストールされているかどうかを確認します
const isFFemptInstalled = await eagle.extraModule.ffmpeg.isInstalled();
// プラグインセンターを開き、FFmpeg依存プラグインのインストールページをポップアップします。
if (!isFFemptInstalled) {
await eagle.extraModule.ffmpeg.install();
return;
}
// FFmpegバイナリファイルの場所を取得します
const ffmpegPaths= await eagle.extraModule.ffmpeg.getPaths();
const ffmpegBinaryPath = ffmpegPaths.ffmpeg;
const ffprobeBinaryPath = ffmpegPaths.ffprobe;
// spwanコマンドを使用して関連操作を行います
const spawn = require('child_process').spawn;
const ffprobe = spawn(ffprobePath, [
'-v', 'error',
'-print_format', 'json',
'-show_format',
'-show_streams',
"C:\\your_file.mp4"
]);
});
Thumbnail Pluginの例
以下に示すように、extraModule
パラメータを通じてFFmpeg関連の機能を取得することができます:
module.exports = async ({ src, dest, item, plugin, extraModule }) => {
return new Promise(async (resolve, reject) => {
try {
const ffmpegModule = extraModule.ffmpeg;
// FFmpeg依存プラグインがインストールされているかどうかを確認します
if (!ffmpegModule.isInstalled) {
return reject(new Error(`ffmpeg is not installed.`));
}
// FFmpegバイナリファイルの場所を取得します
const { ffmpeg, ffprobe } = ffmpegModule.paths;
// spwanコマンドを使用して関連操作を行います
const spawn = require('child_process').spawn;
const ffprobe = spawn(ffprobePath, [
'-v', 'error',
'-print_format', 'json',
'-show_format',
'-show_streams',
"C:\\your_file.mp4"
]);
return resolve(item);
}
catch (err) {
return reject(err);
}
});
}
最終更新