syonip / flutter_fbstorage_video_upload

MIT License
34 stars 31 forks source link

Video Uploading issues #1

Open bsurji opened 4 years ago

bsurji commented 4 years ago

I tested it on an Android Simulator when downloading an MP4 video online and uploading it uploads fine but when uploading a video in the gallery recorded from the phone the video uploads but the VideoURL goes blank and outputs the following error:

I/flutter (22003): Too many packets buffered for output stream 0:1. I/flutter (22003): Conversion failed! I/flutter (22003): 'package:/models/encoder_provider.dart': Failed assertion: line 32 pos 12: 'rc == 0': is not true.

When running it on an ios simulator it does nothing after the video finishes compressing and gives me the error I posted previously:

flutter: NoSuchMethodError: The method '/' was called on null. Receiver: null Tried calling: /(null)

If you could support me in this matter I would highly appreciate it.

Kind Regards,

syonip commented 4 years ago

Hi @bsurji , Did you get this error when running the code of this repo with no modifications?

bsurji commented 4 years ago

Hey @syonip,

Yes I am receiving this error when running the code of the Gallery Branch repo with no modifications done at all.

bsurji commented 4 years ago

Hey @syonip,

I hope you are well. I managed to fix the issue, when choosing from gallery the Aspect Ratio goes Null.

Kind Regards,

syonip commented 4 years ago

That's weird, doesn't happen on my device. Maybe its a simulator issue? Glad to hear you fixed it :)

tua2542 commented 4 years ago

I have wrote the code about flutter firebase storage video upload same as with your code , and it could run normally. But if I uploaded video, the command will show like this

I/flutter (17533): NoSuchMethodError: The getter 'path' was called on null. I/flutter (17533): Receiver: null I/flutter (17533): Tried calling: path

How to solve this problem ?

syonip commented 4 years ago

@tua2542 Did you try to debug? Which object is null?

hyobbb commented 4 years ago

I/flutter (13327): Too many packets buffered for output stream 0:1. I/flutter (13327): Conversion failed! I/flutter (13327): 'package:flutter_video_sharing/apis/encoding_provider.dart': Failed assertion: line 31 pos 12: 'rc == 0': rc value is 1

I got the same issue above, it sometimes works fine but sometimes gives error like that. I don't know what exactly cause this problem.

syonip commented 4 years ago

Hi @hyobbb , According to this SO question: https://stackoverflow.com/questions/49686244/ffmpeg-too-many-packets-buffered-for-output-stream-01 It looks like an issue with ffmpeg. You can try the solution suggested there.

hyobbb commented 4 years ago

Hi @syonip Thank you. I added '-max_muxing_queue_size 1024' and seems like it works well.

but while I grab video with my AVD simulator camera module it doesn't play the video after recording and while processing video log says its duration is almost an hour although I just recorded 3sec. Maybe there's a bug in my simulator. I will let you know if I figure it out.

syonip commented 4 years ago

Yeah I've also had that happen in the emulator, if you use an actual device it shouldn't happen

dvird commented 3 years ago

@syonip somehow width and height comes on another stream on ios.

 double getAspectRatio(Map<dynamic, dynamic> info) {
    final int width = getWidth(info);
    final int height = getHeight(info);
    final double aspect = height / width;
    return aspect;
  }

  int getWidth(Map<dynamic, dynamic> info) {
    final int width = info['streams'][0]['width'] ?? info['streams'][1]['width'];
    return width;
  }

  int getHeight(Map<dynamic, dynamic> info) {
    final int height = info['streams'][0]['height'] ?? info['streams'][1]['height'];
    return height;
  }
syonip commented 3 years ago

Yeah I did notice that. In the new flutter_ffmpeg version that API is a bit more organised, you might wanna try upgrading.