tanersener / flutter-ffmpeg

FFmpeg plugin for Flutter. Not maintained anymore. Superseded by FFmpegKit.
GNU Lesser General Public License v3.0
645 stars 132 forks source link

Video compress produces black screen, no video, but keeps audio #308

Closed danielgchap closed 3 years ago

danielgchap commented 3 years ago

Description Using ffmpeg I am able to upload a compressed video to firebase storage. However, the video is just a black screen but the audio is successfully there.

Here is my code: static compressvideo(File video, BuildContext context) async { final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg(); Directory appDocumentDir = await getApplicationDocumentsDirectory(); String rawDocumentPath = appDocumentDir.path; await _flutterFFmpeg .execute('-i "${video.path}" -y -c:v mpeg4 $rawDocumentPath/output.mp4') .then((rc) => print("FFmpeg process exited with rc $rc")); File videoFile = new File("$rawDocumentPath/output.mp4"); return videoFile; }

Expected behavior Compressed video with integrity of visual/audio elements left intact.

Current behavior Black screen for length of video, audio is audible.

Screenshots Here is a screenshot from my firebase storage of the video.

Screen Shot 2021-05-24 at 11 18 42 AM

Logs Post logs here or paste them to Ghostbin and insert the link here. I/mobile-ffmpeg(29950): ffmpeg version v4.4-dev-416 I/mobile-ffmpeg(29950): Copyright (c) 2000-2020 the FFmpeg developers I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn) I/mobile-ffmpeg(29950): configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android24-clang --cxx=aarch64-linux-android24-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat' --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --enable-iconv --disable-sdl2 --enable-zlib --enable-mediacodec I/mobile-ffmpeg(29950): libavutil 56. 55.100 / 56. 55.100 I/mobile-ffmpeg(29950): libavcodec 58. 96.100 / 58. 96.100 I/mobile-ffmpeg(29950): libavformat 58. 48.100 / 58. 48.100 I/mobile-ffmpeg(29950): libavdevice 58. 11.101 / 58. 11.101 I/mobile-ffmpeg(29950): libavfilter 7. 87.100 / 7. 87.100 I/mobile-ffmpeg(29950): libswscale 5. 8.100 / 5. 8.100 I/mobile-ffmpeg(29950): libswresample 3. 8.100 / 3. 8.100 I/mobile-ffmpeg(29950): Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Android/data/xxxxxxxxxxxxx/files/video_compress/VID_2021-05-24 11-16-36.mp4': I/mobile-ffmpeg(29950): Metadata: I/mobile-ffmpeg(29950): major_brand : I/mobile-ffmpeg(29950): mp42 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): minor_version : I/mobile-ffmpeg(29950): 0 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): compatible_brands: I/mobile-ffmpeg(29950): isommp42 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): creation_time : I/mobile-ffmpeg(29950): 2021-05-24T15:16:41.000000Z I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): location : I/mobile-ffmpeg(29950): +27.8752-082.6433/ I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): location-eng : I/mobile-ffmpeg(29950): +27.8752-082.6433/ I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): com.android.version: I/mobile-ffmpeg(29950): 10 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Duration: I/mobile-ffmpeg(29950): 00:00:12.12 I/mobile-ffmpeg(29950): , start: I/mobile-ffmpeg(29950): 0.000000 I/mobile-ffmpeg(29950): , bitrate: I/mobile-ffmpeg(29950): 3164 kb/s I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Stream #0:0 I/mobile-ffmpeg(29950): (eng) I/mobile-ffmpeg(29950): : Video: h264 (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 640x1136, 3063 kb/s I/mobile-ffmpeg(29950): , SAR 1:1 DAR 40:71 I/mobile-ffmpeg(29950): , I/mobile-ffmpeg(29950): 30.03 fps, I/mobile-ffmpeg(29950): 30 tbr, I/mobile-ffmpeg(29950): 90k tbn, I/mobile-ffmpeg(29950): 180k tbc I/mobile-ffmpeg(29950): (default) I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Metadata: I/mobile-ffmpeg(29950): creation_time : I/mobile-ffmpeg(29950): 2021-05-24T15:16:41.000000Z I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): handler_name : I/mobile-ffmpeg(29950): VideoHandle I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Stream #0:1 I/mobile-ffmpeg(29950): (eng) I/mobile-ffmpeg(29950): : Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s I/mobile-ffmpeg(29950): (default) I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Metadata: I/mobile-ffmpeg(29950): creation_time : I/mobile-ffmpeg(29950): 2021-05-24T15:16:41.000000Z I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): handler_name : I/mobile-ffmpeg(29950): SoundHandle I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Stream mapping: I/mobile-ffmpeg(29950): Stream #0:0 -> #0:0 I/mobile-ffmpeg(29950): (h264 (native) -> mpeg4 (native)) I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Stream #0:1 -> #0:1 I/mobile-ffmpeg(29950): (aac (native) -> aac (native)) I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Press [q] to stop, [?] for help W/mobile-ffmpeg(29950): [graph 0 input from stream 0:0 @ 0x7105c3d040] sws_param option is deprecated and ignored I/mobile-ffmpeg(29950): Output #0, mp4, to '/data/user/0/xxxxxxxxxxxx/app_flutter/output.mp4': I/mobile-ffmpeg(29950): Metadata: I/mobile-ffmpeg(29950): major_brand : I/mobile-ffmpeg(29950): mp42 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): minor_version : I/mobile-ffmpeg(29950): 0 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): compatible_brands: I/mobile-ffmpeg(29950): isommp42 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): com.android.version: I/mobile-ffmpeg(29950): 10 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): location : I/mobile-ffmpeg(29950): +27.8752-082.6433/ I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): location-eng : I/mobile-ffmpeg(29950): +27.8752-082.6433/ I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): encoder : I/mobile-ffmpeg(29950): Lavf58.48.100 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Stream #0:0 I/mobile-ffmpeg(29950): (eng) I/mobile-ffmpeg(29950): : Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x1136 [SAR 1:1 DAR 40:71], q=2-31, 200 kb/s I/mobile-ffmpeg(29950): , I/mobile-ffmpeg(29950): 30 fps, I/mobile-ffmpeg(29950): 15360 tbn, I/mobile-ffmpeg(29950): 30 tbc I/mobile-ffmpeg(29950): (default) I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Metadata: I/mobile-ffmpeg(29950): creation_time : I/mobile-ffmpeg(29950): 2021-05-24T15:16:41.000000Z I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): handler_name : I/mobile-ffmpeg(29950): VideoHandle I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): encoder : I/mobile-ffmpeg(29950): Lavc58.96.100 mpeg4 I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Side data: I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): cpb: I/mobile-ffmpeg(29950): bitrate max/min/avg: 0/0/200000 buffer size: 0 I/mobile-ffmpeg(29950): vbv_delay: N/A I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Stream #0:1 I/mobile-ffmpeg(29950): (eng) I/mobile-ffmpeg(29950): : Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s I/mobile-ffmpeg(29950): (default) I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): Metadata: I/mobile-ffmpeg(29950): creation_time : I/mobile-ffmpeg(29950): 2021-05-24T15:16:41.000000Z I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): handler_name : I/mobile-ffmpeg(29950): SoundHandle I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): encoder : I/mobile-ffmpeg(29950): Lavc58.96.100 aac I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): frame= 38 fps=0.0 q=31.0 size= 256kB time=00:00:02.04 bitrate=1026.0kbits/s speed=4.06x I/mobile-ffmpeg(29950): frame= 87 fps= 86 q=31.0 size= 256kB time=00:00:03.06 bitrate= 683.6kbits/s speed=3.04x I/mobile-ffmpeg(29950): frame= 131 fps= 87 q=31.0 size= 256kB time=00:00:05.05 bitrate= 415.2kbits/s speed=3.35x I/mobile-ffmpeg(29950): frame= 183 fps= 91 q=31.0 size= 512kB time=00:00:07.05 bitrate= 594.3kbits/s speed= 3.5x I/mobile-ffmpeg(29950): frame= 234 fps= 93 q=31.0 size= 512kB time=00:00:08.06 bitrate= 520.4kbits/s speed= 3.2x I/mobile-ffmpeg(29950): frame= 283 fps= 93 q=31.0 size= 768kB time=00:00:10.06 bitrate= 625.1kbits/s speed=3.32x I/mobile-ffmpeg(29950): frame= 335 fps= 95 q=31.0 size= 768kB time=00:00:11.13 bitrate= 565.1kbits/s speed=3.15x I/mobile-ffmpeg(29950): frame= 364 fps= 96 q=31.0 Lsize= 1051kB time=00:00:12.10 bitrate= 711.2kbits/s speed=3.18x I/mobile-ffmpeg(29950): video:934kB audio:105kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: I/mobile-ffmpeg(29950): 1.127637% I/mobile-ffmpeg(29950): I/mobile-ffmpeg(29950): [aac @ 0x708591db00] Qavg: 416.785 D/flutter-ffmpeg(29950): FFmpeg exited with rc: 0 I/flutter (29950): FFmpeg process exited with rc 0

Environment `[✓] Flutter (Channel stable, 2.2.0, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-US) • Flutter version 2.2.0 at /Users/danielchapman/Dev/flutter • Framework revision b22742018b (10 days ago), 2021-05-14 19:12:57 -0700 • Engine revision a9d88a4d18 • Dart version 2.13.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/danielchapman/Library/Android/sdk • Platform android-30, build-tools 30.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.2, Build version 12B45b • CocoaPods version 1.10.0

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.56.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.22.0

[✓] Connected device (2 available) • Pixel 2 (mobile) • FA7AK1A00856 • android-arm64 • Android 10 (API 29) • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212

• No issues found!`

Other

Thank you so much for your help!

danielgchap commented 3 years ago

I'm sure this is from my own ignorance but if anyone has any thoughts, I'd appreciate it!

jonasN5 commented 3 years ago

https://github.com/flutter/plugins/pull/1307

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.