Git Product home page Git Product logo

light_compressor's People

Contributors

abed-binary avatar abedelazizshe avatar starkdmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

light_compressor's Issues

Cannot find video track

Hello,

first of all thank you for this easy to use, great package. Unfortunately, there is an error saying cannot find video track for quiet a lot of videos on my iPhone. What could be the reason for this? Is there a way to get additional information about this?

Thank you
Marcel

Video trimming capabilities

Congratulations for the plug-in, great work! Wondering if you have any plans implementing duration trimming functionality for the compressed video file.

Surface frame wait timed out

An android when trying to compress 333 MB 2 minute duration video I'm getting Surface frame wait timed out. No other details. Is there a size limit for compression or a config I'm not seeing to extend the frame wait time out?

E/Compressor( 1614): Surface frame wait timed out

ios get crash

When i select video to compress and minimize app while compressing in ios get crashed . But it working fine in android

getting below error

terminating with uncaught exception of type NSException

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetReader startReading] cannot be called again after reading has already started'

terminating with uncaught exception of type NSException

Android 11

Hi. when I try and compress a video on Android 11 it crashes the app and I get:-

E/AndroidRuntime( 8556): java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA
E/AndroidRuntime( 8556): at android.media.MediaMetadataRetriever._setDataSource(Native Method)
E/AndroidRuntime( 8556): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:282)
E/AndroidRuntime( 8556): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:246)
E/AndroidRuntime( 8556): at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:87)
E/AndroidRuntime( 8556): at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:114)
E/AndroidRuntime( 8556): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime( 8556): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
E/AndroidRuntime( 8556): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
E/AndroidRuntime( 8556): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
E/AndroidRuntime( 8556): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
E/AndroidRuntime( 8556): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I/Process ( 8556): Sending signal. PID: 8556 SIG: 9

Release mode fails on android

When I try to run the example application on android in release mode - flutter run --release; it gives me an exception

Flutter run key commands.
h Repeat this help message.
c Clear the screen
q Quit (terminate the application on the device).
I/flutter ( 7589): MissingPluginException(No implementation found for method listen on channel compression/stream)
I/flutter ( 7589): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156)
I/flutter ( 7589):
I/flutter ( 7589): #1 EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:545)
I/flutter ( 7589):

And the application freezes after selecting a video

Problem on Android while compressing

Hello again,

Here are the logs from my Android device using the same code as in IOS :

E/Compressor(27830): java.lang.IllegalStateException
E/Compressor(27830): 	at android.media.MediaExtractor.getSampleTrackIndex(Native Method)
E/Compressor(27830): 	at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.start(Compressor.kt:242)
E/Compressor(27830): 	at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:160)
E/Compressor(27830): 	at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:114)
E/Compressor(27830): 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/Compressor(27830): 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
E/Compressor(27830): 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
E/Compressor(27830): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
E/Compressor(27830): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
E/Compressor(27830): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

What may be causing this please ?

Support for custom frame rate

videos with I high fps are huge in size for example 60 fps. The file size would be smaller with a lower frame rate.

Unable to build iOS project

Some problem in .Swift file

Xcode's output:
↳
    Command CompileSwift failed with a nonzero exit code
    /Users/daksh/Development/flutter/.pub-cache/hosted/pub.dartlang.org/light_compressor-1.2.1/ios/Classes/LightCompressor.swift:205:45: error: cannot find 'ompletion' in scope
                                                ompletion(.onSuccess(destination))

Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.5.2 20G95 darwin-arm, locale
    en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2021.1.3)
[✓] VS Code (version 1.60.2)
[✓] Connected device (2 available)

• No issues found!

P.S
I even tried creating a new Flutter Project and added just this dependency!

Example App video is not working on iOS Devices

Hello everyone,

following is the case:

  1. I start the app on an IPhone 11
  2. I select a video
  3. It starts compressing
  4. When I click on the "Play video" button only a black screen will be shown with sound
  5. No error appears, yet it is not working

--> Review video for more information

RPReplay_Final1618560128.MP4

Potential crash while compressing

Sometimes i have this error that crashed my app :

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetReader startReading] cannot be called again after reading has already started'

As i really don't know anything about Swift, i have simply checked that on StackOverFlow and they all related to a video compression.
So if tells you something, please can you explain me why am i seeing this ?

Thanks a lot in advance

Compression never finishes on iOS

Hello,
I have implemented light compressor following the example. It works fine for 328 videos files out of 330.
All of them come from the same device, have the same format and video quality.
The issue also appear in the exemple application (latest version lightcompressor 1.1.1).

For the error itself, the issue is that there are none. No exception, no crash. It is just stuck at 100% and the response object is
never filled, and no callback are called.
If reading the swift code, it seem that it never opt out of:
videoReader.status == .completed

I attached the video as example.

Do you need additionnal information ?

video.MOV.zip

Light Compressor is crashing in android after creating the android build

Currently, I am using light_compressor: ^1.2.2

I have added the following dependencies in the app Gradle file
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3"
implementation 'com.github.AbedElazizShe:LightCompressor:1.0.0'

and, in the project Gradle file
maven { url 'https://jitpack.io' }

'1.6.10' is the Kotlin version

Please let me know, how can I resolve this issue.

The color of video change after compressing

I face this issue after compressing video then put it in video player, the color of video changed (Please check image_2)
The color of video saved in my album device is still okay (Please check image_1)
I don't know this issue belong to light_compressor or video_player library
I used to try to use another library video_compress and the color video was correct

This is my code

var response = await _lightCompressor.compressVideo(
   path: path,
   videoQuality: VideoQuality.very_high,
   video: Video(videoName: "${DateTime.now().millisecondsSinceEpoch}"),
   isMinBitrateCheckEnabled: false,
   android: AndroidConfig(isSharedStorage: false),
   ios: IOSConfig(saveInGallery: true),
 );

Btw this is very good library.
image_1
image_2

compress on android not working

Hi , using latest release 2.2.0 , on real Samsung device android 12

I see the response not returned

 final Result response = await _lightCompressor.compressVideo(
      path: item.path,
      //   destinationPath: _destinationPath,
      videoQuality: VideoQuality.medium,
      isMinBitrateCheckEnabled: false,
      video: Video(
        videoName: path.basename(item.path),
        keepOriginalResolution: true,
      ),
      android: AndroidConfig(isSharedStorage: true, saveAt: SaveAt.Movies),
      ios: IOSConfig(saveInGallery: true),
    ); 


it's stuck here , there is no error messages yet

Why light compressor creates a copy of the source file?

The light compressor creates a copy of the original file, during compression in the app directory (as shown in the attached screenshot). What purpose this copied file serves ? How to get the path of this copied file after compression, so that we can delete it?

Screenshot 2023-04-14 at 11 52 51 AM

Web

Please can you make it for web.

Provide a Dispose Method

Can provide a dispose method for LightCompressor? onProgressUpdated.listen is still executing after I exit the page.It seems that this listener is global, so that each listener receives it every time the video is compressed in parallel

Compression quality: can we add more detailed settings?

Hello,
We are testing the plugin and like it very much.

However, to get better results for our use case, we would need to set compression options.

For example, let's us consider an input File with size: 13.66MB

  • On iOS, FFMPEG is fast: result is 3.96MB in 2.5 sec, which is our reference
    With veryfast preset and below settings for -g and -r
    String command = "-i $_filePath -c:v libx264 -crf 23 -preset veryfast -g 12 -r 25 $outputPath";

  • On Android (mid-end phone) , it performs poorly, mostly due to Dart: 5.81MB in 6.39 sec

  • On Android with LightCompressor, we get better results than FFMPEG:

medium quality: 4.76MB 
compression time: 4.3 sec

high quality:: 6.10MB
compression time: 4.5 sec

For this specific case, we would like to get about 3,5-4MB in 2.5-3sec and we think this would be possible if we had a way to set compression options.
Can you please add this feature?

FATAL EXCEPTION - but the compressed file was created

Hello,
The compressed file was created but I have exception
light_compressor: ^2.0.1
device - Redmi 10C with MIUI 13.0.8
The example working OK!
sdk: ">=2.18.0 <3.0.0"

The following command .

`

           final dynamic response = await _lightCompressor.compressVideo(

            path: _videoPath,

            videoQuality: VideoQuality.very_low,

            isMinBitrateCheckEnabled: false,

            video: Video(videoName: videoName),

            android: AndroidConfig(isSharedStorage: true, saveAt: SaveAt.Movies),

            ios: IOSConfig(saveInGallery: false),

          );

The exception

I/flutter ( 798): kobi - post1 - onTap1/data/user/0/com.allerg3/cache/2023-05-28 00:37:47.338511.png-true I/flutter ( 798): kobi - post1 - onTap2/data/user/0/com.allerg3/cache/2023-05-28 00:37:47.338511.png I/flutter ( 798): kobi - picCompress -1-136040 I/flutter ( 798): kobi - picCompress -2-7798-20 I/flutter ( 798): kobi - picCompress -5-2290982-MyVideo-1685223483976.mp4 E/AndroidRuntime( 798): FATAL EXCEPTION: main E/AndroidRuntime( 798): Process: com.allerg3, PID: 798 E/AndroidRuntime( 798): java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA E/AndroidRuntime( 798): at android.media.MediaMetadataRetriever._setDataSource(Native Method) E/AndroidRuntime( 798): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:281) E/AndroidRuntime( 798): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:247) E/AndroidRuntime( 798): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:355) E/AndroidRuntime( 798): at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invokeSuspend(Compressor.kt:60) E/AndroidRuntime( 798): at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:8) E/AndroidRuntime( 798): at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:4) E/AndroidRuntime( 798): at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89) E/AndroidRuntime( 798): at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:169) E/AndroidRuntime( 798): at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) E/AndroidRuntime( 798): at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:53) E/AndroidRuntime( 798): at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:157) E/AndroidRuntime( 798): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) E/AndroidRuntime( 798): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) E/AndroidRuntime( 798): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) E/AndroidRuntime( 798): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) E/AndroidRuntime( 798): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) E/AndroidRuntime( 798): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) E/AndroidRuntime( 798): Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@9723242, Dispatchers.Main] W/com.allerg3( 798): type=1400 audit(0.0:27268): avc: denied { search } for name="mqsas" dev="dm-9" ino=267 scontext=u:r:untrusted_app:s0:c69,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.allerg3 W/OOMEventManagerFK( 798): Failed to mkdir /data/mqsas/hprof/ W/com.allerg3( 798): type=1400 audit(0.0:27269): avc: denied { search } for name="mqsas" dev="dm-9" ino=267 scontext=u:r:untrusted_app:s0:c69,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.allerg3 W/com.allerg3( 798): type=1400 audit(0.0:27270): avc: denied { search } for name="mqsas" dev="dm-9" ino=267 scontext=u:r:untrusted_app:s0:c69,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.allerg3 W/com.allerg3( 798): type=1400 audit(0.0:27271): avc: denied { search } for name="mqsas" dev="dm-9" ino=267 scontext=u:r:untrusted_app:s0:c69,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.allerg3 W/com.allerg3( 798): type=1400 audit(0.0:27272): avc: denied { getattr } for path="/data/mqsas" dev="dm-9" ino=267 scontext=u:r:untrusted_app:s0:c69,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.allerg3 W/System ( 798): A resource failed to call close. W/System ( 798): A resource failed to call close. W/System ( 798): A resource failed to call close. W/System ( 798): A resource failed to call close. W/System ( 798): A resource failed to call close. W/System ( 798): A resource failed to call close. W/System ( 798): A resource failed to call close.

Crash on iOS

compressVideo() fails on iOS with the following error and crashes the app.

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file light_compressor/SwiftLightCompressorPlugin.swift, line 50
2020-11-23 21:31:38.271662+0530 Runner[3122:693161] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file light_compressor/SwiftLightCompressorPlugin.swift, line 50

NullPointerException Error

When I compress the video, I receive a succes message and it also delivers a file output. ذut the output is not usable at all. I saw an error in the log, which is probably the problem.

Log:

E/Compressor( 4661): An error has occurred!
E/Compressor( 4661): java.lang.NullPointerException
E/Compressor( 4661): 	at com.abedelazizshe.lightcompressorlibrary.video.Track.<init>(Track.kt:248)
E/Compressor( 4661): 	at com.abedelazizshe.lightcompressorlibrary.video.Mp4Movie.addTrack(Mp4Movie.kt:51)
E/Compressor( 4661): 	at com.abedelazizshe.lightcompressorlibrary.video.MP4Builder.addTrack(MP4Builder.kt:112)
E/Compressor( 4661): 	at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.processAudio(Compressor.kt:445)
E/Compressor( 4661): 	at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.start(Compressor.kt:404)
E/Compressor( 4661): 	at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:160)
E/Compressor( 4661): 	at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:114)
E/Compressor( 4661): 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/Compressor( 4661): 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
E/Compressor( 4661): 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
E/Compressor( 4661): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
E/Compressor( 4661): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
E/Compressor( 4661): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I/flutter ( 4661): Success

My codes:

final LightCompressor _lightCompressor = LightCompressor();
    final dynamic response = await _lightCompressor.compressVideo(
        path: file.path,
        destinationPath: await _destinationFile,
        videoQuality: VideoQuality.low,
        isMinBitrateCheckEnabled: false,
        frameRate: 24);

    if (response is OnSuccess) {
      print('Success');
    } else if (response is OnFailure) {
      print( response.message.toString());
    } else if (response is OnCancelled) {
      print(response.isCancelled.toString());
    }

Device:
Google pixel 3a Android 10

Audio is getting out of sync. Audio clarity is very bad after compressing

Audio is getting out of sync. Audio clarity is very bad after compressing.
can someone help or point out if im doing something wrong.

VideoQuality compressQuality =
              Platform.isAndroid ? VideoQuality.very_low : VideoQuality.medium;
          var response = await _lightCompressor.compressVideo(
              path: pickedFile.path,
              destinationPath: destinationPath,
              videoQuality: compressQuality,
              iosSaveInGallery: false);

Compression on Android 13 and other versions not working after authorization

I have an OPPO A16s phone with Android 13
I added in my manifest file the permissions below:




Here's a code snippet I used:
Future _pickVideo() async {
_isVideoCompressed = false;

 final FilePickerResult? result = await FilePicker.platform.pickFiles(
   type: FileType.video,
 );

 finalPlatformFile? file = result?.files.first;

 if (file == null) {
   return;
 }

 _filePath = file.path;

 setState(() {
   _failureMessage = null;
 });

 final String videoName =
     'MyVideo-${DateTime.now().millisecondsSinceEpoch}.mp4';

 final Stopwatch stopwatch = Stopwatch()..start();
 final Result response = await _lightCompressor.compressVideo(
   path: _filePath!,
   videoQuality: VideoQuality.medium,
   isMinBitrateCheckEnabled: false,
   video: Video(videoName: videoName),
   android: AndroidConfig(isSharedStorage: true, saveAt: SaveAt.Movies),
   ios: IOSConfig(saveInGallery: false),
 );

 stopwatch.stop();
 final Duration duration =
     Duration(milliseconds: stopwatch.elapsedMilliseconds);
 _duration = duration.inSeconds;

 if (response is OnSuccess) {
   setState(() {
     _desFile = response.destinationPath;
     _displayedFile = _desFile;
     _isVideoCompressed = true;
   });
   print("Old path: $_filePath");
   print("new path compressed: ${response.destinationPath}");
 } else if (response is OnFailure) {
   setState(() {
     _failureMessage = response.message;
   });
 } else if (response is OnCancelled) {
   print(response.isCancelled);
 }

}
When I click on FilePicker, a dialog box appears asking for access to images and videos, as long as I do not accept the permission, the compression works. If only I accept the permission, the compression no longer works.

Under Android 13, I see this on the console output:
Caching from URI: content://media/picker/0/com.android.providers.media.photopicker/media/1000077196
D/FilePickerUtils(4441): File loaded and cached at:/data/user/0/com.lecteur.video/cache/file_picker/1000077196.mp4
D/FilePickerDelegate(4441): [MultiFilePick] File #0 - URI: /picker/0/com.android.providers.media.photopicker/media/1000077196

Under Android 8.1.0, console output:
Caching from URI: content://com.android.providers.media.documents/document/video%3A14815
File loaded and cached at:/data/user/0/com.lecteur.video/cache/file_picker/VID-20231209-WA0085.mp4
D/FilePickerDelegate(18106): File path:[com.mr.flutter.plugin.filepicker.FileInfo@c947eb8]

Please add feature to resize videos

Hello sir,

Can you add sample to resize the video.Like your other dependency in android .If that is already exist kindly add inside sample.

return when (quality) {
VideoQuality.VERY_LOW -> (bitrate * 0.1).roundToInt()
VideoQuality.LOW -> (bitrate * 0.2).roundToInt()
VideoQuality.MEDIUM -> (bitrate * 0.3).roundToInt()
VideoQuality.HIGH -> (bitrate * 0.4).roundToInt()
VideoQuality.VERY_HIGH -> (bitrate * 0.6).roundToInt()
}

when {
width >= 1920 || height >= 1920 -> {
newWidth = (((width * 0.5) / 16).roundToInt() * 16)
newHeight = (((height * 0.5) / 16f).roundToInt() * 16)
}
width >= 1280 || height >= 1280 -> {
newWidth = (((width * 0.75) / 16).roundToInt() * 16)
newHeight = (((height * 0.75) / 16).roundToInt() * 16)
}
width >= 960 || height >= 960 -> {
newWidth = (((width * 0.95) / 16).roundToInt() * 16)
newHeight = (((height * 0.95) / 16).roundToInt() * 16)
}
else -> {
newWidth = (((width * 0.9) / 16).roundToInt() * 16)
newHeight = (((height * 0.9) / 16).roundToInt() * 16)
}
}

Initial file gets cached and not deleted after compression #168

Hello,

This issue has been fixed in the Android version cf. title but not in flutter... A pitty :-(

Each time you run a compression it copies the original file in the local cache of the app but doesn't clear it at the end of the compression or when cancelled.

More seriously can you fix it in flutter too ?

Many thanks for your work.

Saving the Video to the app storage

While compressing the video, the file is saved in app storage, I need to delete that, as in my app, user is compressing many videos of large size, I think this library is storing two videos, one that is original and other is the compressed one. These video are stored in apps storage, so user can't even see or delete it later.
Please is there any way I can solve that.
Thankyou

I got exception? Could anyone help me to move forward. "e: /Users/rammohan/Downloads/Flutter_Files/flutter/.pub-cache/hosted/pub.dartlang.org/light_compressor-0.0.7/android/src/main/kotlin/com/abedelazizshe/light_compressor/LightCompressorPlugin.kt: (94, 45): Expecting a parameter declaration e: /Users/rammohan/Downloads/Flutter_Files/flutter/.pub-cache/hosted/pub.dartlang.org/light_compressor-0.0.7/android/src/main/kotlin/com/abedelazizshe/light_compressor/LightCompressorPlugin.kt: (124, 65): Expecting an argument"

iOS App is force closing once the compressVideo method is called

I have a picked video from the image picker. Now once I call LightCompressor.compressVideo following error appears and force closes the app:

`*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetReader startReading] cannot be called again after reading has already started'
*** First throw call stack:
(0x19d2b186c 0x1b22cac50 0x1a4df1fe8 0x10498f040 0x10498f4c0 0x10498f570 0x19cea424c 0x19cea5db0 0x19cead10c 0x19ceadc5c 0x19ceb7d78 0x1e8d5d814 0x1e8d6476c)
libc++abi.dylib: terminating with uncaught exception of type NSException

  • thread #61, queue = 'processingQueue1', stop reason = signal SIGABRT
    frame #0: 0x00000001cb201414 libsystem_kernel.dylib__pthread_kill + 8 libsystem_kernel.dylib__pthread_kill:
    -> 0x1cb201414 <+8>: b.lo 0x1cb201434 ; <+40>
    0x1cb201418 <+12>: pacibsp
    0x1cb20141c <+16>: stp x29, x30, [sp, #-0x10]!
    0x1cb201420 <+20>: mov x29, sp
    Target 0: (Runner) stopped.
    Lost connection to device.`

IOS crash

after compress the video , couldn't get the file path

PathNotFoundException: Cannot retrieve length of file

final LightCompressor lightCompressor = LightCompressor();

  final Result response = await lightCompressor.compressVideo(
    path: file.path,
    videoQuality: VideoQuality.medium,
    isMinBitrateCheckEnabled: false,
    video: Video(videoName: file.path.split('.').first),
    android: AndroidConfig(
      isSharedStorage: false,
    ),
    ios: IOSConfig(saveInGallery: true),
  );
  debugPrint('==================> Compression finished <==============');
  if (response is OnSuccess) {
    debugPrint('==================> Compression OnSuccess <==============');

    final String outputFile = response.destinationPath;

Do not save the video in the gallery

Hello, any idea how to not save the video in the phone gallery?

my code :

var file;
final tmpDir = await getTemporaryDirectory();

 final Map<String, dynamic> response = await LightCompressor.compressVideo(
          path: _attachement.path,
          destinationPath: '${tmpDir.path}/${DateTime.now().millisecondsSinceEpoch}.mp4',
          videoQuality: VideoQuality.high,
          isMinBitRateEnabled: false,
          keepOriginalResolution: false,
);

if (response['onSuccess'] != null) {
          file = File(response['onSuccess']);
} else if (response['onFailure'] != null) {

 } else if (response['onCancelled'] != null) {
     
}

if (file.existsSync()) {
          file.deleteSync();
}

thx for your time 😇

compressVideo: throws Start failed exception

When passing video file path that is captured from camera, the compressVideo function throws start failed exception.(the file path is of the application's cache directory, not being saved in device storage)
When passing video file path from device gallery, it's working fine.

In the sample app, there is no option to use video captured from camera
Please suggest a fix

Versions
Flutter 3.13.0
Dart 3.1.0
Android Version: 13
Device: xiaomi 11 lite ne

v2.0.0 still requires minSdkVersion 24

Hi,

My flutter app supports Android SDK versions 21 and above and so I selected light_compressor v 2.0.0 because as per documentation, it requires minSdkVersion 21. However, I'm still getting the following error:

C:\AndroidStudioFlutterProjects\HECentral\android\app\src\debug\AndroidManifest.xml Error: uses-sdk:minSdkVersion 21 cannot be smaller than version 24 declared in library [:light_compressor] C:\AndroidStudioFlutterProjects\HECentral\build\light_compressor\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 21 Suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 24, or use tools:overrideLibrary="com.abedelazizshe.light_compressor" to force usage (may lead to runtime failures)

I've added implementation 'com.github.AbedElazizShe:LightCompressor:1.2.2' in module level build file. In app level build file, I'm using ext.kotlin_version = '1.8.0'.

Please inform how I can use this package in a flutter app that supports SDK versions 21 and above.

this plugin not compressing 4k videos of resolution 3840 × 2160 and giving exception in android. working fine in ios

This is the original video which i am try to compress

I/flutter ( 1799): VideoCompress: You can try to subscribe to the
I/flutter ( 1799): compressProgress$ stream to know the compressing state.
D/MPEG4Writer( 1799): PreAllocation enabled
I/DefaultVideoStrategy( 1799): Input width&height: 3840x2160
I/DefaultVideoStrategy( 1799): Output width&height: 1136x640
V/Engine ( 1799): Duration (us): 4501000
V/Engine ( 1799): new step: 0
D/MediaCodecList( 1799): codecHandlesFormat: no format, so no extra checks
D/MediaCodecList( 1799): codecHandlesFormat: no format, so no extra checks
I/MediaCodec( 1799): (0xb4000070debcb740) init name(c2.android.aac.encoder)
D/CCodec ( 1799): allocate(c2.android.aac.encoder)
I/CCodec ( 1799): setting up 'default' as default (vendor) store
I/CCodec ( 1799): Created component [c2.android.aac.encoder]
D/CCodecConfig( 1799): read media type: audio/mp4a-latm
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig( 1799): query failed after returning 9 values (BAD_INDEX)
D/CCodecConfig( 1799): c2 config diff is Dict {
D/CCodecConfig( 1799): c2::u32 coded.bitrate.value = 64000
D/CCodecConfig( 1799): c2::u32 coded.pl.level = 0
D/CCodecConfig( 1799): c2::u32 coded.pl.profile = 8192
D/CCodecConfig( 1799): c2::u32 coding.aac-sbr-mode.value = 3
D/CCodecConfig( 1799): c2::u32 input.buffers.max-size.value = 2048
D/CCodecConfig( 1799): c2::u32 input.delay.value = 0
D/CCodecConfig( 1799): string input.media-type.value = "audio/raw"
D/CCodecConfig( 1799): string output.media-type.value = "audio/mp4a-latm"
D/CCodecConfig( 1799): c2::u32 raw.channel-count.value = 1
D/CCodecConfig( 1799): c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig( 1799): }
I/MediaCodec( 1799): (0xb4000070debcb740) Component Allocated (c2.android.aac.encoder)
I/MediaCodec( 1799): (0xb4000070debcb740) configure surface(0x0) crypto(0x0) flags(1)
D/MediaCodec( 1799): (0xb4000070debcb740) configure format: AMessage(what = 0x00000000) = {
D/MediaCodec( 1799): int32_t sample-rate = 48000
D/MediaCodec( 1799): string mime = "audio/mp4a-latm"
D/MediaCodec( 1799): int32_t channel-count = 2
D/MediaCodec( 1799): int32_t bitrate = 1152000
D/MediaCodec( 1799): int32_t aac-profile = 2
D/MediaCodec( 1799): }
D/MediaCodec( 1799): shapeMediaFormat: deltas(0): AMessage(what = 0x00000000) = {
D/MediaCodec( 1799): }
D/CCodec ( 1799): [c2.android.aac.encoder] buffers are bound to CCodec for this session
D/CCodecConfig( 1799): no c2 equivalents for flags
D/CCodecConfig( 1799): no c2 equivalents for encoder
D/CCodecConfig( 1799): c2 config diff is c2::u32 coded.bitrate.value = 1152000
D/CCodecConfig( 1799): c2::u32 raw.channel-count.value = 2
D/CCodecConfig( 1799): c2::u32 raw.sample-rate.value = 48000
W/Codec2Client( 1799): query -- param skipped: index = 1107298332.
D/CCodec ( 1799): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec ( 1799): int32_t sample-rate = 48000
D/CCodec ( 1799): int32_t channel-count = 2
D/CCodec ( 1799): int32_t max-input-size = 4096
D/CCodec ( 1799): string mime = "audio/raw"
D/CCodec ( 1799): int32_t android._config-pcm-encoding = 2
D/CCodec ( 1799): }
D/CCodec ( 1799): setup formats output: AMessage(what = 0x00000000) = {
D/CCodec ( 1799): int32_t sample-rate = 48000
D/CCodec ( 1799): int32_t bitrate = 1152000
D/CCodec ( 1799): int32_t channel-count = 2
D/CCodec ( 1799): int32_t level = 0
D/CCodec ( 1799): int32_t max-bitrate = 1152000
D/CCodec ( 1799): string mime = "audio/mp4a-latm"
D/CCodec ( 1799): int32_t profile = 2
D/CCodec ( 1799): }
I/CCodecConfig( 1799): query failed after returning 9 values (BAD_INDEX)
D/CCodecConfig( 1799): c2 config diff is c2::u32 input.buffers.max-size.value = 4096
I/MediaCodec( 1799): (0xb4000070debcb740) start
W/Codec2Client( 1799): query -- param skipped: index = 1342179345.
W/Codec2Client( 1799): query -- param skipped: index = 2415921170.
W/Codec2Client( 1799): query -- param skipped: index = 3254792206.
W/Codec2Client( 1799): query -- param skipped: index = 3254792194.
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec695c8 : 1(3133440 size) total buffers - 1(3133440 size) used buffers - 18/23 (recycle/alloc) - 5/24 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec74c78 : 2(6266880 size) total buffers - 2(6266880 size) used buffers - 19/26 (recycle/alloc) - 7/27 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ebdbdd8 : 0(0 size) total buffers - 0(0 size) used buffers - 19/32 (recycle/alloc) - 13/32 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec76f28 : 0(0 size) total buffers - 0(0 size) used buffers - 24/37 (recycle/alloc) - 13/37 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706eb84478 : 0(0 size) total buffers - 0(0 size) used buffers - 40/50 (recycle/alloc) - 10/51 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec7c958 : 0(0 size) total buffers - 0(0 size) used buffers - 87/99 (recycle/alloc) - 12/100 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706eb856f8 : 0(0 size) total buffers - 0(0 size) used buffers - 130/144 (recycle/alloc) - 14/144 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ecbf5b8 : 3(9400320 size) total buffers - 3(9400320 size) used buffers - 241/254 (recycle/alloc) - 15/249 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec02748 : 4(32768 size) total buffers - 4(32768 size) used buffers - 384/395 (recycle/alloc) - 16/387 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ebb0818 : 3(9400320 size) total buffers - 3(9400320 size) used buffers - 332/342 (recycle/alloc) - 11/337 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ebd4a38 : 3(9400320 size) total buffers - 3(9400320 size) used buffers - 497/505 (recycle/alloc) - 10/499 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec80eb8 : 4(32768 size) total buffers - 4(32768 size) used buffers - 576/582 (recycle/alloc) - 9/575 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ecf3198 : 4(16384 size) total buffers - 4(16384 size) used buffers - 1/5 (recycle/alloc) - 0/0 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec2d178 : 4(32768 size) total buffers - 4(32768 size) used buffers - 1/6 (recycle/alloc) - 1/2 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706eb9d928 : 4(16384 size) total buffers - 4(16384 size) used buffers - 1/5 (recycle/alloc) - 0/0 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ece71a8 : 4(32768 size) total buffers - 4(32768 size) used buffers - 1/6 (recycle/alloc) - 1/2 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706eca2e28 : 4(16384 size) total buffers - 4(16384 size) used buffers - 1/5 (recycle/alloc) - 0/0 (fetch/transfer)
D/BufferPoolAccessor2.0( 1799): bufferpool2 0xb40000706ec7d4e8 : 4(32768 size) total buffers - 4(32768 size) used buffers - 1/6 (recycle/alloc) - 1/2 (fetch/transfer)
D/CCodecBufferChannel( 1799): [c2.android.aac.encoder#299] Created input block pool with allocatorID 16 => poolID 49 - OK (0)
I/CCodecBufferChannel( 1799): [c2.android.aac.encoder#299] Created output block pool with allocatorID 16 => poolID 495 - OK
D/CCodecBufferChannel( 1799): [c2.android.aac.encoder#299] Configured output block pool ids 495 => OK
D/CCodecBufferChannel( 1799): [c2.android.aac.encoder#299] start: updating output delay 0
I/CCodecBufferChannel( 1799): pipelineRoom(3) is <= numClientBuffers(3). Not signalling any more buffers to client
I/MediaCodec( 1799): (0xb4000070debcb740) kWhatStartCompleted
D/CCodecBufferChannel( 1799): [c2.android.aac.encoder#299] sending CSD : output format changed to AMessage(what = 0x00000000) = {
D/CCodecBufferChannel( 1799): int32_t sample-rate = 48000
D/CCodecBufferChannel( 1799): int32_t bitrate = 1152000
D/CCodecBufferChannel( 1799): int32_t channel-count = 2
D/CCodecBufferChannel( 1799): int32_t level = 0
D/CCodecBufferChannel( 1799): int32_t max-bitrate = 1152000
D/CCodecBufferChannel( 1799): string mime = "audio/mp4a-latm"
D/CCodecBufferChannel( 1799): int32_t profile = 2
D/CCodecBufferChannel( 1799): Buffer csd-0 = {
D/CCodecBufferChannel( 1799): 00000000: 11 90 ..
D/CCodecBufferChannel( 1799): }
D/CCodecBufferChannel( 1799): }
D/MediaCodecList( 1799): codecHandlesFormat: no format, so no extra checks
D/MediaCodecList( 1799): codecHandlesFormat: no format, so no extra checks
I/MediaCodec( 1799): (0xb4000070deba44d0) init name(c2.android.aac.decoder)
D/CCodec ( 1799): allocate(c2.android.aac.decoder)
I/CCodec ( 1799): setting up 'default' as default (vendor) store
I/CCodec ( 1799): Created component [c2.android.aac.decoder]
D/CCodecConfig( 1799): read media type: audio/mp4a-latm
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig( 1799): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig( 1799): c2 config diff is Dict {
D/CCodecConfig( 1799): c2::u32 coded.aac-packaging.value = 0
D/CCodecConfig( 1799): c2::u32 coded.bitrate.value = 64000
D/CCodecConfig( 1799): c2::u32 coded.pl.level = 0
D/CCodecConfig( 1799): c2::u32 coded.pl.profile = 8192
D/CCodecConfig( 1799): c2::i32 coding.drc.album-mode.value = 0
D/CCodecConfig( 1799): c2::float coding.drc.attenuation-factor.value = 1
D/CCodecConfig( 1799): c2::float coding.drc.boost-factor.value = 1
D/CCodecConfig( 1799): c2::i32 coding.drc.compression-mode.value = 3
D/CCodecConfig( 1799): c2::i32 coding.drc.effect-type.value = 3
D/CCodecConfig( 1799): c2::float coding.drc.encoded-level.value = 0.25
D/CCodecConfig( 1799): c2::float coding.drc.reference-level.value = -16
D/CCodecConfig( 1799): c2::u32 input.buffers.max-size.value = 8192
D/CCodecConfig( 1799): c2::u32 input.delay.value = 0
D/CCodecConfig( 1799): string input.media-type.value = "audio/mp4a-latm"
D/CCodecConfig( 1799): c2::u32 output.delay.value = 2
D/CCodecConfig( 1799): c2::float output.drc.output-loudness.value = 0.25
D/CCodecConfig( 1799): string output.media-type.value = "audio/raw"
D/CCodecConfig( 1799): c2::u32 raw.channel-count.value = 1
D/CCodecConfig( 1799): c2::u32 raw.max-channel-count.value = 8
D/CCodecConfig( 1799): c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig( 1799): }
I/MediaCodec( 1799): (0xb4000070deba44d0) Component Allocated (c2.android.aac.decoder)
I/MediaCodec( 1799): (0xb4000070deba44d0) configure surface(0x0) crypto(0x0) flags(0)
D/MediaCodec( 1799): (0xb4000070deba44d0) configure format: AMessage(what = 0x00000000) = {
D/MediaCodec( 1799): int32_t max-bitrate = 259456
D/MediaCodec( 1799): int32_t sample-rate = 48000
D/MediaCodec( 1799): int32_t track-id = 2
D/MediaCodec( 1799): string mime = "audio/mp4a-latm"
D/MediaCodec( 1799): int32_t profile = 2
D/MediaCodec( 1799): string language = "und"
D/MediaCodec( 1799): int32_t aac-profile = 2
D/MediaCodec( 1799): int32_t encoder-delay = 0
D/MediaCodec( 1799): int64_t durationUs = 4501333
D/MediaCodec( 1799): int32_t channel-count = 2
D/MediaCodec( 1799): int32_t encoder-padding = 64
D/MediaCodec( 1799): int32_t max-input-size = 696
D/MediaCodec( 1799): Buffer csd-0 = {
D/MediaCodec( 1799): 00000000: 11 90 ..
D/MediaCodec( 1799): }
D/MediaCodec( 1799): }
D/CCodec ( 1799): [c2.android.aac.decoder] buffers are bound to CCodec for this session
D/CCodecConfig( 1799): no c2 equivalents for track-id
D/CCodecConfig( 1799): no c2 equivalents for language
D/CCodecConfig( 1799): no c2 equivalents for encoder-delay
D/CCodecConfig( 1799): no c2 equivalents for durationUs
D/CCodecConfig( 1799): no c2 equivalents for encoder-padding
D/CCodecConfig( 1799): no c2 equivalents for flags
D/CCodecConfig( 1799): config failed => CORRUPTED
D/CCodecConfig( 1799): c2 config diff is c2::u32 raw.channel-count.value = 2
D/CCodecConfig( 1799): c2::u32 raw.sample-rate.value = 48000
W/Codec2Client( 1799): query -- param skipped: index = 1107298332.
D/CCodec ( 1799): client requested max input size 696, which is smaller than what component recommended (8192); overriding with component recommendation.
W/CCodec ( 1799): This behavior is subject to change. It is recommended that app developers double check whether the requested max input size is in reasonable range.
D/CCodec ( 1799): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec ( 1799): int32_t aac-drc-album-mode = 0
D/CCodec ( 1799): int32_t aac-drc-boost-level = 127
D/CCodec ( 1799): int32_t aac-drc-cut-level = 127
D/CCodec ( 1799): int32_t aac-drc-effect-type = 3
D/CCodec ( 1799): int32_t aac-encoded-target-level = -1
D/CCodec ( 1799): int32_t aac-max-output-channel_count = 8
D/CCodec ( 1799): int32_t aac-target-ref-level = 64
D/CCodec ( 1799): int32_t bitrate = 64000
D/CCodec ( 1799): int32_t channel-count = 2
D/CCodec ( 1799): int32_t level = 0
D/CCodec ( 1799): int32_t max-input-size = 8192
D/CCodec ( 1799): string mime = "audio/mp4a-latm"
D/CCodec ( 1799): int32_t profile = 2
D/CCodec ( 1799): int32_t sample-rate = 48000
D/CCodec ( 1799): }
D/CCodec ( 1799): setup formats output: AMessage(what = 0x00000000) = {
D/CCodec ( 1799): int32_t aac-drc-album-mode = 0
D/CCodec ( 1799): int32_t aac-drc-boost-level = 127
D/CCodec ( 1799): int32_t aac-drc-cut-level = 127
D/CCodec ( 1799): int32_t aac-drc-effect-type = 3
D/CCodec ( 1799): int32_t aac-drc-output-loudness = -1
D/CCodec ( 1799): int32_t aac-encoded-target-level = -1
D/CCodec ( 1799): int32_t aac-max-output-channel_count = 8
D/CCodec ( 1799): int32_t aac-target-ref-level = 64
D/CCodec ( 1799): int32_t channel-count = 2
D/CCodec ( 1799): string mime = "audio/raw"
D/CCodec ( 1799): int32_t sample-rate = 48000
D/CCodec ( 1799): int32_t encoder-delay = 0
D/CCodec ( 1799): int32_t encoder-padding = 64
D/CCodec ( 1799): int32_t android._config-pcm-encoding = 2
D/CCodec ( 1799): }
I/CCodecConfig( 1799): query failed after returning 19 values (BAD_INDEX)
I/MediaCodec( 1799): (0xb4000070deba44d0) start
W/Codec2Client( 1799): query -- param skipped: index = 1342179345.
W/Codec2Client( 1799): query -- param skipped: index = 2415921170.
W/Codec2Client( 1799): query -- param skipped: index = 1610614798.
D/CCodecBufferChannel( 1799): [c2.android.aac.decoder#756] Created input block pool with allocatorID 16 => poolID 50 - OK (0)
I/CCodecBufferChannel( 1799): [c2.android.aac.decoder#756] Created output block pool with allocatorID 16 => poolID 496 - OK
D/CCodecBufferChannel( 1799): [c2.android.aac.decoder#756] Configured output block pool ids 496 => OK
D/CCodecBufferChannel( 1799): [c2.android.aac.decoder#756] start: updating output delay 2
I/MediaCodec( 1799): (0xb4000070deba44d0) kWhatStartCompleted
D/MediaCodecList( 1799): codecHandlesFormat: no format, so no extra checks
D/MediaCodecList( 1799): codecHandlesFormat: no format, so no extra checks
I/MediaCodec( 1799): (0xb4000070ded27cf0) init name(c2.qti.avc.encoder)
D/CCodec ( 1799): allocate(c2.qti.avc.encoder)
I/CCodec ( 1799): setting up 'default' as default (vendor) store
I/CCodec ( 1799): Created component [c2.qti.avc.encoder]
D/CCodecConfig( 1799): read media type: video/avc
D/ReflectedParamUpdater( 1799): ignored struct field coding.gop.values
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: vendor.qti-ext-enc-info-metadata-cvp.reserved
D/ReflectedParamUpdater( 1799): extent() != 1 for single value type: output.buffers.pool-ids.values
D/CCodecConfig( 1799): ignoring local param raw.color (0xc2001809) as it is already supported
I/CCodecConfig( 1799): query failed after returning 23 values (BAD_INDEX)
D/CCodecConfig( 1799): c2 config diff is Dict {
D/CCodecConfig( 1799): c2::u32 algo.bitrate-mode.value = 3
D/CCodecConfig( 1799): c2::u32 algo.complexity.value = 0
D/CCodecConfig( 1799): c2::i32 algo.priority.value = 0
D/CCodecConfig( 1799): c2::float algo.rate.value = 30
D/CCodecConfig( 1799): c2::u32 algo.secure-mode.value = 0
D/CCodecConfig( 1799): c2::u32 coded.bitrate.value = 20000000
D/CCodecConfig( 1799): c2::float coded.frame-rate.value = 30
D/CCodecConfig( 1799): c2::u32 coded.pl.level = 0
D/CCodecConfig( 1799): c2::u32 coded.pl.profile = 20484
D/CCodecConfig( 1799): c2::u32 coded.vui.color.matrix = 255
D/CCodecConfig( 1799): c2::u32 coded.vui.color.primaries = 0
D/CCodecConfig( 1799): c2::u32 coded.vui.color.range = 0
D/CCodecConfig( 1799): c2::u32 coded.vui.color.transfer = 255
D/CCodecConfig( 1799): c2::u32 coding.intra-refresh.mode = 0
D/CCodecConfig( 1799): c2::float coding.intra-refresh.period = 0
D/CCodecConfig( 1799): c2::u32 coding.request-sync-frame.value = 0
D/CCodecConfig( 1799): c2::i64 coding.sync-frame-interval.value = 1000000
D/CCodecConfig( 1799): Buffer coding.temporal-layering = {
D/CCodecConfig( 1799): 00000000: 10 00 00 00 07 20 01 52 00 00 00 00 00 00 00 00 ..... .R........
D/CCodecConfig( 1799): }
D/CCodecConfig( 1799): c2::u32 default.color.matrix = 0
D/CCodecConfig( 1799): c2::u32 default.color.primaries = 0
D/CCodecConfig( 1799): c2::u32 default.color.range = 0
D/CCodecConfig( 1799): c2::u32 default.color.transfer = 0
D/CCodecConfig( 1799): c2::u32 input.delay.value = 0
D/CCodecConfig( 1799): string input.media-type.value = "v
W/ColorUtils( 1799): expected specified color aspects (0:0:255:255)
I/MediaCodec( 1799): (0xb4000070ded27cf0) Component Allocated (c2.qti.avc.encoder)
I/MediaCodec( 1799): (0xb4000070ded27cf0) configure surface(0x0) crypto(0x0) flags(1)
D/MediaCodec( 1799): (0xb4000070ded27cf0) configure format: AMessage(what = 0x00000000) = {
D/MediaCodec( 1799): int32_t color-format = 2130708361
D/MediaCodec( 1799): float i-frame-interval = 3.000000
D/MediaCodec( 1799): string mime = "video/avc"
D/MediaCodec( 1799): int32_t width = 1136
D/MediaCodec( 1799): int32_t bitrate = 2442854
D/MediaCodec( 1799): int32_t rotation-degrees = 0
D/MediaCodec( 1799): int32_t frame-rate = 24
D/MediaCodec( 1799): int32_t height = 640
D/MediaCodec( 1799): }
D/VQApply ( 1799): minquality: requested QP unsupported, boost bitrate 2442854 by 488570
D/VQApply ( 1799): minquality: bitrate increase clamped at ceiling 2862720
D/VQApply ( 1799): minquality/target bitrate raised from 2442854 to 2862720 bps
D/MediaCodec( 1799): shapeMediaFormat: deltas(2): AMessage(what = 0x00000000) = {
D/MediaCodec( 1799): int32_t bitrate = 2862720
D/MediaCodec( 1799): int32_t android._encoding-quality-level = 0
D/MediaCodec( 1799): }
D/CCodec ( 1799): [c2.qti.avc.encoder] buffers are bound to CCodec for this session
D/CCodecConfig( 1799): no c2 equivalents for color-format
D/CCodecConfig( 1799): no c2 equivalents for flags
D/CCodecConfig( 1799): no c2 equivalents for encoder
D/CCodecConfig( 1799): c2 config diff is c2::u32 coded.bitrate.value = 2862720
D/CCodecConfig( 1799): c2::float coded.frame-rate.value = 24
D/CCodecConfig( 1799): c2::i64 coding.sync-frame-interval.value = 3000000
D/CCodecConfig( 1799): c2::u32 raw.pixel-format.value = 34
D/CCodecConfig( 1799): c2::u32 raw.size.height = 640
D/CCodecConfig( 1799): c2::u32 raw.size.width = 1136
W/ColorUtils( 1799): expected specified color aspects (0:0:255:255)
W/Codec2Client( 1799): query -- param skipped: index = 3254781982.
D/CCodec ( 1799): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec ( 1799): int32_t android._color-format = 2130708361
D/CCodec ( 1799): Rect crop(0, 0, 1135, 639)
D/CCodec ( 1799): int32_t color-standard = 130816
D/CCodec ( 1799): int32_t color-range = 0
D/CCodec ( 1799): int32_t color-transfer = 65791
D/CCodec ( 1799): int32_t width = 1136
D/CCodec ( 1799): int32_t android._dataspace = 12648448
D/CCodec ( 1799): int32_t feature-secure-playback = 0
D/CCodec ( 1799): int32_t frame-rate = 24
D/CCodec ( 1799): int32_t height = 640
D/CCodec ( 1799): int32_t intra-refresh-period = 0
D/CCodec ( 1799): string mime = "video/raw"
D/CCodec ( 1799): int32_t prepend-sps-pps-to-idr-frames = 0
D/CCodec ( 1799): int32_t priority = 0
D/CCodec ( 1799): Buffer hdr-static-info = {
D/CCodec ( 1799): 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
D/CCodec ( 1799): 00000010: 00 00 00 00 00 00 00 00 00 .........
D/CCodec ( 1799): }
D/CCodec ( 1799): int64_t android._C2MemoryUsage = 0
D/CCodec ( 1799): int32_t color-format = 2130708361
D/CCodec ( 1799): }
D/CCodec ( 1799): setup formats output: AMessage(what = 0x00000000) = {
D/CCodec ( 1799): int32_t bitrate = 2862720
D/CCodec ( 1799): int32_t bitrate-mode = 1
D/CCodec ( 1799): Rect crop(0, 0, 1135, 639)
D/CCodec ( 1799): int32_t width = 1136
D/CCodec ( 1799): int32_t color-standard = 130816
D/CCodec ( 1799): int32_t color-range = 0
D/CCodec ( 1799): int32_t color-transfer = 65791
D/CCodec ( 1799): int32_t feature-secure-playback = 0
D/CCodec ( 1799): int32_t frame-rate = 24
D/CCodec ( 1799): int32_t height = 640
D/CCodec ( 1799): int32_t intra-refresh-period = 0
D/CCodec ( 1799): int32_t max-bitrate = 2862720
D/CCodec ( 1799): string mime = "video/avc"
D/CCodec ( 1799): int32_t prepend-sps-pps-to-idr-frames = 0
D/CCodec ( 1799): int32_t priority = 0
D/CCodec ( 1799): int32_t profile = 8
D/CCodec ( 1799): }
I/CCodecConfig( 1799): query failed after returning 23 values (BAD_INDEX)
D/CCodec ( 1799): input format changed to AMessage(what = 0x00000000) = {
D/CCodec ( 1799): int32_t android._color-format = 2130708361
D/CCodec ( 1799): Rect crop(0, 0, 1135, 639)
D/CCodec ( 1799): int32_t color-standard = 1
D/CCodec ( 1799): int32_t color-range = 2
D/CCodec ( 1799): int32_t color-transfer = 3
D/CCodec ( 1799): int32_t width = 1136
D/CCodec ( 1799): int32_t android._dataspace = 260
D/CCodec ( 1799): int32_t feature-secure-playback = 0
D/CCodec ( 1799): int32_t frame-rate = 24
D/CCodec ( 1799): int32_t height = 640
D/CCodec ( 1799): int32_t intra-refresh-period = 0
D/CCodec ( 1799): string mime = "video/raw"
D/CCodec ( 1799): int32_t prepend-sps-pps-to-idr-frames = 0
D/CCodec ( 1799): int32_t priority = 0
D/CCodec ( 1799): Buffer hdr-static-info = {
D/CCodec ( 1799): 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
D/CCodec ( 1799): 00000010: 00 00 00 00 00 00 00 00 00 .........
D/CCodec ( 1799): }
D/CCodec ( 1799): int64_t android._C2MemoryUsage = 0
D/CCodec ( 1799): int32_t color-format = 2130708361
D/CCodec ( 1799): }
D/GraphicBufferSource( 1799): setting dataspace: 0x104, acquired=0
D/CCodec ( 1799): ISConfig not changed
I/MediaCodec( 1799): (0xb4000070ded27cf0) start
E/MediaCodec( 1799): Codec reported err 0xfffffff4, actionCode 0, while in state 5/STARTING
D/MPEG4Writer( 1799): reset()
D/MPEG4Writer( 1799): release()
D/MPEG4Writer( 1799): ftruncate mPreAllocateFileEndOffset:0 mOffset:0 mMdatEndOffset:0 diff:0
D/MPEG4Writer( 1799): final fsync() takes 5 ms, file size 0
E/Transcoder( 1799): Fatal error while transcoding, this might be invalid format or bug in engine or Android.
E/Transcoder( 1799): android.media.MediaCodec$CodecException: start failed
E/Transcoder( 1799): at android.media.MediaCodec.native_start(Native Method)
E/Transcoder( 1799): at android.media.MediaCodec.start(MediaCodec.java:2284)
E/Transcoder( 1799): at com.otaliastudios.transcoder.transcode.BaseTrackTranscoder.onStartEncoder(BaseTrackTranscoder.java:96)
E/Transcoder( 1799): at com.otaliastudios.transcoder.transcode.VideoTrackTranscoder.onStartEncoder(VideoTrackTranscoder.java:80)
E/Transcoder( 1799): at com.otaliastudios.transcoder.transcode.BaseTrackTranscoder.setUp(BaseTrackTranscoder.java:64)
E/Transcoder( 1799): at com.otaliastudios.transcoder.engine.Engine.openCurrentStep(Engine.java:194)
E/Transcoder( 1799): at com.otaliastudios.transcoder.engine.Engine.getCurrentTrackTranscoder(Engine.java:223)
E/Transcoder( 1799): at com.otaliastudios.transcoder.engine.Engine.transcode(Engine.java:371)
E/Transcoder( 1799): at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:150)
E/Transcoder( 1799): at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:140)
E/Transcoder( 1799): at java.util.concurrent.FutureTask.run(FutureTask.java:264)
E/Transcoder( 1799): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/Transcoder( 1799): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
E/Transcoder( 1799): at java.lang.Thread.run(Thread.java:1012)
E/flutter ( 1799): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
E/flutter ( 1799): #0 _ImageTitleScreenState.compress2 (package:visi_flutter/screen/ImageTitleScreen.dart:125:36)
E/flutter ( 1799):
E/flutter ( 1799):

[✓] Flutter (Channel stable, 3.3.10, on macOS 11.6.1 20G224 darwin-x64, locale
en-GB)
• Flutter version 3.3.10 on channel stable at /Volumes/SSDDATADRIVE/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (5 weeks ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/kaif/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
• Xcode at /Volumes/data drive/Xcode.app/Contents/Developer
• Build 13A233
• CocoaPods version 1.11.3

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Connected device (3 available)
• moto g51 5G (mobile) • ZD2223CPD7 • android-arm64 • Android 12 (API 31)
• macOS (desktop) • macos • darwin-x64 • macOS 11.6.1 20G224
darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome
108.0.5359.124

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!
kaif@naveennagi-iMac ~ %

New Release Have lots isssue version light_compressor 2.1.0

Hello Developer,

I used you compressor it has lots of problem with new version.

  1. Its increase build size 50 MB once i update from older version.
  2. The progress Stream is not workikng.
  3. Also show some exo based random errors comes through this plugin as well.
  4. It force to update minium sdk to 24.But still lots of android audiance is uses 21 SDK all around world

Android : compressed videos have the images reversed

Compressed videos have images reversed, as if it was filmed, so the texts are unreadable.

After video compression, a person with a right eye will turn into a person a with left eye, as in the following pictures.

Before compression
Before compression.

After compression
After compression

Notice how text is now unreadable
Notice how text is now unreadable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.