0

I am using https://github.com/WritingMinds/ffmpeg-android-java. Can trim, join mp4 files but not able to rotate and speed up/down.

Tried almost all SO answers but no luck.

I am using latest Android Studio.

D/ffmpeg_work: [-noautorotate, -i, /storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4, -vf, transpose=1, /storage/emulated/0/Pictures/VideoApp/v_1480001945.mp4]
D/FFmpeg: Running publishing updates method
D/ffmpeg_work: onProgress: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
D/ffmpeg_work: onProgress:   built with gcc 4.8 (GCC)
D/ffmpeg_work: onProgress:   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=
D/ffmpeg_work: onProgress:   libavutil      55. 17.103 / 55. 17.103
D/ffmpeg_work: onProgress:   libavcodec     57. 24.102 / 57. 24.102
D/ffmpeg_work: onProgress:   libavformat    57. 25.100 / 57. 25.100
D/ffmpeg_work: onProgress:   libavdevice    57.  0.101 / 57.  0.101
D/ffmpeg_work: onProgress:   libavfilter     6. 31.100 /  6. 31.100
D/ffmpeg_work: onProgress:   libswscale      4.  0.100 /  4.  0.100
D/ffmpeg_work: onProgress:   libswresample   2.  0.101 /  2.  0.101
D/ffmpeg_work: onProgress:   libpostproc    54.  0.100 / 54.  0.100
D/ffmpeg_work: onProgress: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4':
D/ffmpeg_work: onProgress:   Metadata:
D/ffmpeg_work: onProgress:     major_brand     : isom
D/ffmpeg_work: onProgress:     minor_version   : 512
D/ffmpeg_work: onProgress:     compatible_brands: isomiso2avc1mp41
D/ffmpeg_work: onProgress:     encoder         : Lavf57.25.100
D/ffmpeg_work: onProgress:   Duration: 00:00:09.88, start: -3.000000, bitrate: 1816 kb/s
D/ffmpeg_work: onProgress:     Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 1755 kb/s, 4.46 fps, 7.50 tbr, 90k tbn, 180k tbc (default)
D/ffmpeg_work: onProgress:     Metadata:
D/ffmpeg_work: onProgress:       rotate          : 270
D/ffmpeg_work: onProgress:       handler_name    : VideoHandler
D/ffmpeg_work: onProgress:     Side data:
D/ffmpeg_work: onProgress:       displaymatrix: rotation of 90.00 degrees
D/ffmpeg_work: onProgress:     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
D/ffmpeg_work: onProgress:     Metadata:
D/ffmpeg_work: onProgress:       handler_name    : SoundHandler

Tried these also:

[-noautorotate, -i, /storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4, -filter:v, transpose=1, /storage/emulated/0/Pictures/VideoApp/v_1480002208.mp4]

[-noautorotate, -i, /storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4, -filter:v, transpose=1, -metadata:s:v, rotate=0, /storage/emulated/0/Pictures/VideoApp/v_1480002275.mp4]

[-noautorotate, -i, /storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4, -vf, transpose=1, /storage/emulated/0/Pictures/VideoApp/v_1480002362.mp4]

After this nothing happens in both cases

  • What was the result of the guidance provided in your prior question: http://stackoverflow.com/questions/40723256/cant-use-ffmpeg-3-2-in-android-project – Morrison Chang Nov 22 '16 at 19:54
  • Your console output isn't complete. In any case, since you're using v3.0.1, either skip the `-vf, "transpose = 1",` since ffmpeg will autorotate the video **or** add `-noautorotate` before `-i` & `-metadata:s:v rotate=0` after the transpose argument. – Gyan Nov 23 '16 at 03:37
  • @Mulvya thanks for the info; [-noautorotate, -i, /storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4, -vf, transpose = 1, -metadata:s:v rotate=0, /storage/emulated/0/Pictures/VideoApp/v_1479897644.mp4] tried this and getting this error: At least one output file must be specified – ashishguptabns Nov 23 '16 at 10:41
  • @MorrisonChang that is for compilation. I am still trying not to compile on my own but use the one which everybody is using – ashishguptabns Nov 23 '16 at 10:44
  • @Mulvya tried this also; [-noautorotate, -i, /storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4, -vf, transpose = 1, -metadata:s:v, rotate=0, /storage/emulated/0/Pictures/VideoApp/v_1479897909.mp4] but no luck – ashishguptabns Nov 23 '16 at 10:45
  • If your transpose = 1 is not in quotes, remove the spaces. – Gyan Nov 23 '16 at 16:10
  • I have tried all permutations I guess. cmdList.add("-noautorotate"); cmdList.add("-i"); cmdList.add(video.getFilePath()); cmdList.add("-vf"); cmdList.add("transpose=1"); cmdList.add("-metadata:s:v"); cmdList.add("rotate=0"); cmdList.add(outFile); one such example – ashishguptabns Nov 23 '16 at 18:29
  • @Mulvya any lead? – ashishguptabns Nov 24 '16 at 14:21
  • `-metadata:s:v rotate=0` is a single argument with no comma in between. Show the readout from execution. – Gyan Nov 24 '16 at 14:39
  • @Mulvya got this error [-noautorotate, -i, /storage/emulated/0/Pictures/VideoApp/v_1479895157.mp4, -vf, transpose=1, -metadata:s:v rotate=0, /storage/emulated/0/Pictures/VideoApp/v_1480000801.mp4] Metadata: handler_name : SoundHandler At least one output file must be specified – ashishguptabns Nov 24 '16 at 15:20
  • try removing android from the stack. get ffmpeg.3.2 binary for your platform and iterate with it on your platform until u get good rotation... THEN go back to the android stack and make sure to implement the exact cli expression that worked on your dev platform. ie if u on linux x64, get the 64 bit linux binary for ffmpeg-3-2 and make it work.... then xfer that cli expression over to android and it should also work there because your project, under the covers is just calling into a linux-x86-32bit-ffmpeg binary for release 3.2...... when back on andr, turn on the debug logger – Robert Rowntree Nov 24 '16 at 18:12
  • Add `-report` to your command and run. A text file will be generated, Post that. – Gyan Nov 25 '16 at 06:27
  • @RobertRowntree thx for the suggestion. I will do that also – ashishguptabns Nov 25 '16 at 08:32
  • @Mulvya getting this error, no sol on SO apparently for this :( Failed to open report "ffmpeg-20161125-140024.log": Read-only file system Failed to set value '1' for option 'report': Read-only file system Error parsing global options: Read-only file system; [-report, -i, /storage/emulated/0/Pictures/VideoApp/v_1480062592.mp4, -vf, transpose=1, /storage/emulated/0/Pictures/VideoApp/v_1480062624.mp4] – ashishguptabns Nov 25 '16 at 08:34
  • @Mulvya tried this also [-report, FFREPORT=file=ffreport.log:level=32, -i, /storage/emulated/0/Pictures/VideoApp/v_1480062592.mp4, -vf, transpose=1, /storage/emulated/0/Pictures/VideoApp/v_1480062921.mp4]; same error; tried this also [FFREPORT=file=ffreport.log:level=32, -i, /storage/emulated/0/Pictures/VideoApp/v_1480062592.mp4, -vf, transpose=1, /storage/emulated/0/Pictures/VideoApp/v_1480062953.mp4]; error Unable to find a suitable output format for 'FFREPORT=file=ffreport.log:level=32' FFREPORT=file=ffreport.log:level=32: Invalid argument – ashishguptabns Nov 25 '16 at 08:37
  • Thanks everyone for your support. Finally got it working. Issue was file name; silly. never put numbers in file names – ashishguptabns Nov 26 '16 at 09:50
  • Actually I noticed that filename isn't the problem. No idea why it started working :( – ashishguptabns Nov 26 '16 at 10:21
  • Finally figured it out :D. I was creating the file before feeding in the command and it outputs to non existent file with the command I was using. Such a silly mistake took many days. Sorry – ashishguptabns Nov 26 '16 at 14:13

0 Answers0