madhavanmalolan / ffmpegandroidlibrary

One line integration for FFMPEG Library in Android
MIT License
90 stars 15 forks source link

issue in running the project #28

Open pals-ric opened 6 years ago

pals-ric commented 6 years ago

String filein = "input.mp4"; String img ="kapil.jpg"; String fileout = Environment.getExternalStorageDirectory().getAbsolutePath() +"/output.mp4"; Controller.getInstance().run(new String[]{ "-i", filein, "-i", img, "-filter_complex", "overlay=0:main_h-overlay_h", fileout });

i am using this code to run my video with image over in main activity ...but output only blank activity is coming ...i am trying to run your project also same blank activity .... suggest something!!!

dshigh commented 6 years ago

check for output in your phone storage.

pals-ric commented 6 years ago

@dshigh file is not there in external storage and why app is stoping while running...

dshigh commented 6 years ago

Share your log.

pals-ric commented 6 years ago

if i tried to mute video with this command Controller.getInstance().run(new String[]{ "-y", "-i", filein, "-vcodec", "copy", "-an", fileout });

its working fine, but if i'm trying to add image in the video with this command, Controller.getInstance().run(new String[]{ "-i", filein, "-i", image, "-filter_complex", "overlay=10:main_h-overlay_h-10", fileout });

its not working, app is crashing.

rishirane commented 6 years ago

In case you are still wondering.. As you are trying to put image over video it needs to be re-encoded with libx264 codec profile.

new String[]{ "-y", "-i", videofileabsolutepath, "-i", imagefileabsolutepath,"-strict","experimental", "-filter_complex", "[0:v][1:v] overlay=10:main_h-overlay_h-10[vid]", "-c:v","libx264","-c:a","aac", "-map", "[vid]", "-map":''[0:a]" fileoutabsolutepath }

You can use audio codec as copy if you dont want audio to be re-encoded. Also check your image height is not 10 otherwise it will be hidden.

Order of the command needs to be same. Hopefully this will work.

Now if app is still crashing then check log for some clue. May be videofile path or image path is not correct.