Home > Software engineering >  How to save a _flutterFFmpeg gif in firebase storage?
How to save a _flutterFFmpeg gif in firebase storage?

Time:12-09

Edit: After some changes with help from @Frank van Puffelen I getting a new error see below updated code and updated error

Hello everyone im trying to save a gif which I create with flutter_ffmpeg: ^0.4.2 With this code im trying to create a gif of picked video from user which is currently widget.videopathasstring THis is the path of picked video.

 Directory gifDirectory;
  String gifOutputFile;
  getpreviewvideo() async {
    String currentvideo = widget.videopathasstring;
    await getApplicationDocumentsDirectory().then((directory) {
      print("13");
      gifDirectory = Directory(directory.path   '/gif');
      print("14");
      gifDirectory.exists().then((exists) async {
        print("0");
        if (!exists) {
          print("1");
          await gifDirectory.create();
        }
      }).then((value) => {
            print("3"),
            gifOutputFile = gifDirectory.path  
                '/'  
                DateTime.now().millisecondsSinceEpoch.toString()  
                '.gif',
          });
    });
    print("4");
    var arguments = [
      '-i',
      currentvideo,
      '-t',
      '2.5',
      '-ss',
      '2.0',
      '-f',
      'gif',
      gifOutputFile,
    ];
    _flutterFFmpeg.executeWithArguments(arguments).then((rc) {
      print("FFmpeg process exited with rc $rc");
    });

    return File(gifOutputFile);
  }

The problem is im getting this error

GTMSessionFetcher invoking fetch callbacks, data {length = 0, bytes = 0x}, error (null)
2
GTMSessionFetcher invoking fetch callbacks, data {length = 613, bytes = 0x7b0a2020 226e616d 65223a20 22616c6c ... 36316263 34220a7d }, error (null)
flutter: 13
flutter: 14
flutter: 4
flutter: Invalid argument(s) (path): Must not be null
flutter: 0
-[NSNull length]: unrecognized selector sent to instance 0x1dc5f0558
flutter: 3
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x1dc5f0558'
*** First throw call stack:
(0x181e8904c 0x19a4fdf54 0x181f66014 0x181e1e474 0x181e1d5b0 0x181e15410 0x181e0d0a0 0x100e3c4b8 0x100e3b324 0x100e3bb24 0x10065528c 0x181af9914 0x181afb660 0x181afe788 0x181b0cdd0 0x181b0d5f8 0x1f212a0b8 0x1f2129e94)
libc  abi: terminating with uncaught exception of type NSException
* thread #65, queue = 'com.apple.root.default-qos', stop reason = signal SIGABRT
    frame #0: 0x00000001b8cd0964 libsystem_kernel.dylib`__pthread_kill   8
libsystem_kernel.dylib`__pthread_kill:
->  0x1b8cd0964 < 8>:  b.lo   0x1b8cd0984               ; < 40>
    0x1b8cd0968 < 12>: pacibsp
    0x1b8cd096c < 16>: stp    x29, x30, [sp, #-0x10]!
    0x1b8cd0970 < 20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Exited (sigterm)

Hope anyone can help

CodePudding user response:

It seems you're not uploading the file to Cloud Storage, which only happens once you call putFile.

Have a look at the FlutterFire documentation on uploading files for an example of how to use putFile

  • Related