GDCL Mpeg-4 多路复用器问题
我只是创建了一个简单的图表,
SourceFilter(*.mp4 file format) ---> GDCL MPEG 4 Mux Filter ---> File writer Filter
效果很好。但是,当源为 h264 文件格式时,
SourceFilter( *.h264 file format) ---> GDCL MPEG 4 Mux Filter---> File writer Filter
它会录制一个文件,但录制的文件无法在 VLC Player、QuickTime、BS Player、WM Player 中播放。 我做错了什么?有什么想法录制 h264 视频源吗?我需要 H264 Mux 吗?
最美好的祝愿
PS:我只是想顺便录制视频......为什么我需要复用器?
I just create a simple graph
SourceFilter(*.mp4 file format) ---> GDCL MPEG 4 Mux Filter ---> File writer Filter
It works fine. But when the source is in h264 file format
SourceFilter( *.h264 file format) ---> GDCL MPEG 4 Mux Filter---> File writer Filter
It record a file but the recorded file does not play in VLC Player, QuickTime, BS Player, WM Player.
What i am doing wrong? Any ideas to record h264 video source? Do i need H264 Mux?
Best Wishes
PS: i JUST want to record video by the way...Why i need a mux?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DirectShow 过滤器使用两种 H.264 格式。一种是字节流格式,其中每个 NALU 前面都有一个起始码 00 00 01。另一种是 MP4 文件中使用的格式,其中每个起始码前面都有一个长度(媒体类型或 MP4 文件元数据指定)长度字段中使用了多少字节)。问题是某些 FOURCC 同时用于这两种格式。
MP4 mux 示例接受 BSF 或长度前面的数据,具体取决于给定的子类型。它并不试图弄清楚它是什么。最有可能的是,当您馈送 H.264 基本流时,您会为多路复用器提供 FOURCC 或媒体类型,当您提供 BSF 数据时,多路复用器认为该类型意味着长度前置。检查 TypeHandler::CanSupport。
如果您只想将 H.264 视频保存到文件中,则可以使用转储过滤器将位写入文件。如果您要保存 BSF,则这是有效的 H.264 基本流文件。如果你想得到大多数玩家的支持,或者如果你想寻求支持,那么你会想要将基本流写入带有索引的容器中,例如MP4。在这种情况下,您需要一个多路复用器,不是用于多路复用,而是用于索引和元数据创建。
G
There are two H.264 formats used by DirectShow filters. One is Byte Stream Format, in which each NALU is preceded by a start code 00 00 01. The other is the format used within MP4 files, in which each start code is preceded by a length (the media type or the MP4 file metadata specifies how many bytes are used in the length field). The problem is that some FOURCCs are used for both formats.
The MP4 mux sample accepts either BSF or length-preceded data, depending on the subtype give. It does not attempt to work out which it is. Most likely, when you are feeding the H.264 elementary stream, you are giving the mux a FOURCC or media type that the mux thinks means length-prepended, when you are giving BSF data. Check in TypeHandler::CanSupport.
If you just want to save H.264 video to a file, you can use a Dump filter to just write the bits to a file. If you are saving BSF, this is a valid H.264 elementary stream file. If you want support for the majority of players, or if you want seeking support, then you will want to write the elementary stream into a container with an index, such as MP4. In this case, you need a mux, not for the multiplexing, but for the indexing and metadata creation.
G