Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

very slow compression #2

Open
narendra88 opened this issue Jul 10, 2017 · 1 comment
Open

very slow compression #2

narendra88 opened this issue Jul 10, 2017 · 1 comment

Comments

@narendra88
Copy link

narendra88 commented Jul 10, 2017

The original command mentioned in the code was damn slow in each and every device. For example, in LG Nexus 5, for an input video of approx 50 MB and duration 2 min 30 sec. It took around 5 mins to compress it with resulting compressed video to be around 5 MB, and quality degradation.

Though, I tried changing the command in order to make it faster, and changed it to something like this -

String[] complexCommand = {"-i", yourRealPath, "-r", "20", "-vcodec", "mpeg4", "-preset", "ultrafast", "-c:a", "copy", "-me_method", "zero", "-tune", "fastdecode", "-tune", "zerolatency", "-strict", "-2", "-b:v", "1000k", "-pix_fmt", "yuv420p", filePath};

  • It made the same input video compression a lot faster in the LG Nexus 5, i.e, it took just 50 sec to compress it with resultant 20 MB video.

  • But, unluckily, when I tried the same in Samsung Galaxy Grand i9082, it was slow, and took around 5 mins in compression with the resultant video of 30 MB.

  • In Lava X1 Selfie (version 5.1),

It initially failed with this error -

ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (GCC)
  configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/sdcard0/Videos/Lat_test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-12-25 16:56:08
  Duration: 00:02:22.08, start: 0.000000, bitrate: 3024 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 2829 kb/s, 25 fps, 25 tbr, 50 tbn, 50 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      creation_time   : 2012-12-25 16:56:08
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
/storage/sdcard0/Movies/compress_video.mp4: No such file or directory

It was probably due to the reason that the code failed to create Movies directory.
So, afterwards, I tried hardcoding the output path, so this time it didn't fail but stuck with progressDialog with a message progress: handler_name : isoMedia File Produced by Google, 5-11-2011 for about infinite time.

My target is to minimize video compression time consumption, to be as low as possible, for around 50 MB video, 1 min time consumption is okay for me.

Please guide me the way to get rid of the slow video compression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants