Okay, I am pretty new to using ffmpeg but not new to video editing itself--I have only recently reluctantly began stepping away from VirtualDub because it doesn't play well with the newest video formats.
What I want to do: I have two copies of a video file--one is 1280x720 but has a logo approx. 120x80 in one corner. The other is 640x360 but is clean. I know how to use a mask file and removelogo to blur the logo out on the higher resolution file, but it still looks messy with the blurring. What I would like to do just to see if it looks better is to take the matching 120x80 square from the lower resolution video and resize it and overlay it over the logo on the higher resolution file. I had no problem cropping the section out of the lower resolution file, but I can't figure out how to overlay it onto the higher resolution one. I have googled up tutorials such as this one, but I haven't been able to get it to work.
One major issue with the syntax is that the command uses semicolons. I am using ffmpeg Media Encoder for Android and it will not let me use semicolons! I try to type one in and it doesn't show up. I type up the command in a text editor and if it has a semicolon in it, it won't paste the whole command. So I guess my problem is two-fold--the syntax to use and if there is some bug in ffmpeg Media Encoder for Android that will not allow me to input that command.
+ Reply to Thread
Results 1 to 5 of 5
I've done this with AviSynth. The closest I have with ffmpeg is a command which overlays an animated GIF. You can probably modify it to overlay a crop from a second video instead:
ffmpeg.exe -y -i input.mp4 -ignore_loop 0 -i loop.gif -filter_complex "overlay=W-250:H-250" -acodec copy output.mp4
Regarding using "special" characters, you probably have to "escape" them. I don't know what the escape character is for Android but it's often something like \, ~, ^, etc. So something like "yada:yada" would be "yada\:yada". Or you may need to use hex "yada%3ayada".
Last edited by jagabo; 15th Feb 2020 at 08:33.
Adding to Jagabo's script, I have added one that takes into Time displayed, resize of image and main video and re-encoding parameters.
The final video I wanted in this script is a video 568x320 with an overlay of 105:70 at bottom center.
ffmpeg -i c:\users\bud\desktop\UnderwaterMusic480p.mp4 -i c:\users\bud\desktop\TransparentBG.mp4 -filter_complex "scale=105:70[pip]; [pip] overlay=main_w-overlay_w-195:main_h-overlay_h-0:enable='between(t,1,10)'" -profile:v main -level 3.1 -t 120 -b:v 440k -ar 44100 -ab 128k -s 568x320 -vcodec libx264 -acodec aac -y PIP_output1.mp4
2. main_w-overlay_w-195:main_h-overlay_h-0 Uses relative positioning. You can substitute 640:480 in its place as hard placement
3. enable='between(t,1,10) Displays overlay for time 1 second thru 10 seconds if tyou want whole movie, omit it.
4. -t 120 Length of movie to create with overlay. It should be Main videos length in seconds or HH:MM:SS.mmm format
5. a movie or image such as png can be used as second -i input
What you get is:
[Attachment 52023 - Click to enlarge]
I haven't had a chance to play around much with the suggestions yet, but I have discovered other Android ffmpeg shells that do accept semicolons, so thanks for the tips. Thanks especially for the news on VirtualDub--I had no forking idea that there was a new fork--I thought the whole project had been abandoned years ago, and have been still using a years-old version.