Std::cout 100)//cnt data, pic->linesize, 0, ccontext->height, picrgb->data, picrgb->linesize) Stream->sample_aspect_ratio = context->streams->codec->sample_aspect_ratio While(av_read_frame(context,&packet)>=0 & cnt streams->codec->codec) Īvcodec_copy_context(stream->codec,context->streams->codec) Uint8_t* picture_buf2 = (uint8_t*)(av_malloc(size2)) Īvpicture_fill((AVPicture *) pic, picture_buf, PIX_FMT_YUV420P, ccontext->width, ccontext->height) Īvpicture_fill((AVPicture *) picrgb, picture_buf2, PIX_FMT_RGB24, ccontext->width, ccontext->height) Int size2 = avpicture_get_size(PIX_FMT_RGB24, ccontext->width, ccontext->height) Uint8_t* picture_buf = (uint8_t*)(av_malloc(size)) Int size = avpicture_get_size(PIX_FMT_YUV420P, ccontext->width, ccontext->height) PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL) If (avcodec_open(ccontext, codec) width, ccontext->height, ccontext->pix_fmt, ccontext->width, ccontext->height, start reading packets from stream and write them to fileĬodec = avcodec_find_decoder(CODEC_ID_H264) Īvcodec_get_context_defaults3(ccontext, codec) Īvcodec_copy_context(ccontext,context->streams->codec) avio_open2(&oc->pb, "test.mp4", AVIO_FLAG_WRITE,NULL,NULL) AVOutputFormat* fmt = av_guess_format(NULL,"test2.mp4",NULL) ĪVFormatContext* oc = avformat_alloc_context() If(context->streams->codec->codec_type = AVMEDIA_TYPE_VIDEO) Vsnprintf_s(message, sizeof(message), fmt, vargs) Void log_callback(void *ptr, int level, const char *fmt, va_list vargs) For rtsp streams the following is working for me (after receiving frames i save the result to a ppm file): #include
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |