音视频流媒体开发-目录
iOS知识点-目录
Android-目录
Flutter-目录
数据结构与算法-目录
uni-pp-目录
解析命令:
ffmpeg -i 10.mp4 -vf scale=iw/2:ih/2 10.flv -y
重点是理解对应输出尺⼨的变化,导致2个问题:
- buffersink最终输出的frame尺⼨和buffer输⼊的时候不同
configure_filtergraph()函数:
avfilter_graph_parse2()
ofilter->width = av_buffersink_get_w(sink);
ofilter->height = av_buffersink_get_h(sink); - 视频编码时输⼊的宽⾼需要调整
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);
网友评论