package ffmpeg
import "go.mau.fi/util/ffmpeg"
Index ¶
- func ConvertBytes(ctx context.Context, data []byte, outputExtension string, inputArgs []string, outputArgs []string, inputMime string) ([]byte, error)
- func ConvertPath(ctx context.Context, inputFile string, outputExtension string, inputArgs []string, outputArgs []string, removeInput bool) (string, error)
- func ConvertPathWithDestination(ctx context.Context, inputFile string, outputFile string, inputArgs []string, outputArgs []string, removeInput bool) error
- func SetPath(path string)
- func Supported() bool
Functions ¶
func ConvertBytes ¶
func ConvertBytes(ctx context.Context, data []byte, outputExtension string, inputArgs []string, outputArgs []string, inputMime string) ([]byte, error)
ConvertBytes converts media data using ffmpeg.
Args: * data: The media data to convert * outputExtension: The extension that the output file should be. * inputArgs: Arguments to tell ffmpeg how to parse the input file. * outputArgs: Arguments to tell ffmpeg how to convert the file to reach the wanted output. * inputMime: The mimetype of the input data.
Returns: the converted data
func ConvertPath ¶
func ConvertPath(ctx context.Context, inputFile string, outputExtension string, inputArgs []string, outputArgs []string, removeInput bool) (string, error)
ConvertPath converts a media file on the disk using ffmpeg and auto-generates the output file name.
Args: * inputFile: The full path to the file. * outputExtension: The extension that the output file should be. * inputArgs: Arguments to tell ffmpeg how to parse the input file. * outputArgs: Arguments to tell ffmpeg how to convert the file to reach the wanted output. * removeInput: Whether the input file should be removed after converting.
Returns: the path to the converted file.
func ConvertPathWithDestination ¶
func ConvertPathWithDestination(ctx context.Context, inputFile string, outputFile string, inputArgs []string, outputArgs []string, removeInput bool) error
ConvertPathWithDestination converts a media file on the disk using ffmpeg and saves the result to the provided file name.
Args: * inputFile: The full path to the file. * outputFile: The full path to the output file. Must include the appropriate extension so ffmpeg knows what to convert to. * inputArgs: Arguments to tell ffmpeg how to parse the input file. * outputArgs: Arguments to tell ffmpeg how to convert the file to reach the wanted output. * removeInput: Whether the input file should be removed after converting.
func SetPath ¶
func SetPath(path string)
SetPath overrides the path to the ffmpeg binary.
func Supported ¶
func Supported() bool
Supported returns whether ffmpeg is available on the system.
ffmpeg is considered to be available if a binary called ffmpeg is found in $PATH, or if SetPath has been called explicitly with a non-empty path.
Source Files ¶
convert.go
- Version
- v0.8.1
- Published
- Oct 16, 2024
- Platform
- darwin/amd64
- Imports
- 9 packages
- Last checked
- 4 hours ago –
Tools for package owners.