Answer the question
In order to leave comments, you need to log in
How to add frame picture to video in linux?
Initial data: There are many videos of different sizes, there is a PNG in the form of a TV
Purpose: To get videos of the type of the original video that is shown on TV.
Additional condition: since there are a lot of videos, I would like to automate the process, that is, a console script would be ideal, which can then be pushed into a
loop video
I understand that as an option , you can use the scheme:
1. resize all videos to a certain size using ffmpeg
2. the same ffmpeg can be used on frame overlays as a watermark
But I don’t understandhow to do 2 points:
1. how to make the video after resizing have a small margin of space on the edge so that the TV frame after overlaying in the form of a watermark is not on top of the video, but around it
2. the TV screen is not in the center of PNG, but if you add white frames into the picture to align the screen to the center of the picture, this will be to the detriment of the size of the already reduced video. So the video also needs to be slightly shifted relative to the center of the picture a little to the side and in height.
Answer the question
In order to leave comments, you need to log in
came to this solution
1. pad filter helps to set the actual size of the video 1454:899 (picture size) into which the video fits 1280:720 with an offset of 83:79 (the coordinates of the upper left point of the screen on the TV picture), the rest of the space is filled with black
ffmpeg - i ./input.mp4 -vcodec mpeg4 -vb 2500k -acodec copy -vf "scale=1280:720,pad=1454:899:83:79:black,unsharp" -y
middle.mp4
ffmpeg -i ./middle.mp4 -vcodec mpeg4 -vb 2500k -acodec copy -vf "movie=watermark.png [wm]; [in][wm] overlay=0:0 [out]" -y output.mp4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question