[Libav-user] How can i extract Y plane from any frame in video

Kirill Gavrilov gavr.mail at gmail.com
Thu Jun 16 09:33:19 CEST 2011

On Thu, Jun 16, 2011 at 10:02 AM, Amir Rouhi-Rmit
<amir.rouhi at rmit.edu.au>wrote:

> I know that i can extract images of a video by ffmpeg as can be seen in
> below command:
> ffmpeg -i input.avi -r 1 -s WxH -f image2 Img-%03d.jpeg
> But what i want is a separated Y plane and cb and cr plane. can i i achieve
> this by ffmpeg? if yes pleas let me now how and if no do you suggest any
> idea?
I'm not sure but it seems there are no ways to extract planes separately
(however separate planes could be used as input ???).

However if you know dimensions and pixel formats you may hack this way for
one frame
(W and H should be replaced with real width / height and math should be
ffmpeg -i input.mkv -vframes 1 -s WxH -f image2 rawimage.yuv
split -b W*H   rawimage.yuv spl-
split -b W*H/4 spl-ab spl2-
ffmpeg -s WxH     -pix_fmt gray -f rawvideo -i spl-aa  frameY.png
ffmpeg -s W/2xH/2 -pix_fmt gray -f rawvideo -i spl2-aa frameU.png
ffmpeg -s W/2xH/2 -pix_fmt gray -f rawvideo -i spl2-ab frameV.png

Sure this too complicated... maybe advanced ffmpeg users will give you more
adequate solution.
Kirill Gavrilov,
Software designer.
<kirill at sview.ru>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110616/3ef921e3/attachment.html>

More information about the Libav-user mailing list