A Dart package/library for convert some video and images to some formats using cwebp and FFmpeg. This package is not ready for production!
- Convert .jpg and .png images to .webp
- Convert .mp4 videos to .webm
- Windows
- macOS
- Linux
- Have the cwebp binaries or have it installed on your machine.
- Have the FFmpeg binaries or have it installed on your machine.
SoftImageConverter
import 'package:soft_converter/soft_converter.dart';
Future<void> main() async {
// The paths for the binaries are optional, if not defined
// SoftConverter will use the system path.
final imageConverter = SoftImageConverter(
cwebpWindows: 'bin/cwebp_win.exe',
cwebpMacOS: 'bin/cwebp_macos',
cwebpLinux: 'bin/cwebp_linux',
);
try {
final file = await imageConverter.toWEBP(
input: 'assets/space.jpg',
output: 'assets/space.webp',
);
print('Image file: ${file.path}');
} catch (e) {
rethrow;
}
}
SoftVideoConverter
import 'package:soft_converter/soft_converter.dart';
Future<void> main() async {
// The paths for the binaries are optional, if not defined
// SoftConverter will use the system path.
final imageConverter = SoftVideoConverter(
ffmpegWindows: 'bin/ffmpeg_win.exe',
ffmpegMacOS: 'bin/ffmpeg_macos',
ffmpegLinux: 'bin/ffmpeg_linux',
);
try {
final file = await imageConverter.toWEBM(
input: 'assets/gradient.mp4',
output: 'assets/gradient.webm',
);
print('Video file: ${file.path}');
} catch (e) {
rethrow;
}
}
- João Sereia <[email protected]>
- SoftYes TI <softyes.com.br>