ffmpeg框架中如何从avframe中获取yuv数据用于测试
avcodec_decode_video2(pstream_info->dec_ctx, pDecodeFrame, &frameFinished,&pkt);
if(frameFinished)
{
if (pstream_info->dec_ctx->pix_fmt == AV_PIX_FMT_YUV420P) //如果是yuv420p的
{
for(i = 0 ; i < pstream_info->dec_ctx->height ; i++)
{
memcpy(video_decode_buf+pstream_info->dec_ctx->widthi,
pDecodeFrame->data[0]+pDecodeFrame->linesize[0]i,
pstream_info->dec_ctx->width);
}
for(j = 0 ; j < pstream_info->dec_ctx->height/2 ; j++)
{
memcpy(video_decode_buf+pstream_info->dec_ctx->widthi+pstream_info->dec_ctx->width/2j,
pDecodeFrame->data[1]+pDecodeFrame->linesize[1]j,
pstream_info->dec_ctx->width/2);
}
for(k =0 ; k < pstream_info->dec_ctx->height/2 ; k++)
{
memcpy(video_decode_buf+pstream_info->dec_ctx->widthi+pstream_info->dec_ctx->width/2j+pstream_info->dec_ctx->width/2k,
pDecodeFrame->data[2]+pDecodeFrame->linesize[2]k,
pstream_info->dec_ctx->width/2);
}
}
else if (pstream_info->dec_ctx->pix_fmt == AV_PIX_FMT_YUV422P)//如果是yuv422p的
{
for(i = 0 ; i < pstream_info->dec_ctx->height ; i++)
{
memcpy(video_decode_buf+pstream_info->dec_ctx->widthi,
pDecodeFrame->data[0]+pDecodeFrame->linesize[0]i,
pstream_info->dec_ctx->width);
}
for(j = 0 ; j < pstream_info->dec_ctx->height ; j++)
{
memcpy(video_decode_buf+pstream_info->dec_ctx->widthi+pstream_info->dec_ctx->width/2j,
pDecodeFrame->data[1]+pDecodeFrame->linesize[1]j,
pstream_info->dec_ctx->width/2);
}
for(k =0 ; k < pstream_info->dec_ctx->height ; k++)
{
memcpy(video_decode_buf+pstream_info->dec_ctx->widthi+pstream_info->dec_ctx->width/2j+pstream_info->dec_ctx->width/2*k,
pDecodeFrame->data[2]+pDecodeFrame->linesize[2]*k,
pstream_info->dec_ctx->width/2);
}
}
else
{
//可扩展
}
video_decode_size = avpicture_get_size(pstream_info->dec_ctx->pix_fmt, pstream_info->dec_ctx->width,pstream_info->dec_ctx->height);
new_videosize = video_decode_size;
//缩放或格式转换if (pstream_info->dec_ctx->width != Zoom_Width || pstream_info->dec_ctx->height != Zoom_Height ||pstream_info->dec_ctx->pix_fmt != Zoom_pix_fmt){new_videosize = VideoScaleYuvZoom(Is_flip,pstream_info->dec_ctx->width ,pstream_info->dec_ctx->height,(int)pstream_info->dec_ctx->pix_fmt,Zoom_Width,Zoom_Height,Zoom_pix_fmt,video_decode_buf);}//这里可以取出数据frame_info->stream_idx = pstream_info->stream_idx;//frame_info->pts = pDecodeFrame->pkt_pts * 1000 * av_q2d(pstream_info->stream->time_base); //转化成毫秒frame_info->pts = pDecodeFrame->pkt_pts ;frame_info->timebase_den = pstream_info->stream->time_base.den; frame_info->timebase_num = pstream_info->stream->time_base.num; frame_info->bufsize = new_videosize;memcpy(frame_info->buf,video_decode_buf,new_videosize);}
————————————————
版权声明:本文为CSDN博主「朱韦刚」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhuweigangzwg/article/details/43734169
ffmpeg框架中如何从avframe中获取yuv数据用于测试相关推荐
- html中获取modelandview中的json数据_从Bitmap中获取YUV数据的两种方式
从Bitmap中我们能获取到的是RGB颜色分量,当需要获取YUV数据的时候,则需要先提取R,G,B分量的值,然后将RGB转化为YUV(根据具体的YUV的排列格式做相应的Y,U,V分量的排列) 所以这篇 ...
- ffmpeg中AVPacket与AVFrame中数据的传递与释放
总结了一下AVPacket与AVFrame中拷贝和释放相关操作.这里我理解在AVFrame与AVPacket传递流转的过程中并不会去每次创建和拷贝音视频数据,音视频数据被存储在AVBuffer中,而A ...
- datagrid php json,thinkphp和easyui结合中,datagrid等容器获取json数据的方法
一直使用两者进行前后台开发,非常方便,但在datagrid中获取json数据并显示的时候碰到了问题,网上资料非常的少,基本都是jsp和php的,thinkphp框架的就没有了,可能非常简单,但本人刚学 ...
- android开发中磁场传感器,Android开发获取传感器数据的方法示例【加速度传感器,磁场传感器,光线传感器,方向传感器】...
本文实例讲述了Android开发获取传感器数据的方法.分享给大家供大家参考,具体如下: package mobile.android.sensor; import java.util.List; im ...
- java获取response数据_Java中实现Http请求并获取响应数据
前言 在演示的功能代码中使用的请求http地址为:http://timor.tech/api/holiday/year/ 接口说明:获取指定年份或年月份的所有节假日信息.默认返回当前年份的所有信息. ...
- php获取网页js中的json,从php获取json数据使用js读取显示到网页笔记
//json与数组转换 $array = array("username" => "hellojson","age" => 23 ...
- AKSHARE 上获取股票数据用于盘后分析以及自己的交易模型的测试。
TUSHARE 不太好用 改成AKSHARE 以后感觉还行.对应的数据获取 根据AKSHARE的文档进行 import pandas as pd import matplotlib.pyplot ...
- 大华摄像头获取yuv数据
这里我把从大华公司获取的资料代码贴出来,希望对大家有所帮助. // DecCallBack.cpp : Defines the entry point for the console applicat ...
- 简要分析JM8.6代码中foreman_part_qcif.yuv文件的YUV数据如何悄无声息地进入程序
分析encode_one_frame函数. 先来看下结构体Sourceframe的定义: typedef struct {// Size infoint x_size, y_framesize, y_ ...
最新文章
- php 在数组中,PHP 在数组中搜索给定的简单实例 array_search 函数
- 我国智能家居行业运行现状分析 标准割裂市场
- C++ 中queue(队列)的用法
- Linux内核的时钟中断
- python gif_python 将png图片格式转换生成gif动画
- Machine Learning - Coursera week6 Evaluating a learning algorithm
- python逻辑型数据也叫什么_Python入门 | 运算符和数据类型
- ElasticSearch 动态映射与静态映射_08
- spring 集成mybatis——多数据源切换(附带定时器的配置)
- Java Spring 事务管理
- 第二章 Jackson属性名转换+属性忽略
- php 手册中show的使用,文档工具--showdoc(一)
- 删除文件批处理delete file.bat
- 那些让人惊叹的命令执行效果
- web服务器ngix基础
- RFC 2544 标准—以太网测试仪
- 高质量论文配图配色(附RGB值及16进制码)
- 苹果开发者证书申请流程
- Android移动应用技术打地鼠小游戏(简单App实现)——学习成果
- opencv cv2.inpaint()的代码与理论