[Libav-user] How can we set frame size for live stream?

Wenpeng Zhou zhou.wenpeng at rdnet.fi
Tue Nov 6 10:51:39 CET 2012

>-----Original Message-----
>From: libav-user-bounces at ffmpeg.org [mailto:libav-user-
>bounces at ffmpeg.org] On Behalf Of Stefano Sabatini
>Sent: 6. marraskuuta 2012 2:32
>To: This list is about using libavcodec, libavformat, libavutil,
libavdevice and
>Subject: Re: [Libav-user] How can we set frame size for live stream?
>> Hi,
>> I use the USB camera to capture live video.
>> The default codec context is:
>> Input #0, dshow, from 'video=Mercury USB2.0 Camera':
>>   Duration: N/A, start: 58890.453000, bitrate: N/A
>>     Stream #0:0: Video: mjpeg, yuvj422p, 1280x720, 30 tbr, 10000k tbn,
>> 30 tbc
>> I hope to change frame size from 1280x720 to 640x480.
>> I tried
>> AVCodecContext
>> pCodecCtx->width = 640;
>>   pCodecCtx->height = 480;
>> But this did not work.
>You can set the options in the dshow device, using the *private* option
>Note that the input device may not honour the exact video size, or may
>choose a video size that is "reasonably" similar to the one requested (need
>check the code for that, documentation updates are welcome).
>From a programmatic point of view, you need to set the options for the
>format context in a dictionary and pass it to avformat_open_input(),
>something like:
>AVDictionary *options = NULL;
>av_dict_set(&options, "video_size", "640x480", 0); av_dict_set(&options,
>"pixel_format", "rgb24", 0);
>if (avformat_open_input(&s, url, NULL, &options) < 0)
>   abort();
>Check avformat.h doxy for more information.

Hi Stefano,

Thanks very much !
This is really what I want. 

>Libav-user mailing list
>Libav-user at ffmpeg.org

More information about the Libav-user mailing list