Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Execution time difference between Flutter_FFMPEG(mobile-ffmpeg) and flutter_video_compress(ffmpeg-android) #178

Closed
pranavkpr1 opened this issue Jul 29, 2020 · 31 comments
Assignees
Labels
enhancement New feature or request fixed

Comments

@pranavkpr1
Copy link

pranavkpr1 commented Jul 29, 2020

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.

@tanersener
Copy link
Owner

Would you mind adding the console outputs of these two executions?

@pranavkpr1
Copy link
Author

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?

@tanersener
Copy link
Owner

I mean ffmpeg output, it want to see what ffmpeg is doing.

@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 29, 2020

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.
And modified the flutter_video_compress as in the following link after forking the project for running the same command. Execution for same command take 3X less time in flutter video compress as compared to flutter ffmpeg.

https://github.com/pranavkpr1/flutter_video_compress/blob/master/android/src/main/kotlin/com/example/flutter_video_compress/FFmpegCommander.kt

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] Copyright (c) 2000-2020 the FFmpeg developers
[log]

[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] libavutil 56. 38.100 / 56. 38.100

[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] mp42
[log]

[log] minor_version :
[log] 0
[log]

[log] compatible_brands:
[log] isommp42
[log]

[log] creation_time :
[log] 2020-07-25T20:56:20.000000Z
[log]

[log] com.android.version:
[log] 7.0
[log]

[log] Duration:
[log] 00:02:00.42
[log] , start:
[log] 0.000000
[log] , bitrate:
[log] 17262 kb/s
[log]

[log] Stream #0:0
[log] (eng)
[log] : Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17002 kb/s
[log] , SAR 1:1 DAR 16:9
[log] ,
[log] 30 fps,
[log] 30 tbr,
[log] 90k tbn,
[log] 180k tbc
[log] (default)
[log]

[log] Metadata:

[log] rotate :
[log] 90
[log]

[log] creation_time :
[log] 2020-07-25T20:56:20.000000Z
[log]

[log] handler_name :
[log] VideoHandle
[log]

[log] Side data:

[log]
[log] displaymatrix: rotation of -90.00 degrees
[log]

[log] Stream #0:1
[log] (eng)
[log] : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
[log] (default)
[log]

[log] Metadata:

[log] creation_time :
[log] 2020-07-25T20:56:20.000000Z
[log]

[log] handler_name :
[log] SoundHandle
[log]

[log] Stream mapping:

[log] Stream #0:0 -> #0:0
[log] (h264 (native) -> h264 (libx264))
[log]

[log] Stream #0:1 -> #0:1
[log] (aac (native) -> aac (native))
[log]

[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] [graph 0 input from stream 0:0 @ 0xc1f5fe20] sws_param option is deprecated and ignored

[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] mp42
[log]

[log] minor_version :
[log] 0
[log]

[log] compatible_brands:
[log] isommp42
[log]

[log] com.android.version:
[log] 7.0
[log]

[log] encoder :
[log] Lavf58.35.101
[log]

[log] Stream #0:0
[log] (eng)
[log] : Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], q=-1--1
[log] ,
[log] 30 fps,
[log] 15360 tbn,
[log] 30 tbc
[log] (default)
[log]

[log] Metadata:

[log] encoder :
[log] Lavc58.65.102 libx264
[log]

[log] creation_time :
[log] 2020-07-25T20:56:20.000000Z
[log]

[log] handler_name :
[log] VideoHandle
[log]

[log] Side data:

[log]
[log] cpb:
[log] bitrate max/min/avg: 0/0/0 buffer size: 0
[log] vbv_delay: N/A
[log]

[log]
[log] displaymatrix: rotation of -0.00 degrees
[log]

[log] Stream #0:1
[log] (eng)
[log] : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
[log] (default)
[log]

[log] Metadata:

[log] creation_time :
[log] 2020-07-25T20:56:20.000000Z
[log]

[log] handler_name :
[log] SoundHandle
[log]

[log] encoder :
[log] Lavc58.65.102 aac
[log]

[log] frame= 2 fps=0.0 q=0.0 size= 0kB time=00:00:01.00 bitrate= 0.4kbits/s speed=1.81x
[log] frame= 6 fps=5.1 q=0.0 size= 0kB time=00:00:01.00 bitrate= 0.4kbits/s speed=0.856x
[log] frame= 10 fps=5.7 q=0.0 size= 0kB time=00:00:01.00 bitrate= 0.4kbits/s speed=0.572x
[log] frame= 14 fps=6.0 q=23.0 size= 0kB time=00:00:01.00 bitrate= 0.4kbits/s speed=0.427x
...
[log] frame= 3604 fps=6.1 q=23.0 size= 28416kB time=00:02:00.36 bitrate=1934.0kbits/s speed=0.204x
[log] frame= 3608 fps=6.1 q=23.0 size= 28416kB time=00:02:00.36 bitrate=1934.0kbits/s speed=0.204x
[log] frame= 3612 fps=6.1 q=23.0 size= 28416kB time=00:02:00.36 bitrate=1934.0kbits/s speed=0.204x
[log]
[log] frame= 3613 fps=6.1 q=-1.0 Lsize= 28806kB time=00:02:00.40 bitrate=1959.8kbits/s speed=0.203x

[log] video:26810kB audio:1893kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
[log] 0.358180%
[log]

[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]

@tanersener
Copy link
Owner

Thanks for sharing the logs for flutter_ffmpeg. There are a few things that I don't see in your posts:

  • What is the duration difference when scale is not used? Your first post says that it is 2-3 min. Can you be more specific?
  • What is the device architecture in these tests? Are you running these commands on the same device using the same input file?
  • What is the version of flutter_ffmpeg? Also flutter_ffmpeg package name?

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 ffmpeg-android, can you at least share the ffprobe console outputs for input and output files?

@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 30, 2020

  1. When I remove the scale from ffmpeg command for flutter_ffmpeg, the same video is reduced from 260MB to 66MB in roughly 3 minutes (180 seconds). Using scale in ffmpeg command for flutter_ffmpeg, the same video is reduced from 260MB to 30MB in roughly 9 minutes(540 seconds). But for flutter_video_compress, using scale in the ffmpeg command doesn't matter at all in terms of duration as the compression using scale approx. takes 3 minutes(180 seconds) to reduce it to 30MB
  2. Yes, running with the same input file on the same device for both flutter_ffmpeg and flutter_video_compress. The device kernel architecture is armv8l, processor architecture is AARCH64 with 4 cores.
  3. Using the latest version of flutter_ffmpeg 0.2.10 min-gpl-lts

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.

@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 30, 2020

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:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2020-07-25T20:56:20.000000Z
com.android.version: 7.0
Duration: 00:02:00.42, start: 0.000000, bitrate: 17262 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17002 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2020-07-25T20:56:20.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2020-07-25T20:56:20.000000Z
handler_name : SoundHandle
, startTime: 0, bitrate: 17262, metadata: {com.android.version: 7.0, major_brand: mp42, compatible_brands: isommp42, creation_time: 2020-07-25T20:56:20.000000Z, minor_version: 0}, duration: 120420, format: mov,mp4,m4a,3gp,3g2,mj2, streams: [{codec: h264, height: 1080, codecTimeBase: 180k, bitrate: 17002, fullCodec: h264 (avc1 / 0x31637661), format: yuv420p, averageFrameRate: 30, sidedata: {displaymatrix: rotation of -90.00 degrees}, fullFormat: yuv420p(tv, bt709), width: 1920, index: 0, timeBase: 90k, metadata: {rotate: 90, creation_time: 2020-07-25T20:56:20.000000Z, handler_name: VideoHandle}, type: video, realFrameRate: 30}, {sampleRate: 48000, codec: aac, sampleFormat: fltp, channelLayout: stereo, index: 1, bitrate: 256, fullCodec: aac (mp4a / 0x6134706d), metadata: {creation_time: 2020-07-25T20:56:20.000000Z, handler_name: SoundHandle}, type: audio}]}

2. Compressed file using flutter_video_compress command "-i input -vcodec h264 -crf 24 -vf scale=720:-2 -preset:v ultrafast output"

Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.12.100
Duration: 00:02:00.43, start: 0.000000, bitrate: 1956 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], 1820 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
, startTime: 0, bitrate: 1956, metadata: {encoder: Lavf58.12.100, major_brand: isom, compatible_brands: isomiso2avc1mp41, minor_version: 512}, duration: 120430, format: mov,mp4,m4a,3gp,3g2,mj2, streams: [{codec: h264, sampleAspectRatio: 1:1, height: 1280, codecTimeBase: 60, bitrate: 1820, fullCodec: h264 (avc1 / 0x31637661), format: yuv420p, averageFrameRate: 30, displayAspectRatio: 9:16, fullFormat: yuv420p, width: 720, index: 0, timeBase: 15360, metadata: {handler_name: VideoHandler}, realFrameRate: 30, type: video}, {sampleRate: 48000, codec: aac, sampleFormat: fltp, channelLayout: stereo, index: 1, bitrate: 128, fullCodec: aac (mp4a / 0x6134706d), metadata: {handler_name: SoundHandler}, type: audio}]}

3. Compressed file using flutter_ffmpeg command "-i input -vcodec h264 -crf 24 -vf scale=720:-2 -preset:v ultrafast output"

Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.35.101
Duration: 00:02:00.43, start: 0.000000, bitrate: 1959 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], 1823 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandle
, startTime: 0, bitrate: 1959, metadata: {encoder: Lavf58.35.101, major_brand: isom, compatible_brands: isomiso2avc1mp41, minor_version: 512}, duration: 120430, format: mov,mp4,m4a,3gp,3g2,mj2, streams: [{codec: h264, sampleAspectRatio: 1:1, height: 1280, codecTimeBase: 60, bitrate: 1823, fullCodec: h264 (avc1 / 0x31637661), format: yuv420p, averageFrameRate: 30, displayAspectRatio: 9:16, fullFormat: yuv420p, width: 720, index: 0, timeBase: 15360, metadata: {handler_name: VideoHandle}, realFrameRate: 30, type: video}, {sampleRate: 48000, codec: aac, sampleFormat: fltp, channelLayout: stereo, index: 1, bitrate: 128, fullCodec: aac (mp4a / 0x6134706d), metadata: {handler_name: SoundHandle}, type: audio}]}

@tanersener
Copy link
Owner

Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], 1820 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], 1823 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)

Thanks, output files look almost the same.

I don't see which mobile-ffmpeg ABI is loaded in your logs. When application starts there should be a log line printed to logcat about mobile-ffmpeg ABI. It shows the package name, the build date and the architecture. Can you check your logs and find that line for me?

@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 30, 2020

Found these line in logcat once the ffmpeg command execution begins.

Loaded mobile-ffmpeg-min-gpl-arm-v7a-neon-4.3.1-lts-20200125.
Callback thread started.
Loaded flutter-ffmpeg-android-arm-v7a-neon.
Running FFmpeg with arguments: [-i, input file, -vcodec, h264, -crf, 24, -vf, scale=720:-2, -preset:v, ultrafast, output file].

@tanersener
Copy link
Owner

tanersener commented Jul 30, 2020

You are running a NEON enabled armv7a ABI on that device, which is not right. This should have been mobile-ffmpeg-min-gpl-arm64-v8a. This is an arm64 device right?

Do you have an ABI splitting strategy in your application's build.gradle ?

@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 30, 2020

This is the phone I am using right now for testing.
https://en.wikipedia.org/wiki/Samsung_Galaxy_A5_(2016)

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]
on this 8a processor but v7a installs successfully. And running gradlew installDebug command automatically installs the v7a on this device and not the v8a one.
I also tried with universal apk and in logcat, its coming the same when starting the ffmpeg.
mobile-ffmpeg-min-gpl-arm-v7a-neon-4.3.1-lts-20200125

splits {

        // Configures multiple APKs based on ABI.
        abi {

            // Enables building multiple APKs per ABI.
            enable true

            // By default all ABIs are included, so use reset() and include to specify that we only
            // want APKs for x86 and x86_64.

            // Resets the list of ABIs that Gradle should create APKs for to none.
            reset()

            // Specifies a list of ABIs that Gradle should create APKs for.
            include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"

            // Specifies that we do not want to also generate a universal APK that includes all ABIs.
            universalApk false
        }
    }

@tanersener
Copy link
Owner

tanersener commented Jul 31, 2020

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 armeabi-v7a and armeabi are supported on your device, see this.

So, I think this problem is a performance issue for arm-v7a-neon architecture rather something about arm64-v8a.

Also, took a look at ffmpeg-android project to see how they're building ffmpeg. Noticed that they're targeting a different CPU in their builds. I guess this is making the difference. mobile-ffmpeg is using more generic build options for arm-v7a-neon. I can't simple use their CPU variant in our builds but I did update the CPU targets for arm-v7a-neon and created a test build.

Can you replace the version coming with flutter_ffmpeg with this mobile-ffmpeg-min-gpl-4.4.LTS-dev file in your application and test it with the same file and command. It is the min-gpl LTS build from the development branch?

@tanersener tanersener added enhancement New feature or request and removed needs-analysis labels Jul 31, 2020
@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 31, 2020

Hi,
I tried adding the mobile-ffmpeg-min-gpl-4.4.LTS-dev library by forking the flutter ffmpeg, adding the library and modifying the build.gradle file by adding this line.

implementation fileTree(include: '*.aar', dir: 'libs')

You can check out the forked project here:
https://github.com/pranavkpr1/flutter-ffmpeg-master

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
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:322: error: cannot find symbol
if (mediaInformation.getPath() != null) {
^
symbol: method getPath()
location: variable mediaInformation of type MediaInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:323: error: cannot find symbol
map.put("path", mediaInformation.getPath());
^
symbol: method getPath()
location: variable mediaInformation of type MediaInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:326: error: cannot find symbol
map.put("startTime", mediaInformation.getStartTime().intValue());
^
symbol: method intValue()
location: class String
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:329: error: cannot find symbol
map.put("duration", mediaInformation.getDuration().intValue());
^
symbol: method intValue()
location: class String
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:332: error: cannot find symbol
map.put("bitrate", mediaInformation.getBitrate().intValue());
^
symbol: method intValue()
location: class String
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:334: error: cannot find symbol
if (mediaInformation.getRawInformation() != null) {
^
symbol: method getRawInformation()
location: variable mediaInformation of type MediaInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:335: error: cannot find symbol
map.put("rawInformation", mediaInformation.getRawInformation());
^
symbol: method getRawInformation()
location: variable mediaInformation of type MediaInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:338: error: cannot find symbol
final Set<Map.Entry<String, String>> metadata = mediaInformation.getMetadataEntries();
^
symbol: method getMetadataEntries()
location: variable mediaInformation of type MediaInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:383: error: cannot find symbol
if (streamInformation.getFullFormat() != null) {
^
symbol: method getFullFormat()
location: variable streamInformation of type StreamInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:384: error: cannot find symbol
map.put("fullFormat", streamInformation.getFullFormat());
^
symbol: method getFullFormat()
location: variable streamInformation of type StreamInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:393: error: cannot find symbol
map.put("bitrate", streamInformation.getBitrate().intValue());
^
symbol: method intValue()
location: class String
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:396: error: cannot find symbol
map.put("sampleRate", streamInformation.getSampleRate().intValue());
^
symbol: method intValue()
location: class String
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:423: error: cannot find symbol
final Set<Map.Entry<String, String>> metadata = streamInformation.getMetadataEntries();
^
symbol: method getMetadataEntries()
location: variable streamInformation of type StreamInformation
G:\Flutter android\flutter_windows_1.17.5-stable\flutter.pub-cache\git\flutter-ffmpeg-master-57d115002d90d50a46adabb6248372c65247660a\android
\src\main\java\com\arthenica\flutter\ffmpeg\FlutterFFmpegPlugin.java:434: error: cannot find symbol
final Set<Map.Entry<String, String>> sidedata = streamInformation.getSidedataEntries();
^
symbol: method getSidedataEntries()
location: variable streamInformation of type StreamInformation
14 errors

Task :flutter_ffmpeg:compileDebugJavaWithJavac FAILED

@tanersener
Copy link
Owner

My fault, sorry for that. There are some API changes in the new mobile-ffmpeg release. Current version of flutter_ffmpeg does not support them yet. Give me a few hours to prepare another build for you.

@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 31, 2020

Hi,
No issues. I commented out those lines as you can see in this repo as they were not required in flutter ffmpeg execution command.
https://github.com/pranavkpr1/flutter-ffmpeg-master
But still when I use the same ffmpeg command:
"-i input -vcodec h264 -crf 24 -vf scale=720:-2 -preset:v ultrafast output "
on the same input file of 260MB on the same device, its getting compressed to 30MB in 584 seconds (roughly 9 minutes) with 6-7 frames/s. So, I don't think there is performance improvement by updating the CPU targets for arm-v7a-neon.

@tanersener
Copy link
Owner

tanersener commented Jul 31, 2020

Well, I'm out of ideas.

@pranavkpr1
Copy link
Author

pranavkpr1 commented Jul 31, 2020

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.
Let me know, I can also try on my side by using ffmpeg.so files for v7a from ffmpeg-android in mobile-ffmpeg and then let you know the results.

@tanersener
Copy link
Owner

So, why not try compiling the ffmpeg .so files the same way as its done in ffmpeg android for v7a only.

I've already applied most of those changes for arm-v7a-neon in the development build I shared with you. And you said that it didn't change anything. It that was the problem, then we should have seen an improvement.

By the way, did you try using the Main version not the LTS version in your app?

@pranavkpr1
Copy link
Author

Hi,
I tried full-gpl-lts version today and it's taking more than 9 minutes to execute the same command for the same video on the same device.

@tanersener
Copy link
Owner

Did you try using full-gpl version at some point?

@pranavkpr1
Copy link
Author

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.

@tanersener
Copy link
Owner

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 full-gpl has the same issue as well.

@pranavkpr1
Copy link
Author

pranavkpr1 commented Aug 5, 2020

Hi,
Apologies for delay in response from my side. I tried using full-gpl package by mentioning this in build.gradle
ext {
flutterFFmpegPackage = "full-gpl"
}
I think your suspicion is correct that there is issue in LTS version. Compression time drastically reduced from 580 seconds(more than 9 minutes) to 234 seconds and if I optimize the compression command further, the compression time further reduced to 170 seconds for same video on same device. Flutter video compress was compressing the same video on same device in 214 seconds using same optimized command for compression.

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.
So, I think that original problem of efficiency and time difference for execution of command on flutter_ffmpeg and flutter_video_compress has been solved by using v4.4LTS of mobile-ffmpeg in flutter_ffmpeg but there is still the size issue for v7a if you want to optimize for the future users.

release apk size

@tanersener
Copy link
Owner

Thanks for performing those tests. There will be a new flutter_ffmpeg release based on mobile-ffmpeg v4.4 in the coming weeks.

At this point, I'm happy about the size of armeabi-v7a. Its size is bigger compared to other ABIs, because it includes two architectures, arm-v7a and arm-v7a-neon. If this is an issue for an application, that application can exclude native libraries for one of those two architectures in build.gradle and app size will decrease. You can do that as well.

@pranavkpr1
Copy link
Author

Hi,
@tanersener Thanks for solving the original issue :) So, I would close the issue now. Can you also point how to exclude one architecture in build.gralde?
Looking forward to hearing from you soon and then will close the issue. Thanks for quick replies and solving the issue in less than 2 weeks.

@tanersener
Copy link
Owner

tanersener commented Aug 11, 2020

To remove arm-v7a-neon support from an LTS release, use the following configuration in your build.gradle. It works with all previous versions.

android {
    packagingOptions {
        exclude 'lib/armeabi-v7a/*_neon.so'
    }
}

To remove arm-v7a support from v4.4.LTS, use the following one.

android {
    packagingOptions {
        exclude 'lib/armeabi-v7a/libavcodec.so'
        exclude 'lib/armeabi-v7a/libavformat.so'
        exclude 'lib/armeabi-v7a/libavfilter.so'
        exclude 'lib/armeabi-v7a/libavutil.so'
        exclude 'lib/armeabi-v7a/libswscale.so'
        exclude 'lib/armeabi-v7a/libswresample.so'
        exclude 'lib/armeabi-v7a/libavdevice.so'
    }
}

To remove arm-v7a support from LTS releases older than v4.4.LTS, use this one.

android {
    packagingOptions {
        exclude 'lib/armeabi-v7a/libavcodec.so'
        exclude 'lib/armeabi-v7a/libavfilter.so'
        exclude 'lib/armeabi-v7a/libswscale.so'
    }
}

@pranavkpr1
Copy link
Author

Thanks :)

@tanersener
Copy link
Owner

development branch is updated to depend on mobile-ffmpeg v4.4.

@pranavkpr1
Copy link
Author

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 :)

@tanersener
Copy link
Owner

Released in v0.3.0.

@pranavkpr1
Copy link
Author

Thanks, will release new version using this packages in a short time :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants