如何确定 mpeg-2 节目流文件的视频尺寸
如何以编程方式找出 mpeg-2 transport 程序流文件中视频的宽度和高度?
编辑:我正在使用 C++,但很高兴获得任何语言的示例。 编辑:更正问题 - 我问的可能是程序流
How do I programmatically find out the width and height of the video in an mpeg-2 transport program stream file?
Edit: I am using C++, but am happy for examples in any language.
Edit: Corrected question - it was probably program streams I was asking about
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看 libmpeg2(F/OSS MPEG2 解码器)的源代码。 宽度和高度似乎是在
header.c
中的mpeg2_header_sequence()
函数中设置的。 不过,我不确定控制如何流向该特定功能。 我建议使用 libmpeg2 (例如 MPlayer)打开 MPEG2 文件并附加调试器来查看更准确地说它正在做什么。Check out the source code to libmpeg2, a F/OSS MPEG2 decoder. It appears that the width and height are set in the
mpeg2_header_sequence()
function inheader.c
. I'm not sure how control flows to that particular function, though. I'd suggest opening up an MPEG2 file in something using libmpeg2 (such as MPlayer) and attaching a debugger to see more closely exactly what it's doing.如果你使用的是DirectX,VMRWindowlessControl接口中有一个方法:
或者IBasicVideo接口:
If you are using DirectX, there is a method in the VMRWindowlessControl interface:
Or the IBasicVideo interface:
对于 MPEG2 视频,水平和水平方向 垂直尺寸可以在视频序列头(来自视频比特流)中找到。 序列头代码为0x000001B3。 下面是一些示例代码。 但是,如果在序列扩展标头中指定,则它不会考虑水平/垂直尺寸扩展。
for MPEG2 Video the horizontal & vertical size can be found in the Video Sequence Header (from the video bit stream). The sequence header code is 0x000001B3. Some example code below. However it does not take into account the horizontal/vertical size extension if specified in sequence extension header.
hamishmcn 表示 Adam Rosenfield 的答案正是他所需要的。 这让我怀疑这个问题的准确性。 MPEG 传输流没有具有视频序列标头。 该标头可在 MPEG 节目流中找到。
我没有答案。 我只是希望有人的答案是正确的,因为我需要一个。
hamishmcn said that Adam Rosenfield's answer was what he needed. This makes me wonder about the accuracy of the question. An MPEG transport stream doesn't have a video sequence header. That header is found in an MPEG program stream.
I don't have an answer. I was just hoping against hope that someone's answer was correct, because I need one.