-
Notifications
You must be signed in to change notification settings - Fork 0
FFmpeg Short Clips
You can add clips to the ShortClipCache with FFmpeg
Caution
If you pass a very long input (e.g. live stream), the server will hang, and most likely crash because it runs out of memory.
Important
Do not use short clips for long files. Stream them instead.
Pass the maxDuration optional parameter to discard clips that are too long
(e.g. longer than 30 seconds).
Example
C# 14 and later:
using SecretLabNAudio.Core.FileReading;
using SecretLabNAudio.FFmpeg;
using SecretLabNAudio.FFmpeg.Extensions;
// the file name without the extension will be the clip's name
ShortClipCache.AddFileWithFFmpeg("/path/to/clip.wav");
ShortClipCache.AddFileWithFFmpeg("/path/to/clip2.m4a");
// custom clip name
ShortClipCache.AddFileWithFFmpeg("/path/to/clip3.wav", "CustomName");
// any source
ShortClipCache.AddWithFFmpeg(
new FFmpegArguments().WithInput("https://download.samplelib.com/mp3/sample-15s.mp3"),
"15s-sample"
);C# 13 and earlier:
using SecretLabNAudio.FFmpeg;
using SecretLabNAudio.FFmpeg.Extensions;
// the file name without the extension will be the clip's name
ShortClipCacheExtensions.AddFileWithFFmpeg("/path/to/clip.wav");
ShortClipCacheExtensions.AddFileWithFFmpeg("/path/to/clip2.m4a");
// custom clip name
ShortClipCacheExtensions.AddFileWithFFmpeg("/path/to/clip3.wav", "CustomName");
// any source
ShortClipCacheExtensions.AddWithFFmpeg(
new FFmpegArguments().WithInput("https://download.samplelib.com/mp3/sample-15s.mp3"),
"15s-sample"
);Use the AddFileWithFFmpeg extension method to add a file.
This method will not start FFmpeg if the file does not exist.
Call the AddWithFFmpeg method to pass a custom input (e.g. URL), which
lets you customize the input or output options (e.g. section of the stream, filters).
Note
Adding clips with FFmpeg takes more time since a new process has to be started per clip.
Tip
See also: FFmpegArguments
If FFmpeg encountered an error while reading a short clip, the error can be found in the LocalAdmin logs:
- Linux:
~/.config/SCP Secret Laboratory/LocalAdminLogs/<port>/<file> - Windows:
%appdata%\SCP Secret Laboratory\LocalAdminLogs\<port>\<file>
- π Home
- πΌ Digital Audio Basics
- π Examples
- π¦ Supported Formats
- β¬οΈ Migrating from v1
- π AudioPlayer
- πΎ Short Clips
- πΏ Streaming From Disk
- ποΈ Speaker Groups
- π Sample Providers
- β»οΈ Pooling
- π¨ SendEngines
- π§ Personalizing Speakers
- π Monitoring Output
- βοΈ AudioQueue
- πΆ Mixer
- ποΈοΈ ProcessorChain
- π§° Intro to FFmpeg
- π© Installation
- ποΈ FFmpegArguments
- πͺ Adding Short Clips
- π FFmpeg Audio Processors
- ποΈ Caches
Caution
v1 will be out of support soon.