[Libav-user] Change a Resolution of a Video
Bearak, Arnold - 0999 - MITLL
abearak at ll.mit.edu
Wed Apr 27 21:48:35 CEST 2011
Here is a link that gives a definition of what the stride is.
Not sure about why you cannot convert to a width that is bigger than the stride.
From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Diego Carvalho Domingos
Sent: Wednesday, April 27, 2011 3:22 PM
To: libav-user at ffmpeg.org
Subject: [Libav-user] Change a Resolution of a Video
Is it possible to change a resolution of a video using libavcodec? In
my case, I want to change the resolution of a h264 video from 320 x
240 to 640 x 480. I basically made some changes in the api-example.c.
I'm trying to decode the video (using avcodec_decode_video2) and
reenconde it (using avcodec_encode_video, with ffmpeg compiled with
--enable-libx264), using CODEC_ID_H264 and setting the AVCodecContext
CodecCtx->bit_rate = 400000;
CodecCtx->width = 640;
CodecCtx->height = 480;
CodecCtx->time_base.num = 1;
CodecCtx->time_base.den = 25;
CodecCtx->me_range = 16;
CodecCtx->max_qdiff = 4;
CodecCtx->qmin = 10;
CodecCtx->qmax = 51;
CodecCtx->qcompress = 0.6;
CodecCtx->gop_size = 10;
CodecCtx->pix_fmt = PIX_FMT_YUV420P;
but I'm receiving the following error:
Input picture width (640) is greater than stride (352)
I didn't understand because my input is a 320 x 240 video.
Actually, if I don't change the resolution (I mean, set
CodecCtx->width to 320 and CodecCtx->height to 240) the video is
reencoded but with a really bad quality, so probably the settings are
wrong (I found them on the internet). I'm new using libavcodec, so I
apreciate any help. Thanks in advance.
Libav-user mailing list
Libav-user at ffmpeg.org
More information about the Libav-user