美文网首页
音视频流媒体开发【四十四】FFmpeg媒体转换器8-scale

音视频流媒体开发【四十四】FFmpeg媒体转换器8-scale

作者: AlanGe | 来源:发表于2023-04-12 20:48 被阅读0次

    音视频流媒体开发-目录
    iOS知识点-目录
    Android-目录
    Flutter-目录
    数据结构与算法-目录
    uni-pp-目录

    对应代码:ffmpeg-pro-10

    解析命令:
    ffmpeg -i 10.mp4 -vf scale=iw/2:ih/2 10.flv -y
    
    重点是理解对应输出尺⼨的变化,导致2个问题:
    1. buffersink最终输出的frame尺⼨和buffer输⼊的时候不同
      configure_filtergraph()函数:
      avfilter_graph_parse2()
      ofilter->width = av_buffersink_get_w(sink);
      ofilter->height = av_buffersink_get_h(sink);
    2. 视频编码时输⼊的宽⾼需要调整
      init_output_stream_encode()
      enc_ctx->width = av_buffersink_get_w(ost->filter->filter);
      enc_ctx->height = av_buffersink_get_h(ost->filter->filter);
      enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio =
      ost->frame_aspect_ratio.num ? // overridden by the -aspect cli option
      av_mul_q(ost->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width })
      :
      av_buffersink_get_sample_aspect_ratio(ost->filter->filter);

    相关文章

      网友评论

          本文标题:音视频流媒体开发【四十四】FFmpeg媒体转换器8-scale

          本文链接:https://www.haomeiwen.com/subject/mlnpddtx.html