-
Notifications
You must be signed in to change notification settings - Fork 627
Tips
execute()
and executeAsync()
methods in FFmpegKit
and FFprobeKit
splits a command into arguments by using the space character as a delimiter. If one of your command parameters include a space character inside then it will be split into two parameters and your command execution will fail. To prevent that, wrap that parameter using single or double quotes. Wrapping will prevent the parameter from being split.
Alternatively, you can split your command into arguments yourself and call one of the overloaded executeWithArguments()
/executeWithArgumentsAsync()
methods that accept arguments array.
FFmpegKit
packages specified in Android C++ Dependency Guide include libc++_shared.so
library. If a second library which also includes libc++_shared.so
is added as a dependency, gradle
fails with More than one file was found with OS independent path 'lib/x86/libc++_shared.so'
error message.
You can fix this error by adding the following block into your build.gradle
.
android {
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
}
ffmpeg
requires a valid fontconfig
configuration to render subtitles. Unfortunately, Android
does not include a default fontconfig
configuration. Therefore, if you do not register a font or specify a fontconfig
configuration under Android
, then the burning process will not produce any errors but subtitles won't be burned into your file.
You can overcome this behaviour by registering the fonts under a directory using the FFmpegKitConfig.setFontDirectory
methods or by specifying your own fontconfig
configuration using FFmpegKitConfig.setFontconfigConfigurationPath
.
ffmpeg
requires a valid fontconfig
configuration to render text while using drawtext
filter. As described in #3, Android
does not include a default fontconfig
configuration. So, if you do not register a font or specify a fontconfig
configuration under Android
, then drawtext
filter will fail with the following error.
Cannot find a valid font for the family Sans
Error initializing filter 'drawtext'
Error reinitializing filters!
Failed to inject frame into filter network: No such file or directory
You can overcome this behaviour by registering the fonts under a directory using the FFmpegKitConfig.setFontDirectory
methods or by specifying your own fontconfig
configuration using FFmpegKitConfig.setFontconfigConfigurationPath
.
System fonts on Android
are stored under the /system/fonts
folder. You can use those fonts in your ffmpeg
commands by registering /system/fonts
as a font directory via the FFmpegKitConfig.setFontDirectory
methods.
System fonts on Apple
platforms (iOS
, macOS
, tvOS
) are stored under the /System/Library/Fonts
and/or /System/Library/Fonts/Cache
folders. You can use those fonts in your ffmpeg
commands by registering /System/Library/Fonts
as a font directory via the [FFmpegKitConfig setFontDirectory]
methods.
If you use the caret syntax to define the LTS version in pubspec.yaml
e.g. ffmpeg_kit_flutter: ^4.5.0-LTS
, flutter pub get
may install the non-LTS version of the plugin. You can resolve this by not using the caret syntax and defining the exact LTS version in pubspec.yaml
.
Android
doesn't support UDP streaming since its pthreads
implementation lacks a few components required by ffmpeg
's udp
module. When you try to initiate a new UDP connection ffmpeg
will not transmit any UDP packets. It will only print the following message to the console and stop there.
[udp @ 0x5d0b3962] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
Unfortunately, there is no workaround for that. The only alternative is to use tcp
by providing an extra flag e.g. -rtsp_transport tcp
.
drawtext
filter depends on freetype
by default. It also requires fontconfig
to use fonts. If you're using an ffmpeg-kit
package that doesn't include those libraries then your commands will fail with the following error.
No such filter: 'drawtext'
On Apple platforms, when an application uses a lower deployment target than the one needed by ffmpeg-kit
, the build may fail printing the following error.
Specs satisfying the ffmpeg_kit_... dependency were found, but they required a higher minimum deployment target.
To fix this error, first find the minimum sdk target required for your ffmpeg-kit
release from Xcode Compatibility page. Then update your Podfile file with the value listed there. That should resolve the issue.
platform :ios, '12.1'
By default, Xcode
optimises all PNG files in an application bundle. However, this optimisation may result in PNG files that cannot be decoded by the libpng
library, which FFmpeg
depends on. If this occurs, your command will fail and print the following error message to the console.
Error while decoding stream #0:0: Generic error in an external library
To fix this error, go to Build Settings
in Xcode
and disable Compress PNG Files
and Remove Text Metadata From PNG Files
options under the Packaging
. Note that these options are hidden and only become visible when a file with .png
extension is added to the project.
Copyright (c) 2021-2024 FFmpegKit
- Status
- Versions
- Changelog
- Project Layout
- API
- Using
- Building
- External Libraries
- Patents
- License