请教使用ffmpeg将mov/mp4mov格式转换mp4文件解码为YUV文件

温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(5942)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'ffmpeg:YUV格式的转换',
blogAbstract:' 版本 v1.0,存在内存问题在 void v4l2_process_image(struct buffer buf)中对 v4l2 采集来的一帧进行处理,存在 struct buffer buf 中buffer 结构定义为:struct buffer {void *&&&size_t&&};buffer.start 为 YUV422 格式数据的起始地址。有关 YUV 格式:YUV 格式通常有两大类:打包(packed)格式和平面(planar)格式。前者将 YUV 分量存放在同一个数组中,通常是几个相邻的像素组成一个宏像素(macro-pixel);而后者使用三个数组分开存放 YUV 三个分量,就像是一个三维平面一样。',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:4,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'0',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}&>&FFmpeg成功解码mp4为yuv
FFmpeg成功解码mp4为yuv
上传大小:37.31MB
此工程通过FFmpeg成功把mp4文件解码为yuv:注意导入到eclipse之后要右键Android Tools--&add
Native support把工程设置为支持本地代码编译的工程
把sintel.mp4放在根目录下
综合评分:0
下载个数:
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有0条
综合评分:
积分/C币:3
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
FFmpeg成功解码mp4为yuv
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
无法举报自己的资源
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
举报的资源分:
请选择类型
资源无法下载 ( 404页面、下载失败、资源本身问题)
资源无法使用 (文件损坏、内容缺失、题文不符)
侵犯版权资源 (侵犯公司或个人版权)
虚假资源 (恶意欺诈、刷分资源)
含色情、危害国家安全内容
含广告、木马病毒资源
*详细原因:
FFmpeg成功解码mp4为yuv2220人阅读
FFmpeg(17)
在这里我们主要用到三个函数实现解码过程,首先是H264解码初期化,其次是进行H264解码,最后 H264解码销毁,具体代码实现如下。
H264Decoder.h
#pragma once
extern "C"{
#include &libavformat\avformat.h&
#include &libavutil\pixfmt.h&
#include &libavcodec\avcodec.h&
#define X264_DECODER_H long
typedef struct
struct AVCodec *// Codec
struct AVCodecContext *c;// Codec Context
AVCodecParserContext *pCodecParserC
int frame_
struct AVFrame *// Frame
int comsumedS
} X264_Decoder_H
class H264Decoder
H264Decoder(void);
~H264Decoder(void);
// H264解码初期化
X264_DECODER_H X264Decoder_Init();
H264数据解码,解码后的数据为yuv420格式
dwHandle:初期化时返回的句柄
pDataIn:待解码数据
nInSize:待解码数据长度
pDataOut:解码后的数据,存储空间由调用者申请
nOutSize:存储空间大小
nWidth:解码后的图像宽度
nHeight:解码后的图像高度
int X264Decoder_Decode(X264_DECODER_H dwHandle, uint8_t *pDataIn, int nInSize, uint8_t *pDataOut, int *nOutSize, int *nWidth,int *nHeight);
H264解码销毁
dwHandle:初期化时返回的句柄
void X264Decoder_UnInit(X264_DECODER_H dwHandle);
protected:
void pgm_save2(unsigned char *buf, int wrap, int xsize, int ysize, uint8_t *pDataOut)
for(i = 0; i & i++)
memcpy(pDataOut+i*xsize, buf + /*(ysize-i)*/i * wrap, xsize);
H264Decoder.cpp
#include "stdafx.h"
#include "H264Decoder.h"
H264Decoder::H264Decoder(void)
H264Decoder::~H264Decoder(void)
X264_DECODER_H H264Decoder::X264Decoder_Init()
X264_Decoder_Handle *pHandle = (X264_Decoder_Handle *)malloc(sizeof(X264_Decoder_Handle));
if (pHandle == NULL)
return -1;
avcodec_register_all();
pHandle-&codec = avcodec_find_decoder(AV_CODEC_ID_H264);
if (!pHandle-&codec)
return -2;
pHandle-&c = avcodec_alloc_context3(pHandle-&codec);
if (!pHandle-&c)
return -3;
pHandle-&c-&codec_type = AVMEDIA_TYPE_VIDEO;
pHandle-&c-&pix_fmt =AV_PIX_FMT_YUV420P;
pHandle-&c-&flags2|=AV_CODEC_FLAG2_CHUNKS;
pHandle-&pCodecParserCtx=av_parser_init(AV_CODEC_ID_H264);
if (!pHandle-&pCodecParserCtx){
printf("Could not allocate video parser context\n");
return -6;
if (avcodec_open2(pHandle-&c, pHandle-&codec, NULL) & 0)
return -4;
pHandle-&picture =av_frame_alloc();
if (!pHandle-&picture)
return -5;
pHandle-&frame_count = 0;
return (X264_DECODER_H)pH
void H264Decoder::X264Decoder_UnInit(X264_DECODER_H dwHandle)
if (dwHandle &= 0)
X264_Decoder_Handle *pHandle = (X264_Decoder_Handle *)dwH
avcodec_close(pHandle-&c);
av_free(pHandle-&c);
av_free(pHandle-&picture-&data[0]);
av_free(pHandle-&picture);
free(pHandle);
int H264Decoder::X264Decoder_Decode(X264_DECODER_H dwHandle, uint8_t *pDataIn, int nInSize, uint8_t *pDataOut, int *nOutSize, int *nWidth, int *nHeight)
if (dwHandle &= 0)
return -1;
unsigned char buf[20*1024]={0};
X264_Decoder_Handle *pHandle = (X264_Decoder_Handle *)dwH
av_init_packet(&(pHandle-&avpkt));
pHandle-&avpkt.size = nInS
pHandle-&avpkt.data = pDataIn;
while (pHandle-&avpkt.size & 0)
pHandle-&comsumedSize = avcodec_decode_video2(pHandle-&c, pHandle-&picture, &pHandle-&got_picture, &(pHandle-&avpkt));
if (pHandle-&comsumedSize & 0)
return -2;
if (pHandle-&got_picture)
*nWidth = pHandle-&c-&
*nHeight = pHandle-&c-&
if(pHandle-&c-&width!=0 && pHandle-&c-&height!=0)
{*nOutSize=pHandle-&c-&width*pHandle-&c-&height*3/2;}
{*nOutSize=0;}
pgm_save2(pHandle-&picture-&data[0],
pHandle-&picture-&linesize[0],
pHandle-&c-&width,
pHandle-&c-&height,pDataOut);
pgm_save2(pHandle-&picture-&data[1],
pHandle-&picture-&linesize[1],
pHandle-&c-&width/2,
pHandle-&c-&height/2,
pDataOut +pHandle-&c-&width * pHandle-&c-&height);
pgm_save2(pHandle-&picture-&data[2],
pHandle-&picture-&linesize[2],
pHandle-&c-&width/2,
pHandle-&c-&height/2,
pDataOut +pHandle-&c-&width * pHandle-&c-&height*5/4);
if (pHandle-&avpkt.data)
pHandle-&avpkt.size -= pHandle-&comsumedS
pHandle-&avpkt.data += pHandle-&comsumedS
文章:15篇
阅读:25513
文章:11篇
阅读:17250
文章:25篇
阅读:81167如何使用ffmpeg命令将422sp的yuv数据转成h264文件呢?
[问题点数:40分,结帖人cyq1028]
如何使用ffmpeg命令将422sp的yuv数据转成h264文件呢?
[问题点数:40分,结帖人cyq1028]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
匿名用户不能发表回复!|博主最新文章
博主热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)

我要回帖

更多关于 mov格式转换mp4 的文章

 

随机推荐