改变采样时间 [英] Alter sample times

查看:87
本文介绍了改变采样时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改生成样本的时间?我们是否需要为此创建自定义媒体源/接收器?

How can the times for the generated samples be altered? Do we need to create a custom media source/sink for this?

推荐答案

如果样本已经在媒体文件中,只需创建一个Source Reader对象并调用IMFSourceReader :: ReadSample()。 IMFSample有一个名为SetTimestamp()的方法,您可以使用它直接更改样本的时间戳。如果您更改样本
时间戳,取决于它是否是每个样本的常量偏移量,您可能还必须更改样本持续时间,否则回放可能会变得有趣或不再适用于这些文件。

If the samples are already in media files, just create a Source Reader object and call IMFSourceReader::ReadSample(). IMFSample has a method called SetTimestamp() which you can use to alter the time stamp of the sample directly. If you change the sample timestamps, depending on whether it's a constant offset for every sample or not, you might have to change the sample duration as well otherwise playback can go funny or not work for those files anymore.

如果您打算保存更改,则必须创建一个Sink Writer并将样本重新写入光盘。

If you plan on saving the changes, you'll have to create a Sink Writer and re-write the samples to disc.


这篇关于改变采样时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆