Reputation: 5705
I am using BravoBit dependency to execute ffmpeg commands in Android. Below is the dependency
implementation 'nl.bravobit:android-ffmpeg:1.1.5'
It takes a String[] commands to execute the ffmpeg commands. But I am not able to figure out how to pass complex commands in the array format. I keep getting invalid arguments error whenever I try to execute my commands. Below is one of the commands I am trying to use.
String[] cmd = new String[]{"-i", uri,
"-i",overlayUri , "-filter_complex","[0:v]setpts=PTS-STARTPTS", "scale=1920x1080[top]","[1:v]loop=-1:size=750","setpts=N/FRAME_RATE/TB","scale=1920x1080","format=yuva420p", "colorchannelmixer=aa=0.5[bottom]"
, "[top][bottom]overlay=shortest=1, format=yuv420p", outputPath};
Here uri,overlayUri are the input and overlay file path and outputPath is the path for output file.
The error that I got
[NULL @ 0xf6d44e00] Unable to find a suitable output format for '[1:v]loop=-1:size=750' [1:v]loop=-1:size=750: Invalid argument
Upvotes: 1
Views: 1084
Reputation: 5705
After lot of hit and try methods I got it working with the below format.
String[] cmd4 = new String[]{"-i", uri,"-f" ,"lavfi",
"-i","movie="+overlayUri+":loop=200,setpts=N/FRAME_RATE/TB","-filter_complex","[1:v][0:v]scale2ref[ua][b];[ua]setsar=1,format=yuva444p,colorchannelmixer=aa=0.5[u];[b][u]overlay", outputPath};
My aim with the above command was to overlay a video over another video and loop the overlay video to the length of the input video.
What I understood here is that anything starting with -
is a sub command and should be a index in the command array.
Upvotes: 1