Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

您好,我如何获取,视频帧实际渲染的宽高是多少? #206

Closed
RAVER0306 opened this issue May 17, 2024 · 11 comments
Closed

Comments

@RAVER0306
Copy link

No description provided.

@RAVER0306
Copy link
Author

或者说,我能在onFrame修改帧的像素内容重新丢进去渲染吗

@wang-bin
Copy link
Owner

mediainfo里有宽高,宽高发送改变有{track, "video", "size", {width, height}}事件

onFrame回调的参数是用户可修改的视频帧。不过对于硬件解码我没提供接口访问gpu资源,你得用软解或VideoFrame.to()转为可访问的资源。

@RAVER0306
Copy link
Author

原视频尺寸19201080 QQuickItem 大小是 1100700,我想获取你实际绘制内容的宽高是多少,不知道你是如何控制缩放的

@RAVER0306
Copy link
Author

RAVER0306 commented May 18, 2024

image
我目前是这样计算你实际绘制的宽高来控制缩放偏移的,发现偏差有点大

@wang-bin
Copy link
Owner

默认是按 视频宽高比 * MediaInfo.video[].codec.par 缩放到setVideoSurfaceSize设置的大小的。你也可以用其他缩放模式 setAspectRatio

@RAVER0306
Copy link
Author

默认是按视频宽高比 * MediaInfo.video[].codec.par 缩放到 setVideoSurfaceSize 设置的大小的。您也可以使用其他缩放模式 setAspectRatio

好嘞,我试试

@RAVER0306
Copy link
Author

RAVER0306 commented May 18, 2024

是不是因为像素对齐导致的误差,我看网上说h.264是16像素对齐

@wang-bin
Copy link
Owner

没关系

@wang-bin wang-bin closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
@wang-bin
Copy link
Owner

我关了,这个不是issue,应该开discuss

@RAVER0306
Copy link
Author

image
image

还请留步,我在onFrame里面to save了,第二张图片是to save的,第一张是绘制显示的,可以明显看到高度不一致了

image

你会进行裁剪吗

@wang-bin
Copy link
Owner

save只用宽高没用par,所以可能不一样。par信息我可能每写进图片里。
渲染不裁剪,除非你设crop相关的aspectratio

你可以在讨论里开个话题。开issue和讨论注意模板,比如提供日志,否则会浪费很多时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants