雷神的https://blog.youkuaiyun.com/leixiaohua1020/article/details/26838535
文章后附的代码,报错:Cannot open video encoder for stream blabla...
需要修改一下,解决方法来自,烛龙一现,https://blog.youkuaiyun.com/w_z_z_1991/article/details/53002416
“
在transcoding.c
中的open_output_file
函数中,修改的部分如下(只增加了13-17行
):
if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
enc_ctx->height = dec_ctx->height;
enc_ctx->width = dec_ctx->width;
enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
/* take first format from list of supported formats */
if (encoder->pix_fmts)
enc_ctx->pix_fmt = encoder->pix_fmts[0];