-
-
Notifications
You must be signed in to change notification settings - Fork 132
Execution time difference between Flutter_FFMPEG(mobile-ffmpeg) and flutter_video_compress(ffmpeg-android) #178
Comments
Would you mind adding the console outputs of these two executions? |
Thanks for quick reply. By console output, do you mean ffmpeg logs or the output showing the initial file size, output file size and time taken? |
I mean |
Hi, attaching the log for Flutter FFMPEG and when I remove the scale from the command, the fps jump from 6-7 to 21-22. But can't produce the log for that as it's calling ffmpeg-android and there is no log function as such in the library. [log] ffmpeg version git-2020-01-25-fd11dd500 [log] built with Android (5220042 based on r346389c) clang version 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf643d27dbca1bb228957008617) (https://android.googlesource.com/toolchain/llvm 3c393fe7a7e13b0fba4ac75a01aa683d7a5b11cd) (based on LLVM 8.0.7svn) [log] configuration: --cross-prefix=arm-linux-androideabi- --sysroot=/files/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=armv7-a --cpu=armv7-a --cc=armv7a-linux-androideabi16-clang --cxx=armv7a-linux-androideabi16-clang++ --target-os=android --disable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --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 - [log] libavcodec 58. 65.102 / 58. 65.102 [log] libavformat 58. 35.101 / 58. 35.101 [log] libavdevice 58. 9.103 / 58. 9.103 [log] libavfilter 7. 70.101 / 7. 70.101 [log] libswscale 5. 6.100 / 5. 6.100 [log] libswresample 3. 6.100 / 3. 6.100 [log] Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/data/user/0/com.mandir.devdarshan/cache/6a3a9e50-da40-44d8-aaba-69eb8e099dee.mp4': [log] Metadata: [log] major_brand : [log] minor_version : [log] compatible_brands: [log] creation_time : [log] com.android.version: [log] Duration: [log] Stream #0:0 [log] Metadata: [log] rotate : [log] creation_time : [log] handler_name : [log] Side data: [log] [log] Stream #0:1 [log] Metadata: [log] creation_time : [log] handler_name : [log] Stream mapping: [log] Stream #0:0 -> #0:0 [log] Stream #0:1 -> #0:1 [log] Press [q] to stop, [?] for help [log] frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A [log] [libx264 @ 0xbf065000] using SAR=1/1 [log] [libx264 @ 0xbf065000] using cpu capabilities: ARMv6 NEON [log] [libx264 @ 0xbf065000] profile Constrained Baseline, level 3.1, 4:2:0, 8-bit [log] [libx264 @ 0xbf065000] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=24.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 [log] Output #0, mp4, to '/data/user/0/com.mandir.devdarshan/cache/6a3a9e50-da40-44d8-aaba-69eb8e099dee_compressed.mp4': [log] Metadata: [log] major_brand : [log] minor_version : [log] compatible_brands: [log] com.android.version: [log] encoder : [log] Stream #0:0 [log] Metadata: [log] encoder : [log] creation_time : [log] handler_name : [log] Side data: [log] [log] [log] Stream #0:1 [log] Metadata: [log] creation_time : [log] handler_name : [log] encoder : [log] frame= 2 fps=0.0 q=0.0 size= 0kB time=00:00:01.00 bitrate= 0.4kbits/s speed=1.81x [log] video:26810kB audio:1893kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: [log] [libx264 @ 0xbf065000] frame I:15 Avg QP:20.07 size: 29459 [log] [libx264 @ 0xbf065000] frame P:3598 Avg QP:23.01 size: 7507 [log] [libx264 @ 0xbf065000] mb I I16..4: 100.0% 0.0% 0.0% [log] [libx264 @ 0xbf065000] mb P I16..4: 16.6% 0.0% 0.0% P16..4: 25.6% 0.0% 0.0% 0.0% 0.0% skip:57.7% [log] [libx264 @ 0xbf065000] coded y,uvDC,uvAC intra: 22.2% 31.3% 2.2% inter: 9.7% 11.7% 0.0% [log] [libx264 @ 0xbf065000] i16 v,h,dc,p: 60% 13% 11% 16% [log] [libx264 @ 0xbf065000] i8c dc,h,v,p: 41% 14% 39% 6% [log] [libx264 @ 0xbf065000] kb/s:1823.58 [log] [aac @ 0xc1f36000] Qavg: 207.499 [log] |
Thanks for sharing the logs for
There are a lot of variables that define the output, encoding speed and quality. It is crucial to see what ffmpeg is doing in order to understand the time/quality/output difference between these two executions. So, if you don't have the output for |
Yeah, I understand that it is important for you to analyze what both ffmpeg are doing while execution. Will update here once I get the results for ffprobe. Meanwhile, it would be great if you can also try using both packages on android version <10 as flutter video compress will not work on android 10 to see the substantial time difference for execution of the compression command including scale. |
Ok. These are the logs using the FFProbe getMediaInformation function in flutter_ffmpeg library. Let me know if these are enough otherwise I can also run FFProbe specific command for more information. 1. Input File Metadata: 2. Compressed file using flutter_video_compress command "-i input -vcodec h264 -crf 24 -vf scale=720:-2 -preset:v ultrafast output" Metadata: 3. Compressed file using flutter_ffmpeg command "-i input -vcodec h264 -crf 24 -vf scale=720:-2 -preset:v ultrafast output" Metadata: |
Thanks, output files look almost the same. I don't see which |
Found these line in logcat once the ffmpeg command execution begins. Loaded mobile-ffmpeg-min-gpl-arm-v7a-neon-4.3.1-lts-20200125. |
You are running a NEON enabled armv7a ABI on that device, which is not right. This should have been Do you have an ABI splitting strategy in your application's |
This is the phone I am using right now for testing. The earlier information of cpu architecture was given by using system info library in flutter and not seeing in the phone model or in phone info section; so maybe that was wrong. and this is the splits I am using in build.gradle . The problem with v 8a split is that it's throwing this error:adb: failed to install app-arm64-v8a-debug.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113] splits {
|
I assume your device does not support arm64-v8a ABI. I don't have an official page that confirms this but all the pages I have found shows that only So, I think this problem is a performance issue for Also, took a look at Can you replace the version coming with |
Hi, implementation fileTree(include: '*.aar', dir: 'libs') You can check out the forked project here: I have never coded in android before and have coded in flutter, so maybe my approach for adding this library is wrong. When I am importing this forked repo in pubspec.yaml and building the flutter project, I am receiving these errors. I can comment these lines in the forked repo (if these lines are not critical for ffmpeg execute command) but I think there is something amiss in the mobile-ffmpeg-min-gpl-4.4.LTS-dev library. Maybe I am wrong, let me know the correct approach for adding this library in flutter_ffmpeg. G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
|
My fault, sorry for that. There are some API changes in the new |
Hi, |
Well, I'm out of ideas. |
Ah ok. Maybe this one is also related to the same issue. If I use flutter video compress then the release apk size for both v7a and v8a increases by 5-6 MB but if I use min-gpl-lts version for flutter ffmpeg, then the release apk size for v7a and v8a increases by 10-11 MB and 5-6 MB respectively. So, why not try compiling the ffmpeg .so files the same way as its done in ffmpeg android for v7a only. Because that will solve the issue with v7a and make the library more robust and efficient for future use. I know that ffmpeg android has its own limitations such as there is no 64 bit .so files for ffmpeg and that also need to be forked for running on android 10. |
I've already applied most of those changes for By the way, did you try using the Main version not the LTS version in your app? |
Hi, |
Did you try using |
Nope not till now but min sdk version for app is 20; for full-gpl, I think apk requires min sdk version of 24. But I can check if you want me to check for further verification. |
I fixed a similar issue on the parent project, tanersener/mobile-ffmpeg/issues/511. It was only effecting LTS versions. That's why I asked. I'd be great if you can test and see if |
Hi, Update: I tried using latest 4.4 LTS version of mobile-ffmpeg that you committed 2 days ago in forked flutter ffmpeg and now the compression takes place in less than 3 minutes as compared to 9 minutes taken by earlier version. As you can see in the screenshot below, the size for release apk using min-gpl-lts version for flutter ffmpeg is 20MB and 28MB for v8a and v7a respectively, the size for release apk using flutter video compress is close to 21MB-22MB range for both v7a and v8a. |
Thanks for performing those tests. There will be a new At this point, I'm happy about the size of |
Hi, |
To remove
To remove
To remove
|
Thanks :) |
|
Ok, I have released the latest version of app by forking flutter ffmpeg and replacing the version with 4.4 on my own. Will update to new version of flutter ffmpeg in next 2 weeks or whenever it is out :) |
Released in |
Thanks, will release new version using this packages in a short time :) |
Hi,
Thanks for Flutter FFMPEG and its underlying library mobile-ffmpeg in android. I was earlier using flutter_video_compress which uses FFMPEG-android but the problem with that library is that's dead, don't support android 10 due to behavior change in android 10 and doesn't have 64 bit binaries for FFMPEG.
I tried running same FFMPEG command for compression in both libraries flutter_video_compress and Flutter_FFMPEG which is as follows:
"-i $newPath -vcodec h264 -crf 24 -vf scale=720:-2 -preset:v ultrafast $newPathCompressed"
The same command takes 8-9 minute to compress 260MB video to 30MB in Flutter_FFMPEG package but takes 2-3 minutes to compress the same video to roughly 30MB in flutter_video_compress package. The limiting factor is scale, so if I add scale for video compression in ffmpeg command using Flutter_FFMPEG package then time increases substantially from 2-3 minutes to 8-9 minutes but doesn't increase in flutter_video_compress.
I want to use flutter_ffmpeg package as the flutter_video_compress is dead and not maintained but the only thing stopping me right now is the substantial time difference for execution of FFMPEG commands in both packages.
It would be great if you can comment on the reason for substantial time difference for FFMPEG command execution in both packages as it's beyond my understanding. According to my understanding, Flutter_FFMPEG and mobile-ffmpeg would be using latest versions of FFMPEG as compared to that used by flutter_video_compress and ffmpeg-android.
The text was updated successfully, but these errors were encountered: