|
发表于 2014-4-23 17:21:40
|
显示全部楼层
- ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
- if (ret < 0) {
- fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
- return ret;
- }
- if (*got_frame) {
- printf("video_frame%s n:%d coded_n:%d pts:%s\n",
- cached ? "(cached)" : "",
- video_frame_count++, frame->coded_picture_number,
- av_ts2timestr(frame->pts, &video_dec_ctx->time_base));
- /* copy decoded frame to destination buffer:
- * this is required since rawvideo expects non aligned data */
- av_image_copy(video_dst_data, video_dst_linesize,
- (const uint8_t **)(frame->data), frame->linesize,
- video_dec_ctx->pix_fmt, video_dec_ctx->width, video_dec_ctx->height);
- /* write to rawvideo file */
- fwrite(video_dst_data[0], 1, video_dst_bufsize, video_dst_file);
- }
复制代码 参考一下 |
|