My TV is old and for some reason clips some content off of the left edge. I'm trying to show a video on it in which the left edge is vital to the presentation.
Is there some way (with iMovie/ffmpeg/Gimp etc) that I can shrink the video size and surround it with a thick black border, so that this border is clipped when viewing it on my TV, rather than the content?
In other words, I want to go from this:
to this:
But I want to do that with a video (in mp4 format).
Answer
Method 1: Fixed size scale with padding:
ffmpeg -i inputfile.mov -filter_complex 'scale=578:462, pad=720:576:71:57' outputfile.mp4
This assumes SD PAL size input and output. This simply uses a fixed size pad.
Method 2: Percentage scaling with overlay on top of black generated by filter:
ffmpeg -y -i inputfile.mov -f lavfi -i color=c=black:s=1920x1080 \
-filter_complex "[0:v]scale=w=0.80*iw:h=0.80*ih[scaled]; \
[1:v][scaled]overlay=x=0.10*main_w:y=0.10*main_h:eof_action=endall[out]; \
[0:a]anull[aud]" \
-map "[out]" -map "[aud]" \
-strict -2 \
outputfile.mp4
This assumes input and output size to be full HD (1920x1080). The scaling is by 80 percent. So the overlay position is 20 percent inside- but since this 20 is divided on both sides equally, the overlay uses 10 percent of main width and adds that to x position.
The eof_action
is required so that when the video file ends processing can stop. Else the generated black (background) from -f lavfi
will just keep on going.
No comments:
Post a Comment