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

Wenpeng Zhou zhou.wenpeng at rdnet.fi
Wed Oct 31 13:48:04 CET 2012

Hi Carl,

Thanks for your reply!

I mean this command.
ffplay -f dshow -i video="Mercury USB2.0 Camera" -s 640x480

How can we set 640x480 in C++ code?

-----Original Message-----
From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org]
On Behalf Of Carl Eugen Hoyos
Sent: 31. lokakuuta 2012 14:34
To: libav-user at ffmpeg.org
Subject: Re: [Libav-user] How can we set frame size for live stream?

Wenpeng Zhou <zhou.wenpeng at ...> writes:

> 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. 

If your question is:
"How can I convince the decoder to output the frames that where originally
encoded with a size of 1280x720 as 640x480, ie how can the decoder do a
Then the answer is: This is generally impossible, a decoder outputs the
frame that was encoded, there is libswscale (or the scale filter that uses
libswscale) to do the resizing.

There is an exception though:
You can use -lowres 1 with some decoders (for example mjpeg
iirc) to decode with lower resolution (and quality!) and faster speed to
"half" (actually quarter) resolution, in your case that would be 640x360.
(I don't think this is what you are searching for, but it is useful on very
low-end hardware.)

Carl Eugen

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

More information about the Libav-user mailing list