1

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

4
  • All filter spec after "-filter_complex" and before outputPath goes as a single string. Don't forget the ; separators where necessary Commented Aug 17, 2018 at 6:38
  • @AlexCohn and how to define codecs ?Will they be separate from filer_complex or with them. Commented Aug 17, 2018 at 6:49
  • Which codecs? With very few exceptions, your array will look like ["-xxx", "yyy", "-abc", "def", … , outputPath] Commented Aug 17, 2018 at 11:05
  • I got it figured now. Thanks for your previous comments. But for codecs I meant like libvorbis etc and also I am not able to figure out how to use -map commands Commented Aug 17, 2018 at 11:08

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.