
Recherche avancée
Autres articles (86)
-
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation" -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)
Sur d’autres sites (11614)
-
Error for android-ndk-r21d and ffmpeg-snapshot
4 août 2020, par yejafotwhy im getting the below errors.
Am i done any misconfiguration in the build file ?


Can you change it according, im trying to configure for arm64_v8a (.so) file for android jni in my linux machine. Thanks !


Below is my build file.


#!/bin/bash
export NDK=/media/sf_sharing/android-ndk-r21d
export SYSROOT=$NDK/platforms/android-21/arch-arm64/
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
export TARGET=aarch64-linux-android
export API=21
export AR=$TOOLCHAIN/bin/$TARGET-ar
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/$TARGET-ld
export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib
export STRIP=$TOOLCHAIN/bin/$TARGET-strip
export CROSS_PREFIX=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64
rm -f $(pwd)/compat/strtod.o 
function build_one
 {
 ./configure\
 --prefix=$PREFIX\
 --enable-shared\
 --disable-static\
 --ar=$AR\
 --cc=$CC\
 --cxx=$CXX\
 --pkg-config=$(which pkg-config)\
 --ld=$LD\
 --ranlib=$RANLIB\
 --strip=$STRIP\
 --enable-protocol=file\
 --enable-pic\
 --enable-small\
 --disable-programs\
 --disable-doc\
 --disable-symver\
 --target-os=android\
 --sysinclude=$TOOLCHAIN/sysroot/usr/include\
 --enable-cross-compile\
 --cross-prefix=$TOOLCHAIN/bin/$TARGET-\
 --extra-cflags="-Os -fpic $ADDI_CFLAGS"\
 --extra-ldflags="$ADDI_LDFLAGS"\
 --sysroot=$TOOLCHAIN/sysroot $ADDITIONAL_CONFIG_FLAG
 make clean
 make -j2
 make install
 }
 CPU=arm64-v8a
 mkdir -p $(pwd)/android/$CPU
 PREFIX=$(pwd)/android/$CPU
 ADDI_CFLAGS="-march=armv8-a"
 #ADDI_LDFLAGS="-L$TOOLCHAIN/sysroot/usr/lib"
 ADDI_LDFLAGS="-L$SYSROOT/usr/lib"
 ADDITIONAL_CONFIG_FLAG="--arch=aarch64 --enable-yasm"
 build_one



Error :


INSTALL doc/examples/Makefile
CC libavdevice/alldevices.o
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:39:
In file included from /media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include/stdlib.h:32:
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdlib.h:61:7: error: expected identifier or '('
char* getenv(const char* __name);
 ^
./config.h:17:19: note: expanded from macro 'getenv'
#define getenv(x) NULL
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/include/stddef.h:89:18: note: expanded from macro 'NULL'
# define NULL ((void*)0)
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:39:
In file included from /media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include/stdlib.h:32:
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdlib.h:61:7: error: expected ')'
./config.h:17:19: note: expanded from macro 'getenv'
#define getenv(x) NULL
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/include/stddef.h:89:18: note: expanded from macro 'NULL'
# define NULL ((void*)0)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdlib.h:61:7: note: to match this '('
./config.h:17:19: note: expanded from macro 'getenv'
#define getenv(x) NULL
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/include/stddef.h:89:17: note: expanded from macro 'NULL'
# define NULL ((void*)0)
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:39:
In file included from /media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include/stdlib.h:32:
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdlib.h:61:7: error: expected ')'
char* getenv(const char* __name);
 ^
./config.h:17:19: note: expanded from macro 'getenv'
#define getenv(x) NULL
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/include/stddef.h:89:24: note: expanded from macro 'NULL'
# define NULL ((void*)0)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdlib.h:61:7: note: to match this '('
./config.h:17:19: note: expanded from macro 'getenv'
#define getenv(x) NULL
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/include/stddef.h:89:16: note: expanded from macro 'NULL'
# define NULL ((void*)0)
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:54:32: error: static declaration of 'cbrt' follows non-static declaration
static av_always_inline double cbrt(double x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:191:8: note: previous declaration is here
double cbrt(double __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:61:31: error: static declaration of 'cbrtf' follows non-static declaration
static av_always_inline float cbrtf(float x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:192:7: note: previous declaration is here
float cbrtf(float __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:68:32: error: static declaration of 'copysign' follows non-static declaration
static av_always_inline double copysign(double x, double y)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:279:8: note: previous declaration is here
double copysign(double __value, double __sign) __attribute_const__;
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:121:22: error: static declaration of 'erf' follows non-static declaration
static inline double erf(double z)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:211:8: note: previous declaration is here
double erf(double __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:340:9: warning: 'isnan' macro redefined [-Wmacro-redefined]
#define isnan(x) \
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:69:9: note: previous definition is here
#define isnan(x) __builtin_isnan(x)
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:359:9: warning: 'isfinite' macro redefined [-Wmacro-redefined]
#define isfinite(x) \
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:65:9: note: previous definition is here
#define isfinite(x) __builtin_isfinite(x)
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:366:31: error: static declaration of 'hypot' follows non-static declaration
static inline av_const double hypot(double x, double y)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:199:8: note: previous declaration is here
double hypot(double __x, double __y);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:423:22: error: static declaration of 'rint' follows non-static declaration
static inline double rint(double x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:239:8: note: previous declaration is here
double rint(double __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:430:43: error: static declaration of 'lrint' follows non-static declaration
static av_always_inline av_const long int lrint(double x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:243:6: note: previous declaration is here
long lrint(double __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:437:43: error: static declaration of 'lrintf' follows non-static declaration
static av_always_inline av_const long int lrintf(float x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:244:6: note: previous declaration is here
long lrintf(float __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:444:41: error: static declaration of 'round' follows non-static declaration
static av_always_inline av_const double round(double x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:251:8: note: previous declaration is here
double round(double __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:451:40: error: static declaration of 'roundf' follows non-static declaration
static av_always_inline av_const float roundf(float x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:252:7: note: previous declaration is here
float roundf(float __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:458:41: error: static declaration of 'trunc' follows non-static declaration
static av_always_inline av_const double trunc(double x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:263:8: note: previous declaration is here
double trunc(double __x);
 ^
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:312:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:533:
In file included from ./libavutil/internal.h:143:
./libavutil/libm.h:465:40: error: static declaration of 'truncf' follows non-static declaration
static av_always_inline av_const float truncf(float x)
 ^
/media/sf_sharing/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/math.h:264:7: note: previous declaration is here
float truncf(float __x);
 ^
2 warnings and 15 errors generated.
make: *** [libavdevice/alldevices.o] Error 1
santoku@santoku:/media/sf_sharing/ffmpeg$



i tried all old version of ffmpeg,ndk with different build files but that didnt work so now im trying this latest ffmpeg-snapshot and ndk21


-
Incorrect Codec Parameters, Could not write header for output file : FFMPEG - Android
26 septembre 2016, par SalmaanWhy do I get Incorrect Codec Parameters....???
I am creating video using AndroidMediaRecorder
, useFFMPEG
over it to trim it.
I am just trying to trim the video usingFFMPEG
.String[] ffmpegCommand = {
"/data/data/uk.org.humanfocus.hfi/ffmpeg",
"-ss",
"00:00:00",
"-i",
path, // string variable, path of file
"-t",
"00:00:05", // duration of video
"-c",
"copy",
destination + "/trimmmmm.mp4" }; // stringThis is log I get..
It is from starting ofFFMPEG
processing until it ends.10-24 18:02:06.039: V/ss(22093): ***Starting FFMPEG***
10-24 18:02:06.144: V/asd(22093): ***ffmpeg version N-63700-gbf0e5ac Copyright (c) 2000-2014 the FFmpeg developers***
10-24 18:02:06.144: V/asd(22093): *** built on Jun 3 2014 13:27:45 with gcc 4.8 (GCC)***
10-24 18:02:06.144: V/asd(22093): *** configuration: --prefix=/Users/aliasa/Downloads/android-ndk-r9/sources/ffmpeg/android/arm --enable-shared --disable-static --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-doc --disable-symver --cross-prefix=/Users/aliasa/Downloads/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi- --target-os=linux --arch=arm --enable-cross-compile --sysroot=/Users/aliasa/Downloads/android-ndk-r9/platforms/android-9/arch-arm/ --extra-cflags='-Os -fpic -marm' --extra-ldflags=***
10-24 18:02:06.149: V/asd(22093): *** libavutil 52. 89.100 / 52. 89.100***
10-24 18:02:06.149: V/asd(22093): *** libavcodec 55. 66.100 / 55. 66.100***
10-24 18:02:06.149: V/asd(22093): *** libavformat 55. 42.100 / 55. 42.100***
10-24 18:02:06.149: V/asd(22093): *** libavfilter 4. 5.100 / 4. 5.100***
10-24 18:02:06.149: V/asd(22093): *** libswscale 2. 6.100 / 2. 6.100***
10-24 18:02:06.149: V/asd(22093): *** libswresample 0. 19.100 / 0. 19.100***
10-24 18:02:06.289: V/asd(22093): ***Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/copymade.mp4':***
10-24 18:02:06.289: V/asd(22093): *** Metadata:***
10-24 18:02:06.289: V/asd(22093): *** major_brand : isom***
10-24 18:02:06.289: V/asd(22093): *** minor_version : 0***
10-24 18:02:06.289: V/asd(22093): *** compatible_brands: isom3gp4***
10-24 18:02:06.289: V/asd(22093): *** creation_time : 2014-10-24 12:25:55***
10-24 18:02:06.294: V/asd(22093): *** Duration: 00:00:11.65, start: 0.000000, bitrate: 3147 kb/s***
10-24 18:02:06.294: V/asd(22093): *** Stream #0:0(eng): Video: h263 (s263 / 0x33363273), yuv420p, 720x480 [SAR 12:11 DAR 18:11], 3276 kb/s, 16.61 fps, 16.67 tbr, 90k tbn, 29.97 tbc (default)***
10-24 18:02:06.294: V/asd(22093): *** Metadata:***
10-24 18:02:06.294: V/asd(22093): *** creation_time : 2014-10-24 12:25:55***
10-24 18:02:06.294: V/asd(22093): *** handler_name : VideoHandle***
10-24 18:02:06.294: V/asd(22093): *** Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 12 kb/s (default)***
10-24 18:02:06.294: V/asd(22093): *** Metadata:***
10-24 18:02:06.294: V/asd(22093): *** creation_time : 2014-10-24 12:25:55***
10-24 18:02:06.294: V/asd(22093): *** handler_name : SoundHandle***
10-24 18:02:06.294: V/asd(22093): ***[mp4 @ 0x50ce0] Could not find tag for codec h263 in stream #0, codec not currently supported in container***
10-24 18:02:06.294: V/asd(22093): ***Output #0, mp4, to '/storage/emulated/0/trimmmmm.mp4':***
10-24 18:02:06.294: V/asd(22093): *** Metadata:***
10-24 18:02:06.294: V/asd(22093): *** major_brand : isom***
10-24 18:02:06.294: V/asd(22093): *** minor_version : 0***
10-24 18:02:06.294: V/asd(22093): *** compatible_brands: isom3gp4***
10-24 18:02:06.294: V/asd(22093): *** encoder : Lavf55.42.100***
10-24 18:02:06.294: V/asd(22093): *** Stream #0:0(eng): Video: h263 (s263 / 0x33363273), yuv420p, 720x480 [SAR 12:11 DAR 18:11], q=2-31, 3276 kb/s, 16.61 fps, 90k tbn, 90k tbc (default)***
10-24 18:02:06.294: V/asd(22093): *** Metadata:***
10-24 18:02:06.294: V/asd(22093): *** creation_time : 2014-10-24 12:25:55***
10-24 18:02:06.294: V/asd(22093): *** handler_name : VideoHandle***
10-24 18:02:06.294: V/asd(22093): *** Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 8000 Hz, mono, 12 kb/s (default)***
10-24 18:02:06.294: V/asd(22093): *** Metadata:***
10-24 18:02:06.294: V/asd(22093): *** creation_time : 2014-10-24 12:25:55***
10-24 18:02:06.299: V/asd(22093): *** handler_name : SoundHandle***
10-24 18:02:06.299: V/asd(22093): ***Stream mapping:***
10-24 18:02:06.299: V/asd(22093): *** Stream #0:0 -> #0:0 (copy)***
10-24 18:02:06.299: V/asd(22093): *** Stream #0:1 -> #0:1 (copy)***
10-24 18:02:06.299: V/asd(22093): ***Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument***
10-24 18:02:06.299: V/asdas(22093): ***Ending FFMPEG***I am badly stuck here from 2 3 days, please help me out.
-
Android : Pass video path to FFmpeg
29 septembre 2020, par marianI have developed an app that play video from gallery. I would like to add watermark using
FFmpeg
command in the video selected. But I do not know how to pass the path to theFFmpeg
command. I could not find proper tutorials or reference regarding this. My coding are as follows :

MainActivity.java :


public class MainActivity extends Activity {
public ProgressDialog progressBar;

String workFolder = null;
String demoVideoFolder = null;
String demoVideoPath = null;
String vkLogPath = null;
LoadJNI vk;
private final int STOP_TRANSCODING_MSG = -1;
private final int FINISHED_TRANSCODING_MSG = 0;
private boolean commandValidationFailedFlag = false;

Button button;
VideoView videoView;
private static final int PICK_FROM_GALLERY = 1;


private void runTranscodingUsingLoader() {
 Log.i(Prefs.TAG, "runTranscodingUsingLoader started...");

 PowerManager powerManager = (PowerManager)MainActivity.this.getSystemService(Activity.POWER_SERVICE);
 PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
 Log.d(Prefs.TAG, "Acquire wake lock");
 wakeLock.acquire();

 

 String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental",
 "-vf", "movie=/sdcard/videokit/watermark.png [watermark];" +
 " [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s",
 "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab",
 "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out1.mp4"};
 ///////////////////////////////////////////////////////////////////////


 vk = new LoadJNI();
 try {
 // running complex command with validation
 vk.run(complexCommand, workFolder, getApplicationContext());

 // running without command validation
 //vk.run(complexCommand, workFolder, getApplicationContext(), false);

 // running regular command with validation
 //vk.run(GeneralUtils.utilConvertToComplex(commandStr), workFolder, getApplicationContext());

 Log.i(Prefs.TAG, "vk.run finished.");
 // copying vk.log (internal native log) to the videokit folder
 GeneralUtils.copyFileToFolder(vkLogPath, demoVideoFolder);

 } catch (CommandValidationException e) {
 Log.e(Prefs.TAG, "vk run exeption.", e);
 commandValidationFailedFlag = true;

 } catch (Throwable e) {
 Log.e(Prefs.TAG, "vk run exeption.", e);
 }
 finally {
 if (wakeLock.isHeld()) {
 wakeLock.release();
 Log.i(Prefs.TAG, "Wake lock released");
 }
 else{
 Log.i(Prefs.TAG, "Wake lock is already released, doing nothing");
 }
 }

 // finished Toast
 String rc = null;
 if (commandValidationFailedFlag) {
 rc = "Command Vaidation Failed";
 }
 else {
 rc = GeneralUtils.getReturnCodeFromLog(vkLogPath);
 }
 final String status = rc;
 MainActivity.this.runOnUiThread(new Runnable() {
 public void run() {
 Toast.makeText(MainActivity.this, status, Toast.LENGTH_LONG).show();
 if (status.equals("Transcoding Status: Failed")) {
 Toast.makeText(MainActivity.this, "Check: " + vkLogPath + " for more information.", Toast.LENGTH_LONG).show();
 }
 }
 });
}


@Override
public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);

 button = (Button) findViewById(R.id.button);
 
 videoView = (VideoView) findViewById(R.id.videoview);

 button.setOnClickListener(new View.OnClickListener() {

 public void onClick(View v) {
 // TODO Auto-generated method stub
 Intent intent = new Intent();

 intent.setType("video/*");
 intent.setAction(Intent.ACTION_GET_CONTENT);

 startActivityForResult(Intent.createChooser(intent, "Complete action using"), PICK_FROM_GALLERY);
 }
 });

}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
 if (resultCode != RESULT_OK) return;

 if (requestCode == PICK_FROM_GALLERY) {
 Uri mVideoURI = data.getData();
 videoView.setVideoURI(mVideoURI);
 videoView.start();
 demoVideoFolder = mVideoURI.getPath();
 demoVideoPath = demoVideoFolder;
 savevideo(mVideoURI);

 }


}
private Handler handler = new Handler() {
 @Override
 public void handleMessage(Message msg) {
 Log.i(Prefs.TAG, "Handler got message");
 if (progressBar != null) {
 progressBar.dismiss();

 // stopping the transcoding native
 if (msg.what == STOP_TRANSCODING_MSG) {
 Log.i(Prefs.TAG, "Got cancel message, calling fexit");
 vk.fExit(getApplicationContext());


 }
 }
 }
};

public void runTranscoding() {
 progressBar = new ProgressDialog(MainActivity.this);
 progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
 progressBar.setTitle("FFmpeg4Android Direct JNI");
 progressBar.setMessage("Press the cancel button to end the operation");
 progressBar.setMax(100);
 progressBar.setProgress(0);

 progressBar.setCancelable(false);
 progressBar.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
 @Override
 public void onClick(DialogInterface dialog, int which) {
 handler.sendEmptyMessage(STOP_TRANSCODING_MSG);
 }
 });

 progressBar.show();

 new Thread() {
 public void run() {
 Log.d(Prefs.TAG,"Worker started");
 try {
 //sleep(5000);
 runTranscodingUsingLoader();
 handler.sendEmptyMessage(FINISHED_TRANSCODING_MSG);

 } catch(Exception e) {
 Log.e("threadmessage",e.getMessage());
 }
 }
 }.start();

 // Progress update thread
 new Thread() {
 ProgressCalculator pc = new ProgressCalculator(vkLogPath);
 public void run() {
 Log.d(Prefs.TAG,"Progress update started");
 int progress = -1;
 try {
 while (true) {
 sleep(300);
 progress = pc.calcProgress();
 if (progress != 0 && progress < 100) {
 progressBar.setProgress(progress);
 }
 else if (progress == 100) {
 Log.i(Prefs.TAG, "==== progress is 100, exiting Progress update thread");
 pc.initCalcParamsForNextInter();
 break;
 }
 }

 } catch(Exception e) {
 Log.e("threadmessage",e.getMessage());
 }
 }
 }.start();
}

public void savevideo (Uri mVideoURI){
 demoVideoFolder = mVideoURI.getPath();
 demoVideoPath = demoVideoFolder;
 Log.i(Prefs.TAG, getString(R.string.app_name) + " version: " + GeneralUtils.getVersionName(getApplicationContext()));

 Button invoke = (Button) findViewById(R.id.button);
 invoke.setOnClickListener(new View.OnClickListener() {
 public void onClick(View v) {
 Log.i(Prefs.TAG, "run clicked.");
 runTranscoding();
 }
 });

 workFolder = getApplicationContext().getFilesDir() + "/";
 Log.i(Prefs.TAG, "workFolder (license and logs location) path: " + workFolder);
 vkLogPath = workFolder + "vk.log";
 Log.i(Prefs.TAG, "vk log (native log) path: " + vkLogPath);
 GeneralUtils.copyLicenseFromAssetsToSDIfNeeded(this, workFolder);
 GeneralUtils.copyDemoVideoFromAssetsToSDIfNeeded(this, demoVideoFolder);
 int rc = GeneralUtils.isLicenseValid(getApplicationContext(), workFolder);
 Log.i(Prefs.TAG, "License check RC: " + rc);

}
}



FFmpeg command :


String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental",
 "-vf", "movie=/sdcard/videokit/watermark.png [watermark];" +
 " [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s",
 "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab",
 "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out1.mp4"};



Tis command is from a sample project. How do I pass the video path to this command ? I do not know how to edit the command to support my requirement. Can someone guide me through this. Any help will be really helpful. Thank you.