Comments (3)
the second linesize should be 960
.
04-08 03:43:42.924 I videoFrame.planeCount: 2, format: nv12
04-08 03:43:42.924 I i: 0 linesize: 1920 height: 1080
04-08 03:43:42.926 I i: 1 linesize: 1920 height: 1080
If I copy with hard code, it will be OK.
void onFrame(AVFrame *frame) {
if (videoSink == nullptr) {
return;
}
auto fmt = getFormat((AVPixelFormat)frame->format);
QVideoFrame videoFrame({QSize(frame->width, frame->height), fmt});
videoFrame.map(QVideoFrame::WriteOnly);
memcpy(videoFrame.bits(0), frame->data[0], 1920 * 1080);
memcpy(videoFrame.bits(1), frame->data[1], 1920 * 1080 / 2);
videoFrame.unmap(); // TODO use drm prime
emit videoSink->videoFrameChanged(videoFrame);
}
from ffmpeg-rockchip.
Finally solved by
void onFrame(AVFrame *frame) {
if (videoSink == nullptr) {
return;
}
auto fmt = getFormat((AVPixelFormat)frame->format);
QVideoFrame videoFrame({QSize(frame->width, frame->height), fmt});
videoFrame.map(QVideoFrame::WriteOnly);
for (int i = 0; i < videoFrame.planeCount(); i++) {
memcpy(videoFrame.bits(i), frame->data[i], videoFrame.mappedBytes(i));
}
videoFrame.unmap(); // TODO use drm prime
emit videoSink->videoFrameChanged(videoFrame);
}
But I still don't know how to get buffer from avframe by ffmpeg way.
from ffmpeg-rockchip.
the second linesize should be 960.
It is a semi-planar format, U and V are interleaved, so the 2nd linesize should be 1920.
1.5: bytes_per_pixel of NV12
Y buf: 1920xAlign(1080)x1.5=3133440 (+128=3133568) //<= calc by MPP runtime
UV buf: 1920xAlign(540)x1.5=1566720
See this func for more info
ffmpeg-rockchip/libavutil/hwcontext_rkmpp.c
Line 192 in ba84e56
from ffmpeg-rockchip.
Related Issues (20)
- Using with Photoprism HOT 1
- use scale_rkrga filter error in rk3588(ubuntu22.02 desktop) HOT 2
- Questions about cross-compilation HOT 7
- use filter scale_rkrga failed in rk3588(ubuntu22.02 desktop) HOT 1
- 使用av_read_frame进行rtsp拉流阻塞的问题 HOT 2
- crashes - various errors HOT 4
- Compile into static form HOT 1
- Error native compilation in Armbian 5.10.160-legacy-rk35xx HOT 1
- 当摄像头设备分辨率为1920x1080时,tbr帧率识别错误? HOT 1
- undefined reference to ff_h264_* HOT 4
- Segmentation fault: mpp_buffer_group_init HOT 7
- The problem of Chinese garbled code in drawtext HOT 1
- 当前支持rk3528处理器吗? HOT 3
- SIG11 when running ffmpeg HOT 4
- h264_rkmpp 接收 rawvideo 灰度图数据失败。Failed to get key input frame from packet meta: -1 HOT 2
- RK3588测速问题 HOT 2
- (Cannot open video device /dev/video0: No such device) HOT 12
- The encoder of rkmpp is not working HOT 2
- segfault with h,264 encode HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffmpeg-rockchip.