V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
bihui
V2EX  ›  FFmpeg

ffmpeg 转换 h265 4k 视频的问题,尺寸小于 1280 就 ok!

  •  
  •   bihui · 2020-06-03 17:08:26 +08:00 · 3482 次点击
    这是一个创建于 1415 天前的主题,其中的信息可能已经有所发展或是发生改变。
    原始文件是 h265 的,转换就是普通的转换命令,但是只要输出尺寸大于 1280 就提示

    原始尺寸是大于 3800x3800 的。

    Error initializing output stream 0:0 --
    Error while opening encoder for output stream #0:0 (Video) -
    maybe incorrect parameters such as bit_rate, rate, width or height

    这个错误我郁闷了好几个月了,今天又遇到。
    3 条回复    2020-08-20 16:25:46 +08:00
    aliofwind
        1
    aliofwind  
       2020-06-03 17:13:19 +08:00
    命令参数是什么,这个报错看起来是参数冲突之类的
    hardwork
        2
    hardwork  
       2020-06-03 21:39:57 +08:00
    ffmpeg 命令行吗,发出来看看
    hungkuishing
        3
    hungkuishing  
       2020-08-20 16:25:46 +08:00
    视频编码器 open 失败就会报这个错,ffmpeg 代码如下:

    if ((ret = avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 0) {
    if (ret == AVERROR_EXPERIMENTAL)
    abort_codec_experimental(codec, 1);
    snprintf(error, error_len,
    "Error while opening encoder for output stream #%d:%d - "
    "maybe incorrect parameters such as bit_rate, rate, width or height",
    ost->file_index, ost->index);
    return ret;
    }

    一些编码器对输入的宽高、码率有限制,如果参数不符合编码器要求,就会导致 open 失败,比如
    H.261 需要输入的视频分辨率是 176x144 或者 352x288 ;
    H.263 需要输入的视频分辨率是 128x96, 176x144, 352x288, 704x576, 或者 1408x1152 。

    你可以把命令行、以及终端打印贴出来,方便定位问题。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5424 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:39 · PVG 14:39 · LAX 23:39 · JFK 02:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.