首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ffmpeg中更改mpeg ts pid值

在ffmpeg中更改mpeg ts pid值
EN

Stack Overflow用户
提问于 2015-03-18 20:01:33
回答 2查看 1.5K关注 0票数 1

我的C++应用程序加载一个原始的音频和视频文件,并将它们保存为Mpeg格式。目前音视频的PID值是固定的。

我想要使用C++的音频和视频PID值。如果有人能告诉我怎么做,我真的很感激。

EN

回答 2

Stack Overflow用户

发布于 2015-03-20 13:50:41

@aergistal你使用AVDictionary做这件事是正确的。但是avio_open2 ()方法不起作用。您必须将其传递给write header方法,而不是avio_open2 ()方法

代码语言:javascript
复制
AVDictionary *d = NULL;
av_dict_set(&d, "mpegts_start_pid", "0x0050", 0);

//Write file header
if (avformat_write_header(ofmt_ctx, &d) < 0) {
    printf("Error occurred when opening output file\n");
    return false;
}

这个方法是有效的。

谢谢。

票数 1
EN

Stack Overflow用户

发布于 2015-03-18 21:18:58

设置MPEG-TS复用器的mpegts_start_pid AVOption。

例如:

代码语言:javascript
复制
int avio_open2  (AVIOContext **s,
                const char * url,
                int flags,
                const AVIOInterruptCB * int_cb,
                AVDictionary ** options 
)   

使用options parameter

更新:如何设置字典条目

代码语言:javascript
复制
AVDictionary *d = NULL;           // "create" an empty dictionary
av_dict_set(&d, "foo", "bar", 0); // add an entry

来自AVDictionary documentation

这里有一个完整的重新复用示例:enter link description here,但它使用了avio_open

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29121520

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档