On Tue, Jan 18, 2011 at 7:54 AM, Leandro Santiago <[email protected]
> wrote:

> Hello to all.
> I'm using libav to get images from my webcam.
>
> The resolution of the device is 640x480px.
>
> When I generate the video in this resolution, the video frames are ok. The
> same happens when I scale the frame to a larger size (1024x768, etc.).
>
> But if I scale the frames to smaller sizes like 160x120 or 320x240, the
> resulting frames have green bands on the image bottom.
>
> The original frame size is 640x480:
> http://dl.dropbox.com/u/3550969/cap640x480.png
>
> The frame in 1024x768:
> http://dl.dropbox.com/u/3550969/cap1024.png
>
> And finally, the frame in smaller resolutions:
> 160x120:
> http://dl.dropbox.com/u/3550969/cap160x120.png
>
> 400x300:
> http://dl.dropbox.com/u/3550969/cap300x400.png
>
> And the code I'm using is in:
> http://ffmpeg.pastebin.com/ri1QxTB7
>
> FFMPEG Version;
>
> Fmpeg version git-svn-r25853, Copyright (c) 2000-2010 the FFmpeg developers
>  built on Nov 30 2010 16:13:52 with gcc 4.4.5
>  configuration: --disable-gpl --enable-static --enable-libvpx
> --enable-pthreads --disable-stripping --enable-libschroedinger
> --enable-libtheora --prefix=/home/tenchi/projects/3rd/build/
>  libavutil     50.33. 0 / 50.33. 0
>  libavcore      0.14. 0 /  0.14. 0
>  libavcodec    52.97. 2 / 52.97. 2
>  libavformat   52.87. 1 / 52.87. 1
>  libavdevice   52. 2. 2 / 52. 2. 2
>  libavfilter    1.65. 0 /  1.65. 0
>  libswscale     0.12. 0 /  0.12. 0
>
> Why do this happen? How can I scale a frame to a smaller size?
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>

Don't forget that your destination format (YUV420P) is split into three
planes of data.  You need to pass in the correct pointers to each plane and
strides for each plane.

your dstFrame->linesize should be an array of stride sizes

for YUV420P is should look something like


des_stride420p[0] = dest_width ;                // Y DATA width

des_stride420p[1] = dest_width / 2 ;          // U DATA width

des_stride420p[2] = dest_width / 2 ;          // V DATA width



dstFrame->data should also be an array of pointers pointing to each plane of
data.



Hope this helps
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to