Open jackie-maxx opened 1 year ago
I faced the same issue, this is a workaround that will not let you be blocked and use the compress functionality, I hope by the future the package maintainer will fix that
File _renameFile(File file, String newFileName) {
final path = file.path;
final lastSeparator = path.lastIndexOf(Platform.pathSeparator);
final newPath = path.substring(0, lastSeparator + 1) + newFileName;
return file.renameSync(newPath);
}
I hope this helps
//==== Error ==== // /flutter ( 9008): VideoCompress: You can try to subscribe to the I/flutter ( 9008): compressProgress$ stream to know the compressing state. D/MPEG4Writer( 9008): PreAllocation enabled E/Transcoder( 9008): Fatal error while transcoding, this might be invalid format or bug in engine or Android. E/Transcoder( 9008): java.lang.IllegalArgumentException: could not access /data/user/0/com.example.test_compress/app_flutter/Trimmer/VID_20230725_163032_446_trimmed:Aug4,2023-17:32:10.mp4 E/Transcoder( 9008): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:370) E/Transcoder( 9008): at com.otaliastudios.transcoder.source.UriDataSource.applyRetriever(UriDataSource.java:33) E/Transcoder( 9008): at com.otaliastudios.transcoder.source.DefaultDataSource.ensureMetadata(DefaultDataSource.java:41)
// ==== My code ==== // final info = await VideoCompress.compressVideo( vFile.path, quality: VideoQuality.Res1280x720Quality, deleteOrigin: false, includeAudio: true, );