Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
release v0.3.0, fixes #159
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Sep 20, 2020
1 parent 347cea1 commit 4147b70
Show file tree
Hide file tree
Showing 12 changed files with 329 additions and 224 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
- Adds setEnvironmentVariable API method
- Depends on mobile-ffmpeg v4.4
- Allows modifying mobile-ffmpeg version for android
- Fixes issue #115, #120 and #178
- Includes an updated example application
- Fixes issue #115, #120, #157, #159, #170, #178 and #202

## 0.2.10
- Fixes issue #94
Expand Down
348 changes: 205 additions & 143 deletions README.md

Large diffs are not rendered by default.

Binary file added doc/assets/flutter_test_app.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
140 changes: 78 additions & 62 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Demonstrates how to use the flutter_ffmpeg plugin.

## Getting Started

1. Execute FFmpeg commands.
1. Execute synchronous FFmpeg commands.

- Use execute() method with a single command line
```
Expand All @@ -25,8 +25,15 @@ Demonstrates how to use the flutter_ffmpeg plugin.
var arguments = ["-i", "file1.mp4", "-c:v", "mpeg4", "file2.mp4"];
_flutterFFmpeg.executeWithArguments(arguments).then((rc) => print("FFmpeg process exited with rc $rc"));
```
2. Execute asynchronous FFmpeg commands.
2. Execute FFprobe commands.
```
_flutterFFmpeg.executeAsync(ffmpegCommand, (int executionId, int returnCode) {
print("FFmpeg process for executionId $executionId exited with rc $returnCode");
}).then((executionId) => print("Async FFmpeg process started with executionId $executionId."));
```
3. Execute FFprobe commands.
- Use execute() method with a single command line
```
Expand All @@ -48,7 +55,7 @@ Demonstrates how to use the flutter_ffmpeg plugin.
_flutterFFprobe.executeWithArguments(arguments).then((rc) => print("FFprobe process exited with rc $rc"));
```
3. Check execution output. Zero represents successful execution, non-zero values represent failure.
4. Check execution output. Zero represents successful execution, 255 means user cancel and non-zero values represent failure.
```
final FlutterFFmpegConfig _flutterFFmpegConfig = new FlutterFFmpegConfig();
Expand All @@ -58,12 +65,17 @@ Demonstrates how to use the flutter_ffmpeg plugin.
_flutterFFmpegConfig.getLastCommandOutput().then((output) => print("Last command output: $output"));
```
4. Stop an ongoing operation. Note that this function does not wait for termination to complete and returns immediately.
```
_flutterFFmpeg.cancel();
```
5. Stop ongoing FFmpeg operations. Note that these two functions do not wait for termination to complete and return immediately.
- Stop all executions
```
_flutterFFmpeg.cancel();
```
- Stop a specific execution
```
_flutterFFmpeg.cancelExecution(executionId);
```
5. Get media information for a file.
6. Get media information for a file.
- Print all fields
```
final FlutterFFprobe _flutterFFprobe = new FlutterFFprobe();
Expand All @@ -77,45 +89,51 @@ Demonstrates how to use the flutter_ffmpeg plugin.
_flutterFFprobe.getMediaInformation("<file path or uri>").then((info) {
print("Media Information");
print("Path: ${info['path']}");
print("Format: ${info['format']}");
print("Duration: ${info['duration']}");
print("Start time: ${info['startTime']}");
print("Bitrate: ${info['bitrate']}");
if (info['streams'] != null) {
final streamsInfoArray = info['streams'];
if (streamsInfoArray.length > 0) {
for (var streamsInfo in streamsInfoArray) {
print("Stream id: ${streamsInfo['index']}");
print("Stream type: ${streamsInfo['type']}");
print("Stream codec: ${streamsInfo['codec']}");
print("Stream full codec: ${streamsInfo['fullCodec']}");
print("Stream format: ${streamsInfo['format']}");
print("Stream full format: ${streamsInfo['fullFormat']}");
print("Stream width: ${streamsInfo['width']}");
print("Stream height: ${streamsInfo['height']}");
print("Stream bitrate: ${streamsInfo['bitrate']}");
print("Stream sample rate: ${streamsInfo['sampleRate']}");
print("Stream sample format: ${streamsInfo['sampleFormat']}");
print("Stream channel layout: ${streamsInfo['channelLayout']}");
print("Stream sar: ${streamsInfo['sampleAspectRatio']}");
print("Stream dar: ${streamsInfo['displayAspectRatio']}");
print("Stream average frame rate: ${streamsInfo['averageFrameRate']}");
print("Stream real frame rate: ${streamsInfo['realFrameRate']}");
print("Stream time base: ${streamsInfo['timeBase']}");
print("Stream codec time base: ${streamsInfo['codecTimeBase']}");
final metadataMap = streamsInfo['metadata'];
print("Path: ${info.getMediaProperties()['path']}");
print("Format: ${info.getMediaProperties()['format']}");
print("Duration: ${info.getMediaProperties()['duration']}");
print("Start time: ${info.getMediaProperties()['startTime']}");
print("Bitrate: ${info.getMediaProperties()['bitrate']}");
Map<dynamic, dynamic> tags = info.getMediaProperties()['tags'];
if (tags != null) {
tags.forEach((key, value) {
print("Tag: " + key + ":" + value + "\n");
});
}
if (info.getStreams() != null) {
List<StreamInformation> streams = info.getStreams();
if (streams.length > 0) {
for (var stream in streams) {
print("Stream id: ${stream.getAllProperties()['index']}");
print("Stream type: ${stream.getAllProperties()['type']}");
print("Stream codec: ${stream.getAllProperties()['codec']}");
print("Stream full codec: ${stream.getAllProperties()['fullCodec']}");
print("Stream format: ${stream.getAllProperties()['format']}");
print("Stream full format: ${stream.getAllProperties()['fullFormat']}");
print("Stream width: ${stream.getAllProperties()['width']}");
print("Stream height: ${stream.getAllProperties()['height']}");
print("Stream bitrate: ${stream.getAllProperties()['bitrate']}");
print("Stream sample rate: ${stream.getAllProperties()['sampleRate']}");
print("Stream sample format: ${stream.getAllProperties()['sampleFormat']}");
print("Stream channel layout: ${stream.getAllProperties()['channelLayout']}");
print("Stream sar: ${stream.getAllProperties()['sampleAspectRatio']}");
print("Stream dar: ${stream.getAllProperties()['displayAspectRatio']}");
print("Stream average frame rate: ${stream.getAllProperties()['averageFrameRate']}");
print("Stream real frame rate: ${stream.getAllProperties()['realFrameRate']}");
print("Stream time base: ${stream.getAllProperties()['timeBase']}");
print("Stream codec time base: ${stream.getAllProperties()['codecTimeBase']}");
final metadataMap = stream.getAllProperties()['metadata'];
if (metadataMap != null) {
print('Stream metadata encoder: ${metadataMap['encoder']}');
print('Stream metadata rotate: ${metadataMap['rotate']}');
print('Stream metadata creation time: ${metadataMap['creation_time']}');
print('Stream metadata handler name: ${metadataMap['handler_name']}');
}
final sideDataMap = streamsInfo['sidedata'];
final sideDataMap = stream.getAllProperties()['sidedata'];
if (sideDataMap != null) {
print('Stream side data displaymatrix: ${sideDataMap['displaymatrix']}');
}
Expand All @@ -125,69 +143,67 @@ Demonstrates how to use the flutter_ffmpeg plugin.
```
6. Enable log callback and redirect all `FFmpeg`/`FFprobe` logs to a console/file/widget.
7. Enable log callback and redirect all `FFmpeg`/`FFprobe` logs to a console/file/widget.
```
void logCallback(int level, String message) {
print(message);
void logCallback(Log log) {
print("${log.executionId}:${log.message}");
}
...
_flutterFFmpegConfig.enableLogCallback(this.logCallback);
```
7. Enable statistics callback and follow the progress of an ongoing `FFmpeg` operation.
8. Enable statistics callback and follow the progress of an ongoing `FFmpeg` operation.
```
void statisticsCallback(int time, int size, double bitrate, double speed, int videoFrameNumber, double videoQuality, double videoFps) {
print("Statistics: time: $time, size: $size, bitrate: $bitrate, speed: $speed, videoFrameNumber: $videoFrameNumber, videoQuality: $videoQuality, videoFps: $videoFps");
void statisticsCallback(Statistics statistics) {
print("Statistics: executionId: ${statistics.executionId}, time: ${statistics.time}, size: ${statistics.size}, bitrate: ${statistics.bitrate}, speed: ${statistics.speed}, videoFrameNumber: ${statistics.videoFrameNumber}, videoQuality: ${statistics.videoQuality}, videoFps: ${statistics.videoFps}");
}
...
_flutterFFmpegConfig.enableStatisticsCallback(this.statisticsCallback);
```
8. Poll statistics without implementing statistics callback.
9. Poll statistics without implementing statistics callback.
```
_flutterFFmpegConfig.getLastReceivedStatistics().then((stats) => print(stats));
```
9. Reset statistics before starting a new operation.
10. List ongoing executions.
```
_flutterFFmpegConfig.resetStatistics();
_flutterFFmpeg.listExecutions().then((ffmpegExecutions) {
ffmpegExecutions.forEach((execution) {
ffprint(
"Execution id:${execution.executionId}, startTime:${execution.command}, command:${execution.startTime}.");
});
});
```
10. Set log level.
11. Set log level.
```
_flutterFFmpegConfig.setLogLevel(LogLevel.AV_LOG_WARNING);
```
11. Register your own fonts by specifying a custom fonts directory, so they are available to use in `FFmpeg` filters. Please note that this function can not work on relative paths, you need to provide full file system path.
12. Register your own fonts by specifying a custom fonts directory, so they are available to use in `FFmpeg` filters. Please note that this function can not work on relative paths, you need to provide full file system path.
```
_flutterFFmpegConfig.setFontDirectory("<folder with fonts>");
```
12. Use your own `fontconfig` configuration.
13. Use your own `fontconfig` configuration.
```
_flutterFFmpegConfig.setFontconfigConfigurationPath("<fontconfig configuration directory>");
```
13. Disable log functionality of the library. Logs will not be printed to console and log callback will be disabled.
14. Disable log functionality of the library. Logs will not be printed to console and log callback will be disabled.
```
_flutterFFmpegConfig.disableLogs();
```
14. Disable statistics functionality of the library. Statistics callback will be disabled but the last received statistics data will be still available.
15. Disable statistics functionality of the library. Statistics callback will be disabled but the last received statistics data will be still available.
```
_flutterFFmpegConfig.disableStatistics();
```
15. List enabled external libraries.
```
_flutterFFmpegConfig.getExternalLibraries().then((packageList) {
packageList.forEach((value) => print("External library: $value"));
});
```
16. Create new `FFmpeg` pipe.
```
_flutterFFmpegConfig.registerNewFFmpegPipe().then((path) {
then((stats) => print("New ffmpeg pipe at $path"));
});
```
```
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ subprojects {
project.evaluationDependsOn(':app')
}

ext.flutterFFmpegPackage = 'full-gpl'
ext.flutterFFmpegPackage = 'full'

task clean(type: Delete) {
delete rootProject.buildDir
Expand Down
6 changes: 5 additions & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ PODS:
- mobile-ffmpeg-audio (= 4.4.LTS)
- fluttertoast (0.0.2):
- Flutter
- Toast
- mobile-ffmpeg-audio (4.4.LTS)
- path_provider (0.0.1):
- Flutter
- Toast (4.0.0)
- video_player (0.0.1):
- Flutter

Expand All @@ -21,6 +23,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- mobile-ffmpeg-audio
- Toast

EXTERNAL SOURCES:
Flutter:
Expand All @@ -37,9 +40,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_ffmpeg: 657ce8a1502c3d25bf34efc58b380b248836f772
fluttertoast: b644586ef3b16f67fae9a1f8754cef6b2d6b634b
fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
mobile-ffmpeg-audio: 1e0a053f8a6de57114e50ff48b3a85ff1c60f902
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e

PODFILE CHECKSUM: 45c71b51796b78cb6a09bb97eb9786d4c7aa085f
Expand Down
4 changes: 2 additions & 2 deletions example/lib/concurrent_execution_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ConcurrentExecutionTab {
}
}

listFFmpegExecutions();
runListFFmpegExecutions();
});
});
});
Expand All @@ -126,7 +126,7 @@ class ConcurrentExecutionTab {
return new File("${documentsDirectory.path}/$video");
}

void listFFmpegExecutio() {
void runListFFmpegExecutions() {
listFFmpegExecutions().then((ffmpegExecutions) {
ffprint("Listing ongoing FFmpeg executions.");
int i = 0;
Expand Down
31 changes: 26 additions & 5 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "1.0.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -92,7 +99,7 @@ packages:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.2"
version: "7.1.1"
intl:
dependency: transitive
description:
Expand Down Expand Up @@ -127,7 +134,7 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.14"
version: "1.6.16"
path_provider_linux:
dependency: transitive
description:
Expand All @@ -141,14 +148,21 @@ packages:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+3"
version: "0.0.4+4"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -237,7 +251,7 @@ packages:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.12+2"
version: "0.10.12+3"
video_player_platform_interface:
dependency: transitive
description:
Expand All @@ -252,6 +266,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3+2"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.2+1"
xdg_directories:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 4147b70

Please sign in to comment.