Today, we show how to pan a static video using ffmpeg. The concept behind panning a video with ffmpeg is to move a larger video in front of a smaller background video. All parameters can be customized to move a video right to left, left to right, up to down, down to up...
EXAMPLES
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
❶ Downscale & pan
→ ffmpeg -i input.mp4 -i input.mp4 -filter_complex "[0:v]scale=1280:720[bg];[bg][1:v]overlay=-640+t*64:-280[out]" -map [out] -map 0:a output01.mp4
with:
-i input.mp4 = Reads file «input.mp4» and …
-i input.mp4 = … and reads file «input.mp4» a second time (to create our overlay)
-filter_complex = … then starts a «complex» video filter, where…
[0:v]scale=1280:720[bg] = … the first video stream is scaled down to 1280x720... with result called [bg] … That will be our background (visible zone)!
[bg][1:v]overlay = … then, overlays the bigger (1920x1080)second video stream [1:v] on top of the background video [bg]…
-640+t*64:-280 = … with the overlay video position set to x = -640+t*64 and y = -280.
-640 = start position of the overlay ( 1920 – 1280 = 660 ) bigger than 640
t = number of seconds 0, 1, 2…
64 = number of steps on the x axis (per seconds)
[out] = …calling the result [out] …
-map [out] -map 0:a = «Stitches back» together the modified [out] video and the original input audio stream …
output01.mp4 = … and outputs the result to file «output01.mp4»
Note: It kinda works, but the overlay shows a jittery movement (similar to when zooming into a picture with ffmpeg). This will be solved in our next example.
❷ Downscale & pan, jitter fix
→ ffmpeg -i input.mp4 -i input.mp4 -filter_complex "[0:v]scale=10*1280:10*720[bg];[1:v]scale=iw*10:ih*10[fg];[bg][fg]overlay=-6400+t*640:-1680[tmp];[tmp]scale=iw/10:ih/10[out]" -map [out] -map 0:a output02.mp4
with:
-i input.mp4 = Reads file «input.mp4» and …
-i input.mp4 = … and reads file «input.mp4» a second time (to create our overlay)
-filter_complex = … then starts a «complex» video filter, where…
[0:v]scale=10*1280:10*720 = … the first video stream is scaled to 12800x7200
[bg] = … with result called [bg] … That will be our background (visible zone)!
[1:v]scale=iw*10:ih*10 = … the second video stream is scaled to 19200x10800 (iw = input width, ih = input height)
[fg] = … with result called [fg] … That will be our foreground (moving video)!
[bg][fg]overlay = … then, overlays the foreground video stream [fg] on top of the background [bg]…
-6400+t*640:-1680 = … with the overlay video position set to x = -6400+t*640 and y = -1680
[tmp] = … with result called [tmp]...
[tmp]scale=iw/10:ih/10 = …downscaling the [tmp] video by a factor 10 …
[out] = …calling the result [out] …
-map [out] -map 0:a = «Stitches back» together the modified [out] video and the original input audio stream …
output02.mp4 = … and outputs the result to file «output02.mp4»
❸ Upscale & pan
→ ffmpeg -i input.mp4 -i input.mp4 -filter_complex "[1:v]scale=iw*12:ih*12[fg];[0:v]scale=iw*10:ih*10[bg];[bg][fg]overlay=-3840+t*380:0[tmp];[tmp]scale=iw/10:ih/10[out]" -map [out] -map 0:a output03.mp4
with:
-i input.mp4 = Reads file «input.mp4» and …
-i input.mp4 = … and reads file «input.mp4» a second time (to create our overlay)
-filter_complex = … then starts a «complex» video filter, where…
[1:v]scale=iw*12:ih*12 = … the second video stream is scaled to 12 x 1920x1080 (iw = input width, ih = input height)
[fg] = … with result called [fg] … That will be our foreground (moving video)!
[0:v]scale=10*1280:10*720 = … the first video stream is scaled to 12800x7200 (iw = input width, ih = input height)
[bg] = … with result called [bg] … That will be our background (visible zone)!
[bg][fg]overlay = … then, overlays the foreground video stream [fg] on top of the background [bg]…
-3840+t*380:0 = … with the overlay video position set to x = -3840+t*380 and y = 0
[tmp] = … with result called [tmp]...
[tmp]scale=iw/10:ih/10 = …downscaling the [tmp] video by a factor 10 …
[out] = …calling the result [out] …
-map [out] -map 0:a = «Stitches back» together the modified [out] video and the original input audio stream …
output03.mp4 = … and outputs the result to file «output03.mp4»
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Catch up with the FFMPEG guy Channel
• ALL THE VIDEOS FROM THE CHANNEL
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
MUSIC
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Cylinder Eight by Chris Zabriskie is licensed under a Creative Commons Attribution 4.0 license. https://creativecommons.org/licenses/...
→ Source: http://chriszabriskie.com/cylinders/
→ Artist: http://chriszabriskie.com/
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
Ask the FFMPEG guy
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
Смотрите видео How to pan a static video | Dynamic video panning with ffmpeg онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь The FFMPEG guy 05 Сентябрь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,191 раз и оно понравилось 30 людям.