作者cutem (笑一个!人生更美好)
看板Programming
标题[问题] ffmpeg encode问题(VC2008)
时间Tue Apr 26 20:56:15 2011
在windows xp上使用vc2008+ffmpeg撰写encode程式遇到的问题
如下。
我使用ffmpeg SDK要将一个yuv420P的档案encode成
mpeg4,yuv420P的档案我有把它存成档案,确定是ok的,
因为可以拨放,颜色也正确。
不过转成mpeg4後却有不能拨放的问题,後来才发
现是缺少vol head的关系。
vol head应该要存在AVCodecContext中的extradata
AVCodecContext *c= NULL;
c= avcodec_alloc_context();
c->extradata // vol head
现在问题是...ISO-14496-2读起来要花不少时间,时间
又没那麽多,有没有办法可以生出vol head来呢?
在ffmpeg中有对extradata做了以下注解
/**
* some codecs need / can use extradata like Huffman tables.
* mjpeg: Huffman tables
* rv10: additional flags
* mpeg4: global headers (they can be in the bitstream or here)
* The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes
larger
* than extradata_size to avoid prolems if it is read with the bitstream
reader.
* The bytewise contents of extradata must not depend on the architecture
or CPU endianness.
* - encoding: Set/allocated/freed by libavcodec.
* - decoding: Set/allocated/freed by user.
*/
由於我是要做encode,所以那句Set/allocated/freed by libavcodec看起
来很像是有API可以call的样子,是真的有吗?还是说一定要k完文件自己
写一个呢?
想说来这边问问看,希望大家能给点意见,谢谢。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.30.10.70
1F:推 zoochung:ffmpeg 只有写过的人才知道痛苦 XD 140.109.22.252 04/27 19:28
2F:→ viirya:Try to set CODEC_FLAG_GLOBAL_HEADER flag118.160.235.219 04/30 16:17