Mobile-ffmpeg: Quality is weird. Anything possible?

Created on 4 Oct 2019  路  6Comments  路  Source: tanersener/mobile-ffmpeg

Description
Not a bug report or anything but mostly a common sense check.
First of all thanks for porting this, and making it much much easier to use on Android.

Now to the point in question. I am trying to stitch together 2 video files, and I did manage to do that but there is something that I noticed during the process. The output quality of the videos in question is _much much lower_ then the original files.
Now at this point I though that maybe I gave wrong instructions to the library, but then I tried the same command, with the same original video files recorded on my device, on windows.
Downloaded the source files directly and ran everything locally on my Windows PC.
Is it possible that the difference in the base libs can affect the video quality so much?

My question is base on the command bellow, do you think that there should be any difference in the output of them on different systems?

Command used:
ffmpeg.exe -i 1570134462551.mp4 -i test123.mp4 -filter_complex [1:v]colorkey=0x0000FF:0.2:1.0[ckout];[ckout]scale=w=200:h=-1[sout];[0:v][sout]overlay=25:main_h-overlay_h-25[out] -map [out] final.mp4

Environment

  • Platform: Android

    • Version of Mobile FFmpeg: 4.2.2

      I/mobile-ffmpeg: ffmpeg version v4.2-dev-1824

      I/mobile-ffmpeg: Copyright (c) 2000-2019 the FFmpeg developers

      I/mobile-ffmpeg: 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)

      I/mobile-ffmpeg: configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk-bundle/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++ --target-os=android --enable-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 --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-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-zlib --enable-mediacodec

      I/mobile-ffmpeg: libavutil 56. 30.100 / 56. 30.100

      I/mobile-ffmpeg: libavcodec 58. 53.101 / 58. 53.101

      I/mobile-ffmpeg: libavformat 58. 28.101 / 58. 28.101

      I/mobile-ffmpeg: libavdevice 58. 7.100 / 58. 7.100

      I/mobile-ffmpeg: libavfilter 7. 55.100 / 7. 55.100

      I/mobile-ffmpeg: libswscale 5. 4.101 / 5. 4.101

      I/mobile-ffmpeg: libswresample 3. 4.100 / 3. 4.100

  • Version of FFmpeg used on Windows:
    ffmpeg version N-95202-g2a546fb7d5 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 9.2.1 (GCC) 20190918
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
    libavutil 56. 35.100 / 56. 35.100
    libavcodec 58. 59.101 / 58. 59.101
    libavformat 58. 33.100 / 58. 33.100
    libavdevice 58. 9.100 / 58. 9.100
    libavfilter 7. 61.100 / 7. 61.100
    libswscale 5. 6.100 / 5. 6.100
    libswresample 3. 6.100 / 3. 6.100
    libpostproc 55. 6.100 / 55. 6.100

    • Android Studio version: 3.5

Note
(unfortunately I am unable to share the video files, due to certain limitations of the contents of them)

question

All 6 comments

Which mobile-ffmpeg package do you use? Can you try running the same command using full-gpl package?

My question is base on the command bellow, do you think that there should be any difference in the output of them on different systems?

Yes, ffmpeg chooses the best encoder available when encoding a file. And the best encoder may change according to the external libraries enabled.

Console output shows the selected encoder. If you compare the outputs of both executions you will see which encoder is used for both of them. I suspect they are different and this is the reason behind the quality difference between them.

Ok managed to get it to work!
I actually was not aware of multiple different packages, so fiddled around and yes figured how to use another one.

Also a note, while switching from full to full-gpl I had an error: "dlopen failed: library "libcpufeatures.so" not found"
Fixed it by cleaning the project must have been a leftover by android studio.

Afterwards manage to run the ffmpeg command with an additional parameter -v:c libx264 which dramatically improved the quality, actually matched the Windows output so all is good!

Again thanks for the library! And thank you for prompt response!!!

Reduce quality of Video while use this library how can i solve this.

@vlazdra how can you increase your output
video quality

Hi @mansiJspaceo unfortunately I ended up switching libraries for ffmpeg actions, so no longer have the code as a reference.

@vlazdra okat Thnak you.

What you use for the Video Editing ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

longkeng picture longkeng  路  4Comments

JayParikh20 picture JayParikh20  路  4Comments

usmanrana07 picture usmanrana07  路  5Comments

jigneshvashundhara picture jigneshvashundhara  路  9Comments

andyrenkehe picture andyrenkehe  路  8Comments