【发布时间】:2015-03-31 18:57:09
【问题描述】:
我正在尝试使用原始 YUV 帧数据对 MP4 视频进行编码,但我不确定如何填充平面数据(最好不使用 ffmpeg 等其他库)
帧数据已经I420编码,不需要转换。
这是我想要做的:
const char *frameData = /* Raw frame data */;
x264_t *encoder = x264_encoder_open(¶m);
x264_picture_t imgInput, imgOutput;
x264_picture_alloc(&imgInput, X264_CSP_I420, width, height);
// how can I fill the struct data of imgInput
x264_nal_t *nals;
int i_nals;
int frameSize = x264_encoder_encode(encoder, &nals, &i_nals, &imgInput, &imgOutput);
我找到的等效命令行是:
x264 --output video.mp4 --fps 15 --input-res 1280x800 imgdata_01.raw
但我无法弄清楚应用程序是如何做到的。
谢谢。
【问题讨论】:
-
@mpromonet 我已经检查了这个问题,但示例使用的是
swscale,并且也没有提供将现有 YUV 数据映射到 x264_picture_t 的方法。谢谢