Le ven. 5 avr. 2019 à 13:20, Simon Brown <[email protected]> a écrit :
> On Fri, 5 Apr 2019 at 12:08, NDJORE BORIS <[email protected]> wrote: > >> Hello, >> >> Can someone help me to find the value of each pixel on a given frame, >> please. >> I use frame.data[] and frame.linesize[]. >> Then I do this : >> >> for(int i = 0; i< height; i++) >> { >> >> for(int j=0 ;j<width; j++) >> { >> xy = height*stride + width >> int pix_i,j = frame.data[xy][frame.linesize[xy]]. >> } >> } >> where width and height are the dimension of the frame. >> >> I don't know if what I do is right >> >> I've done it in an older version of FFMpeg, so not sure if it still > applies, but I used: > for (yy=0 ; yy<frame->height ; yy++) { > memcpy(bufs[0]+720*yy, frame->data[0]+(frame->linesize[0])*yy, 720); > } > for (yy=0 ; yy<frame->height/2 ; yy++) { > memcpy(bufs[1]+360*yy, frame->data[1]+(frame->linesize[1])*yy, 360); > memcpy(bufs[2]+360*yy, frame->data[2]+(frame->linesize[2])*yy, 360); > } > I was decoding YUV 422 data, and assuming a width of 720 pixels, copying > it into my own buffers. > The point is that frame->data has arrays for each plane of the decoded > video, and then each plane buffer can get you a pixel value for that plane. > Ultimately you'll probably need more than one value for each pixel, be it > RGB or YUV. > > Simon > Ok, Thanks! But can you tell me how to get the frame pixel format, please? I use frame->format but the output is only zero (0) value. Regards > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
