টুলস
এই অধ্যায়টি এখনও অনুবাদ হয়নি, তাই ইংরেজিতে দেখানো হচ্ছে।
এই পাতায়
Tools gives your visitors small helpers for the files they download, each on a page of its own, and a page that lists them. The first one, Merge Video and Audio, joins a video file and an audio file into one file inside the visitor's browser. The plugin is free and works with every licence.
Many sites, YouTube above all, keep the picture and the sound of their larger sizes in two separate files. A visitor who downloads both joins them here without installing a program, and your server does no work at all.
Switching it on
A new installation switches it on once; after that you decide with Admin → Plugins → Tools → Enable or Disable. Its screen is in the admin menu under Plugins → Tools (or press Open on its card).
The pages
| Address | What it shows |
|---|---|
/en/tools | The list: a card per tool with its name and a line about it. A tool for members carries a Members badge with a lock. |
/en/merge-video | The merge tool. |
Every language of the site has its own addresses, and every tool page ends with a link All tools. A tool that is switched off has neither a page nor a card; when every tool is off, the list page answers "not found" and its menu links disappear.
Merge Video and Audio
The page explains three steps, then shows two fields: Drag the video here, or click to choose and Drag the audio here, or click to choose. The visitor chooses the two files and presses Start merging; a progress bar follows the work. At the end the result plays on the page, with Download the merged file (and its size) and Merge other files. Questions and answers below the tool clear up the usual doubts.
What happens behind it:
- The browser loads FFmpeg, the well-known video program, built to run in a browser (ffmpeg.wasm). The small loader comes with the script; the large part, about 32 MB (10 MB over the network), is fetched the first time only and kept by the browser.
- The two files are read where they lie on the visitor's device. Nothing is uploaded.
- The picture is copied as it is, never converted, so the quality stays and a merge usually takes seconds. The sound is copied too when it fits the new file; otherwise it is converted (AAC at 192 kbit/s, or Opus at 160 kbit/s for WebM). When copying fails, the tool converts by itself.
Which files work:
- Video: MP4, M4V, M4S, MOV, MKV and WebM, or any file the browser calls a video.
- Audio: M4A, MP3, AAC, WAV, OGG, Opus, WebA, WebM, MP4, M4S and FLAC, or any file the browser calls audio.
- Result: a WebM when the video is a WebM, otherwise an MP4. M4A, AAC and MP3 sound is copied into an MP4, WebM, Opus and OGG sound into a WebM; WAV and FLAC are always converted.
The result is named after the video, for example Holiday-merged.mp4, plus your Filename suffix (Settings → Downloads) when there is one: Holiday-merged - MySite.mp4.
When something is wrong the visitor reads, for example, "This kind of file cannot be used here.", "This file is too large (the limit is 2000 MB)." or "Merging failed. ..." with FFmpeg's last complaint in brackets.
Who may use a tool
Each tool is a members' feature like the others of the site. For the merge tool the setting is access_tool_merge_video:
| Choice | Effect |
|---|---|
| Everyone | The default. |
| Members (signed in) | The page stays visible; a guest finds "This tool is for members" with Sign in and Create account where the tool would be. |
| Members with a confirmed e-mail address | The same; a member who has not confirmed is asked to confirm the address. |
| Switched off | The page and its card are gone. |
Signed in to the admin panel, you can always use it. When member accounts are off (Settings → Users), a tool for members is open to everyone. A tool for members is also listed among the things a free account gives, for example on /en/join (see Member accounts).
The Tools screen
Plugins → Tools has four cards; press Save after a change.
The tools: one select per tool, labelled with its name and with its address below, offering the four choices above.
Merge video and audio:
| Setting | Default | What it does |
|---|---|---|
| Load FFmpeg from | The CDN jsDelivr (recommended) | The CDN jsDelivr (recommended), The CDN unpkg, or This server once a copy is there. When the first place does not answer, the others are tried. |
| Largest file (MB) | 2000 | 50 to 4000. A browser can hold about 2 GB. |
| Point to the tool on the results page | on | Under the formats of a video whose picture and sound come as two files, "Picture and sound as two files? Join them into one:" links to the tool. |
The list of tools: Title and Introduction of the list page (empty: the translated default), Link in the main menu and Link in the footer (both on).
FFmpeg on this server: Copy FFmpeg to this server fetches ffmpeg-core.js and ffmpeg-core.wasm (32 MB) into uploads/tools/ffmpeg-0.12.10/ and switches Load FFmpeg from to This server; it takes up to a minute. Visitors then load FFmpeg from your own site, so a blocked CDN does not matter. Remove the copy deletes the files and goes back to jsDelivr. When the copy fails, the message says why (for example "The folder uploads/tools cannot be written.") and the tool keeps using the CDN.
Adding a tool from another plugin
A plugin adds a tool through the filter site_tools, an array of slug => tool:
add_filter('site_tools', function (array $tools): array {
$tools['cut-audio'] = [
'title' => t('cut_title'),
'lead' => t('cut_lead'),
'icon' => 'bi-scissors',
'feature' => 'tool_cut_audio',
'render' => fn(): string => '<div class="kit">...</div>',
];
return $tools;
});
The tool gets the address /<language>/cut-audio, a card on the list page and, because it names a feature, its own select on the Tools screen (access_tool_cut_audio); without feature it is open to everyone. render returns the HTML of the tool, which Tools puts into a page with the title and the All tools link.
Tools reads the list while it starts, and plugins start in the order of their names. Add the filter from a plugin whose name comes before "Tools", or at the top of its plugin.php; otherwise the card appears but its page is not found.
Tips
- Leave Point to the tool on the results page on: visitors find the tool exactly when they get a video without sound.
- The tool runs on any hosting: the FFmpeg build it uses needs no special server headers.
- To change a text of these pages, use New translation on Settings → Translations with its key from the plugin's
languages/en.php(see Languages and translations).