'How to compress the video from 1 second
Hello im really stuck at the problem. The problem that I have is that my video has a black Fram at the begging . I know exactly how long the black frame is showing . Its exactly milliseconds: 24 . Now I wanna compress the video to cut the first 24 milliseconds off . But the problem is that the plugin im using .
https://pub.dev/packages/video_compress has a variable called int: starttime. So I think this is the start time. But how can I now add as star time from 24 milliseconds? This is how the code for it looks like
compressvideo() async {
try {
if (widget.imageSource == ImageSource.gallery) {
print("waööa ich bin eine hureee !!!!!!!");
final compressedvideo =
await VideoCompress.compressVideo(widget.videopathasstring,
quality: VideoQuality.DefaultQuality, //
startTime: 999999999999999999);
return File(compressedvideo.path);
} else {
final compressedvideo = await VideoCompress.compressVideo(
widget.videopathasstring,
quality: VideoQuality.DefaultQuality, //
);
return File(compressedvideo.path);
}
} catch (e) {
Navigator.pop(context);
}
}
I tried several solution nothing worked. Please help !!!!
The black frame comes from using the trimmer package https://pub.dev/packages/video_trimmer/changelog
I don't know why but when I use exactly like in the example it always making the first frame of video Black
double _startValue = 0.0;
double _endValue = 0.0;
await _trimmer.saveTrimmedVideo(
startValue: _startValue,
endValue: _endValue,
onSave: (String outputPath) {
File file = new File(outputPath);
Navigator.pop(context);
Navigator.push(
context,
PageRouteBuilder(
transitionDuration:
Duration(milliseconds: 250),
transitionsBuilder: (BuildContext
context,
Animation<double> animation,
Animation<double> setAnimation,
Widget child) {
return ScaleTransition(
scale: animation,
child: child,
alignment: Alignment.center,
);
},
pageBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> setAnimation) {
return CreateVideo2(
videofile: file,
videopathasstring: outputPath,
imageSource: widget.imageSource,
);
}));
});
I tried also to increase the double _startValue . But the problem happens only after trimming the video .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
