Flutter - FFmpeg Kit exit with code 1 when creating video but not converting video

194 views Asked by At

I'm working on simple flutter video converting app, its returning with 'Conversion Failed'. here is my code.

Directory tempDir = await getTemporaryDirectory();
    String timestamp = DateTime.now().millisecondsSinceEpoch.toString();
    String outputPath = "${tempDir.path}/$timestamp.mp4";

    String command =
        '-i $_videoPath -vf "scale=$vidWidth:$vidHeight" -c:v libx264 -crf 23 $outputPath';

    await FFmpegKit.executeAsync(command, (session) async {
      final returnCode = await session.getReturnCode();
      print('................... $returnCode');
      if (returnCode == 1) {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text('Video Saved')));
        await GallerySaver.saveVideo(outputPath);
      } else {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text('Conversion Failed')));
      }
    });

I use flutter_ffmpeg which was working fine. but its not working with FFmpegKit,

0

There are 0 answers