【问题标题】:libx264 encode error Input picture width (40) is greater than stride (0)libx264 编码错误输入图片宽度(40)大于步幅(0)
【发布时间】:2016-04-01 08:03:16
【问题描述】:

我在ffmpeg中使用libx264编码视频,我使用下面的配置。

enCodecContext->bit_rate = 300000;
enCodecContext->width = 80;
enCodecContext->height = 60;
enCodecContext->time_base = (AVRational) {1, 25};
enCodecContext->gop_size = 10;
enCodecContext->max_b_frames = 1;
enCodecContext->pix_fmt = PIX_FMT_YUV420P;
enCodecContext->qcompress = 0.6;
av_opt_set(enCodecContext->priv_data, "preset", "slow", 0);

但是当我用enCodecContext 调用avcodec_encode_video2 时,我收到了错误Input picture width (40) is greater than stride (0)

avcodec_encode_video2(enCodecContext, &filteredAVPacket, pFilteredAVFrame, &got_packet_ptr);

pFilteredAVFrame->widthpFilteredAVFrame->height 分别是 8060

配置libx264 时我是否遗漏了什么?如何获得libx264 的可行配置来编码我的视频?

【问题讨论】:

  • 我看到recent fix 解决了这个问题。也许你的 ffmpeg 不是最新的?
  • @AlexCohn 我的ffmpeg版本是2.8.2,我以为这个版本已经打​​了这个补丁。

标签: ffmpeg video-encoding libx264


【解决方案1】:

x264 没问题。您必须为图像平面填写 AVPicture.linestride 变量。步幅描述了图像在内存中的布局方式。步幅必须至少与图像宽度一样大。在 YUV 4:2:0 的情况下,步幅必须至少是第二个和第三个平面宽度的一半。

https://msdn.microsoft.com/en-us/library/windows/desktop/aa473780(v=vs.85).aspx

【讨论】:

    猜你喜欢
    • 2014-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多