ffmpeg - How do I rotate yuv/rgb image using libav -
i want rotate image decoded using libav
h.264 decoder.
i see ffmpeg
has option -vf transpose
it. want programatically. see there vf_transpose.c
in libavfilter
looks same thing.
i want know how can exercise in code?
edit:
here sample code use decoding::
avcodec *dechd; avcodeccontext *ctxdecode = null; avframe *picturedecoded; avpacket avpkt; /* -------- setup -------- */ avcodec_init(); /* register codecs */ avcodec_register_all(); dechd = avcodec_find_decoder(codec_id_h264); ctxdecode= avcodec_alloc_context(); avcodec_get_context_defaults(ctxdecode); ctxdecode->flags2 |= codec_flag2_fast; ctxdecode->pix_fmt = pix_fmt_yuv420p; ctxdecode->width = cap_width; ctxdecode->height = cap_height; if (avcodec_open(ctxdecode, dechd) < 0) { printf("avcodec: not open h.264 decoder\n"); exit(1); } picturedecoded= avcodec_alloc_frame(); avcodec_get_frame_defaults(picturedecoded); /* -------- decode -------- */ avpkt.size = encoutlen; avpkt.data = nals[0].p_payload; len = avcodec_decode_video2(ctxdecode, picturedecoded, &got_picture, &avpkt); len = avpicture_layout((avpicture *)picturedecoded, ctxdecode->pix_fmt , cap_width, cap_height, decoderout, pic_size);
Comments
Post a Comment