tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.87k stars 791 forks source link

Filter command is failed to be executed because ffmpeg cannot open transform file "transforms.trf" #376

Closed SembaMax closed 4 years ago

SembaMax commented 4 years ago

First thank you for this awesome library đź‘Ź Description I'm trying to execute filter command as following: "ffmpeg -i -threads 2 -vf [in]deflicker,dejudder[p0];[p0]vidstabdetect=shakiness=10:accuracy=15:result=transforms.trf[out] -f null -"

Unfortunately this's not working. Here's the command i use in kotlin. val cmd = "-i ${inputVideo.path} -threads ${Runtime.getRuntime().availableProcessors()} -vf [in]deflicker,dejudder[p0];[p0]vidstabdetect=shakiness=10:accuracy=15:result=transforms.trf[out] -f null -"

Expected behavior the command mentioned above should be executed successfully, Therefore should get "transforms.trf" file as result.

Current behavior This command is failed to be executed. It says in logs "cannot open transform file transforms.trf"

Logs 2020-04-08 17:02:04.293 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: ffmpeg version git-2020-01-25-fd11dd500 2020-04-08 17:02:04.293 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Copyright (c) 2000-2020 the FFmpeg developers 2020-04-08 17:02:04.293 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 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) 2020-04-08 17:02:04.293 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 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-android21-clang --cxx=aarch64-linux-android21-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 --disa 2020-04-08 17:02:04.294 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: libavutil 56. 38.100 / 56. 38.100 2020-04-08 17:02:04.294 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: libavcodec 58. 65.102 / 58. 65.102 2020-04-08 17:02:04.294 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: libavformat 58. 35.101 / 58. 35.101 2020-04-08 17:02:04.294 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: libavdevice 58. 9.103 / 58. 9.103 2020-04-08 17:02:04.294 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: libavfilter 7. 70.101 / 7. 70.101 2020-04-08 17:02:04.294 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: libswscale 5. 6.100 / 5. 6.100 2020-04-08 17:02:04.294 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: libswresample 3. 6.100 / 3. 6.100 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Download/walkaround.mp4': 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Metadata: 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: major_brand : 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: mp42 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: minor_version : 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 0 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: compatible_brands: 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: isommp42 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: creation_time : 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 2018-09-18T14:11:22.000000Z 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Duration: 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 00:00:11.56 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: , start: 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 0.000000 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: , bitrate: 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 1424 kb/s 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Stream #0:0 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: (und) 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: : Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1295 kb/s 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: , 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 23.98 fps, 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 23.98 tbr, 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 90k tbn, 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 47.95 tbc 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: (default) 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Metadata: 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: creation_time : 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 2018-09-18T14:11:22.000000Z 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: handler_name : 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: ISO Media file produced by Google Inc. Created on: 09/18/2018. 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Stream #0:1 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: (eng) 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: (default) 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Metadata: 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: creation_time : 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: 2018-09-18T14:11:22.000000Z 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: handler_name : 2020-04-08 17:02:04.318 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: ISO Media file produced by Google Inc. Created on: 09/18/2018. 2020-04-08 17:02:04.320 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Stream mapping: 2020-04-08 17:02:04.320 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Stream #0:0 -> #0:0 2020-04-08 17:02:04.320 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: (h264 (native) -> wrapped_avframe (native)) 2020-04-08 17:02:04.320 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Stream #0:1 -> #0:1 2020-04-08 17:02:04.320 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: (aac (native) -> pcm_s16le (native)) 2020-04-08 17:02:04.320 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Press [q] to stop, [?] for help 2020-04-08 17:02:04.352 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [graph 0 input from stream 0:0 @ 0x7102604200] sws_param option is deprecated and ignored 2020-04-08 17:02:04.353 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [vidstabdetect @ 0x71672491d8] Fieldsize: 72, Maximal translation: 102 pixel 2020-04-08 17:02:04.353 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [vidstabdetect @ 0x71672491d8] Number of used measurement fields: 78 out of 78 2020-04-08 17:02:04.353 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [vidstabdetect @ 0x71672491d8] Fieldsize: 12, Maximal translation: 12 pixel 2020-04-08 17:02:04.353 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [vidstabdetect @ 0x71672491d8] Number of used measurement fields: 1428 out of 1428 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] Video stabilization settings (pass 1/2): 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] shakiness = 10 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] accuracy = 15 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] stepsize = 6 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] mincontrast = 0.250000 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] tripod = 0 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] show = 0 2020-04-08 17:02:04.354 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] result = transforms.trf 2020-04-08 17:02:04.355 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] cannot open transform file transforms.trf 2020-04-08 17:02:04.355 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: [Parsed_vidstabdetect_2 @ 0x7102604140] Failed to configure input pad on Parsed_vidstabdetect_2 2020-04-08 17:02:04.356 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Error reinitializing filters! 2020-04-08 17:02:04.356 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Failed to inject frame into filter network: Invalid argument 2020-04-08 17:02:04.356 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Error while processing the decoded data for stream #0:0 2020-04-08 17:02:04.369 2652-2828/com.videoeditor.demo E/FFMpeg Debugger: Conversion failed!

Environment

Thanks in advance.

tanersener commented 4 years ago

Can you try creating transforms.trf in a directory where you have write permission?

Additionally, you can take a look at VidStabTabFragment in Android test application. It uses vidstabdetect and vidstabtransform filters. It can help you to resolve this issue.

SembaMax commented 4 years ago

Thank you very much Taner. As the example you mentioned above is quite clear, thanks again for sharing.