MOVMuxContext 是一个内部头文件,不应直接访问。它的实现不是 API 的一部分,它可以更改。官方方法是通过 AVDictionary 设置选项:
AVDictionary* options = nullptr;
av_dict_set( &options, "movflags", "faststart", 0 );
avio_open2(..., &options);
Run Code Online (Sandbox Code Playgroud)
您需要使用 ffmpeg 的 faststart 标志将 moov 原子放置在 MP4 文件的开头,这是该标志的解释。以编程方式,您需要在输出上下文中设置标志,这是示例代码及其对我有用,
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;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1659 次 |
| 最近记录: |