[FFmpeg-devel] [PATCH, v2 3/3] lavc/libvpxenc: add dynamic resolution encode support for libvpx
James Zern
jzern at google.com
Thu Aug 1 02:15:09 EEST 2019
Hi,
On Tue, Jul 30, 2019 at 10:06 PM Linjie Fu <linjie.fu at intel.com> wrote:
> [...]
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index feb52ea..800ba18 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -1067,6 +1067,15 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
> int res, coded_size;
> vpx_enc_frame_flags_t flags = 0;
>
> + if (frame && (avctx->width != frame->width ||
> + avctx->height != frame->height)) {
> + avctx->width = frame->width;
> + avctx->height = frame->height;
> +
> + avctx->codec->close(avctx);
You shouldn't need to destroy the encoder for a resolution change,
unless I'm missing something. Take a look at resize_test.cc [1].
[1] https://chromium.googlesource.com/webm/libvpx/+/refs/heads/master/test/resize_test.cc#305
More information about the ffmpeg-devel
mailing list