ffmpeg watermark - android

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

Related

How to use only 'concat' feature of ffmpeg and disable other components in Android?

I want to use ffmpeg library in my Android application to concatenate mp4 videos. After lots of research I choose ffmpeg-kit to work with ffmpeg. The problem is that the apk size with the library is large and I want to reduce it. As described here I have to disable unused components of ffmpeg, but I don't know what components I do need and what I don't. I started with adding these lines to ffmpeg.sh file of ffmpeg-kit but, it didn't work:
--disable-everything \
--enable-avcodec \
--enable-avformat \
--enable-ffmpeg \
I got the error below when executingffmpeg -f concat -safe 0 -i mp4_parts.txt -c copy output.mp4 command:
Unrecognized option 'safe'
I added those lines with no reason but to find out the right components that I need.
So my question is that what components do I need to enable for using the concat feature of ffmpeg? Thanks

ffmpeg - 'No such file or directory' though the file exists

I am running following command to extract audio from videos and merge them into a single file:
-y -hide_banner -i /storage/emulated/0/Videos/video_4.mp4 -i /storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20210430-WA0010.mp4 -i /storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20210430-WA0052.mp4 -filter_complex [0:a]atrim=duration=1119.028,volume=1[a_0];[1:a]atrim=duration=84.057,volume=1[a_1];[2:a]atrim=duration=278.029,volume=1[a_2];[a_0][a_1][a_2]concat=n=3:v=0:a=1[audio] -map [audio] -acodec aac -vn /storage/emulated/0/Videos/audio.aac
But ffmpeg says
/storage/emulated/0/Videos/video_4.mp4: No such file or directory
I can ensure that the file exist on that specified path. What might cause the issue?
Note: The same error occures for some other comands too, but in all the cases the video file exist in the specified path.
I had the same problem, I installed it using snap.
So, as a solution, I tried uninstalling using remove and purge, and then I used mv /snap/bin/ffmpeg /snap/bin/ffmpeg_old.
Then I installed using apt-get install ffmpeg, and worked. I guess the problem was the version of ffmpeg.

Command in ffmpeg for merge image and generated video

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

Image overlay fails using FFMPEG4Android

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

ffmpeg commands for merge the image with video file in android

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.

Categories

Resources