在视频中扩展平坦背景

发布于 2025-02-12 15:25:25 字数 1388 浏览 4 评论 0原文

有什么更简单的方法可以实现这一目标吗

? file/1958-colorful-platform-video-set/“ rel =“ nofollow noreferrer”>彩色平台视频集1.8.0

每个视频中间都有系统或控制台,并且具有纯色作为背景。我想保持分辨率为3840x2160,但我需要将图像向右取代15%,以便将左侧的颜色与背景的颜色相同。

这是其中一个视频中的快照:

原始视频的快照

结果应该是结果。这样:

我想获得的视频的快照

到目前为止,我正在尝试很多事情而没有成功,我也许比实际上更难了。我做了一个裁剪视频的第一个脚本:

for %%X in (*.mp4) do .\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -filter:v "crop=2688:ih" -c:a copy -threads 4 "second_script\%%X"

新视频将存储在第二_script文件夹中,然后有第二个脚本将使用ffmpeg来导出视频中的图片,而magick.exe将帮助我识别颜色,之后,它将再次使用ffmpeg添加该颜色,但是...由于某种原因,我不知道颜色结果与

for %%X in (*.mp4) do (
..\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -vf "select=eq(n\,100)" -vframes 1 %%~nX.png

magick.exe .\%%~nX.png -format "%%[hex:u.p{0,0}]" info: > temp.txt

for /f "delims=" %%i in (temp.txt) do (
..\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -filter_complex "[0]pad = w=3840 : h=ih: x=3840-2688 : y=0 : color=#%%i" -movflags +faststart  -c:a copy -threads 4 "final\%%X"
)

)

我所获得的不一样,就是这样:

最终结果,看起来不像我期望的那样

有什么简单的方法吗?任何建议都非常感谢

Is there any easier way to achieve this?, I'd like to make a .bat file that modify 148 videos that are 3840x2160

They belong to the COLORFUL platform video set 1.8.0

Every video has a system or console in the middle of it and it has a plain color as background. I want to keep the resolution, 3840x2160 but I need to displace the image a 15% to the right so it will be neccesary to fill the left area with the same color it's being use as color of the background.

This is a snapshot from one of these videos:

Snapshot of the original video

The result should be something like this:

Snapshot of the video I'd like to get

So far I was trying lot of things with no success, I maybe did it harder than it is really. I did a first script that crop the video:

for %%X in (*.mp4) do .\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -filter:v "crop=2688:ih" -c:a copy -threads 4 "second_script\%%X"

The new video will be stored in the second_script folder, then there is a second script that will use ffmpeg to export a picture from the video and magick.exe will help me to identify the color, after that it will use ffmpeg again to add an are of that color, but ... for some reason I don't know the color result is not the same

for %%X in (*.mp4) do (
..\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -vf "select=eq(n\,100)" -vframes 1 %%~nX.png

magick.exe .\%%~nX.png -format "%%[hex:u.p{0,0}]" info: > temp.txt

for /f "delims=" %%i in (temp.txt) do (
..\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -filter_complex "[0]pad = w=3840 : h=ih: x=3840-2688 : y=0 : color=#%%i" -movflags +faststart  -c:a copy -threads 4 "final\%%X"
)

)

What I get is something like this:

Final result, it doesn't look like I expected

Would there be any easy way to do this? any recommendation is really appreciate

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜灵血窟げ 2025-02-19 15:25:25

您可以在一个命令中执行此操作,例如

ffmpeg -i in.mp4 -vf“ split = 2 [bg] [img]; [bg] trim = end_frame = 1,crop = 128:ih,scale = 3840 :2160:flags =邻居,setsar = 1 [bg]; [bg] [img]覆盖= w = 0.15*w:h = 0“ -c:a副本out.mp4

You can do it in one command, like this

ffmpeg -i in.mp4 -vf "split=2[bg][img];[bg]trim=end_frame=1,crop=128:ih,scale=3840:2160:flags=neighbor,setsar=1[bg];[bg][img]overlay=w=0.15*W:h=0" -c:a copy out.mp4

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文