澳门银河网上官方赌场_老品牌值得信赖

ITKeyword,专注技术干货聚合推荐

注册 | 登录

解决How to set the moov atom position when encoding video using ffmpeg in c++

itPublisher 分享于

2020腾讯云限时秒杀,爆款1核2G云服务器99元/年!(领取2860元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1062

2020阿里云最低价产品入口+领取代金券(老用户3折起),
入口地址https://www.aliyun.com/minisite/goods

I'm encoding some h264 video into a mp4 container using ffmpeg in c++. But the result videos place the moov atom(or metadata?) at the end of the video file, it's bad for internet streaming. So how can I set the moov atom position to the front?

c++ ffmpeg mp4 h.264
|
  this question
asked Feb 27 '15 at 8:40 Zhiqiang Li 95 9

 | 

1 Answers
1

解决方法

You need to use faststart flag of ffmpeg to place the moov atom in the beginning of the MP4 file, Here is the explanation of the flag. Programatically you need to set the flag in output context, here is the sample code and its working for me,

AVFormatContext *outFormatCtx;

// Write MOOV atom at the begining of the MP4 file
MOVMuxContext *mov = NULL;

mov = (MOVMuxContext *)outFormatCtx->priv_data;
mov->flags |= FF_MOV_FLAG_FASTSTART;

|
  this answer
answered Feb 27 '15 at 9:27 pragnesh 663 3 11      Hi pragnesh Thanks for your help, but I can't find MOVMuxContext data structure and FF_MOV_FLAG_FASTSTART flag in my ffmpeg library, they are marked "undefined". Which version are you using? –  Zhiqiang Li Feb 27 '15 at 9:53      Mine was ffmpeg-1.0 and those things are defined in "libavformat/movenc.h" file. It should be there in your version as well may be you need to enable all the codecs in configure. –  pragnesh Feb 27 '15 at 9:57      I don't have the header file. I will try to recompile my ffmpeg library. Thanks! –  Zhiqiang Li Feb 27 '15 at 10:15      Yes, try to keep everything enabled in configure –  pragnesh Feb 27 '15 at 10:16

 | 


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。

澳门银河网上官方赌场