I am working on add watermark on video file in android with the use of ffmpeg jni what i have not found any solution for the same . i am using this command "ffmpeg -i alldone.mp4 -i cancel_bttn.png -filter_complex "overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2" record.mp4 " but this was not worked.
Related
I try to concatenate two videos using ffmpeg I use that wrapper: wrapper.
According docs I use this commands :
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i concat:"intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
After two command I got two files:
/storage/emulated/0/recorder/test1_convert.ts /storage/emulated/0/recorder/test2_convert.ts
But when I execute the third command I got failure: log message: concat:"/storage/emulated/0/recorder/test1_convert.ts|/storage/emulated/0/recorder/test2_convert.ts": No such file or directory
I suppose something wrong with syntax absolute path. This is full my third command:
Remove the double-quotes in the concat line.
I am not an Android user but quoting seems to be a typical problem on Android when using ffmpeg.
I am using ffmpeg in android for create video from multiple images, it has done and now i want to add more images in generated video. i found many times but not getting any proper command in ffmpeg for that.please help
Try using this command,
1.
ffmpeg -y -framerate 1/2 -start_number 1 -i img/%1d.jpg -vf scale=720:756 -c:v libx264 -r 10 -pix_fmt yuv420p videos.mp4
If you want to add watermark image to your generated video, you can use this one:
2.
ffmpeg -i videos.mp4 -i watermark_img.jpg -filter_complex "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy watermark_videos.mp4
In order to create video from random images, You have to keep all images in dir called img, as you can see in first command, and just name all images in the dir, like: 1.jpg,2.jpg...N.jpg,etc , you have to name all the images in sequential number format, which is required by the ffmpeg command as you can see in the first command -i img/%1d.jpg , here -start_number 1 indicates it should start from image preceding with 1 number, and go on with all the images stored in img/ dir, sequentially.
In order to understand the ffmeg command please read all of it's CLI parameters:
man ffmpeg
OR
ffmpeg --help
I am trying to watermark a video using FFMPEG4Android.
I am using the app on the android market from here.
The command used is
ffmpeg -i /sdcard/videokit/in.mp4 -i /sdcard/videokit/logos/1.png -i
/sdcard/videokit/logos/2.png -i /logos/3.png -filter_complex
"[0:v][1:v]
overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,0,1)'
[tmp]; [tmp][2:v]
overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,2,3)'
[tmp2]; [tmp2][3:v]
overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,4,5)'"
/sdcard/videokit/output.mp4
But everytime I run the command the app fails
Opening an output file:
overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,0,1)'.
No such filter: '' Error configuring filters. exit_program: 1
Can I get any help for the same?
You need to use complex command, check the ffmpeg4android blog for examples
I am trying to use ffmpeg library for mixing two MP3 or wav audio files using the commands available that I searched over Internet like given below:
ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex amerge -c:a libmp3lame -q:a 4 output.mp3
From link How to overlay two audio files using ffmpeg
Also, tried some many other solutions given on the different forms.
But none of them is working for the the library downloaded from link:
https://github.com/hiteshsondhi88/ffmpeg-android-java.
But when I am trying to run the commands available on the intener, in some commands I am getting different different error like,
-- Unable to find suitable output format for 'ffmpeg' ffmpeg: Invalid argument
And I also tried one more command,
String res = "ffmpeg -y -i " + a.getAbsolutePath() + " -i " + b.getAbsolutePath() + " -filter_complex '[0:0][1:0] amix=inputs=2:duration=longest' -c:a libmp3lame " + c.getAbsolutePath();
It's giving error, No such filter:" Error configuring filters.
What is your version of FFmpeg?
I believe it's old and that's why it's not working.
First setp download newest version from official site try if your command it's working if yes than find another (or build your own) compiled for android executable file
Well First check your FFmpeg version. The way you have used the amix filter have to be changed. amix filter mix audios. So following is what I'm suggesting.
ffmpeg -i input_audio1 -i input_audio2 -filter_complex "aevalsrc=0:d=10[s1];
[s1][1:a]concat=n=2:v=0:a=1[ac1];
[0:a][ac1]amix[aout]" -map [aout] -c:a libmp3lame output_audio
you can append a silent audio which duration is same as the first audio and them use amix over them. So the original audio's will not overlap. aevalsrc will create a silent audio with a duration of 10 sec. Also you need to select appropriate codec for your output accordingly. You can find those codec here.
Hope this helps!
I know it's been some time since this question was posted, but I think your main problem is that you shouldn't include "ffmpeg" on your string.
So your cmd line would be:
String res = "-y -i " + a.getAbsolutePath() + " -i " + b.getAbsolutePath() + " -filter_complex '[0:0][1:0] amix=inputs=2:duration=longest' -c:a libmp3lame " + c.getAbsolutePath();
I am using a static compiled lib of FFMPEG gotten from BAMBUSER for android.
The problem I am facing now is that FFMPEG version gotten from BAMBUSER does not support watermarking.
ffmpeg -sameq -i mirror_watermark.mp4 -vf "movie=mirror_watermark.png [logo]; [in][logo] overlay=main_w-overlay_w:main_h-overlay_h [out]" output.mp4
No such filter: 'movie'
./configure --list-filters | grep movie
returns nothing
So I guess I have to use a newer version of FFMPEG but I do not know how to get started since with the BAMBUSER everything was already set I just added certain encoders and decoders to their script.
I used this as a reference for compiling newer FFMPEG version which supports watermarking:
https://github.com/guardianproject/android-ffmpeg
You can Use -overlay for it. This Will Add Your Watermark on a Particular position on the image or video as per dimensions.
Use below command:
-ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4