看板 Programming 關於我們 聯絡資訊
在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
zoochung:ffmpeg 只有寫過的人才知道痛苦 XD 140.109.22.252 04/27 19:28
viirya:Try to set CODEC_FLAG_GLOBAL_HEADER flag118.160.235.219 04/30 16:17