传输流和mpeg 文件格式

发布于 2024-10-01 09:58:18 字数 94 浏览 1 评论 0原文

我想将 TS 文件转换为 mpeg 文件。有没有描述这个过程的文件? 我知道TS架构,但不知道mpeg的文件架构。有关此主题的任何信息将受到高度赞赏。

谢谢。

I would like to convert a TS file to mpeg file. Is there any documents describing such process?
I know the TS architecture, but I don't know mpeg's file architecture. Any info on this subject will highly appreciated.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

羞稚 2024-10-08 09:58:18

您可能想要做的是将 MPEG-TS(传输流)转换为 MPEG-PS(节目流)。 MPEG-PS 是标准 .mpg 文件的格式,也是 DVD 视频使用的格式。

您可能应该掌握 ISO/IEC 13818-1 标准。该标准包含所有 MPEG-TS 和 MPEG-PS 容器详细信息(不涵盖 ISO/IEC 13818-2 中涵盖的编码视频)。

幸运的是,这种转换相当简单,因为整个 MPEG-PS 结构的大部分都包含在 MPEG-TS 格式中。传输流包含一系列 188 字节数据包,每个数据包都有一个标头。 PES(节目基本流)数据包包含在数据包有效负载中。 PES 数据包包含实际的视频或音频负载。 PES 数据包可以是任意长度,并且大多数情况下它们跨越多个 TS 数据包。从传输流中解复用 PES 数据包实际上只涉及删除 TS 标头并正确连接有效负载数据以形成 PES 数据包。

一旦获得 PES 数据包流,您就可以将它们复用为标准中规定的节目流格式。所以基本上,您不需要解析 PES 数据包或其内容,您只需将它们从一种格式中提取出来并将其插入到另一种格式中即可。

尽管转换相当简单,但它仍然需要相当多的工作,因为您需要非常熟悉容器标准并仔细解析比特流才能使事情正确。因此,即使我说转换很简单,但这只是在与其他格式转换相比简单的意义上,您可能需要进一步深入研究视频数据。

What you are probably wanting to do is convert from MPEG-TS (Transport Stream) to MPEG-PS (Program Stream). MPEG-PS is the format of a standard .mpg file as well as the format DVD video uses.

You probably should get a hold on the standard which is ISO/IEC 13818-1. This standard contains all of the MPEG-TS and MPEG-PS container details (it does not cover the coded video which is covered in ISO/IEC 13818-2).

Luckily, this conversion is rather simple since most of the entire MPEG-PS structure is contained within the MPEG-TS format. The transport stream contains a series of 188 byte packets that each have a header. PES (Program Elementary Stream) packets are contained within the packet payloads. PES packets contain the actual video or audio payload. A PES packet can be any length and most of the time they span several TS packets. Demuxing the PES packets from the transport stream really just involves removing the TS headers and concatenating the payload data correctly to form the PES packets.

Once you have a stream of PES packets, you will multiplex them into the Program Stream format as laid out in the standard. So basically, you don't need to parse the PES packets or their content, you can just lift them from one format and insert them into the other.

Even though the conversion is fairly simple, it still requires quite a bit of work since you will need to become pretty familiar with the container standard and be meticulous with your parsing of the bitstream to get things right. So even though I say the conversion is simple, that is only in the sense that it is simple compared to other format conversions where you might have to dig down further into the video data.

纵山崖 2024-10-08 09:58:18

我正在尝试添加一些可能有帮助的好资源。

以下是一些解释传输和节目流以及相关分组结构的详细信息的文档。

  1. 这解释了传输流和节目流之间的差异。 http://www.vbrick.com/docs/VB_WhitePaper_TransportStreamVSProgramStream_rd2.pdf

  2. 这解释了MPEG 还包括打包。
    http://www.img.lx.it.pt/~fp/cav/ additional_material/MPEG2_overview.pdf

  3. 这解释了传输流的其他方面,即如何使用表格等选择节目。http://www.bitrouter.com/pdf/tutorial-psip.pdf

基本上,您需要对传输流进行解包并分解为 PES 数据包(连同时间戳),然后应用节目流打包过程。

关键是当您将 PS 流复用回来时,如何保持 PS 流中数据包的相对间隙和时序。因此,您必须保留 PES 数据包中的 PTS/DTS 时间戳。

我在这里列出了一些工具——它们是您工作的一部分的很好的例子——而且众所周知,它们符合 MPEG2 系统标准。

  1. tstools ( http://tstools.berlios.de/)
  2. mplex (来自 mjpegtools)
  3. dvb-mplex (libdvb 的一部分,http://www.metzlerbros.org/dvb/)
  4. DVB-replax(也是 libdvb 的一部分,http://freshmeat.net/projects/dvb-replex/http://www.metzlerbros.org/dvb/
  5. avidemux。 http://avidemux.sourceforge.net/

开始学习的另一个好方法是使用 Gstreamer 插件框架如果您想快速了解更广泛的流程。

I am trying to add some good resources that might help.

Here are some documents that explains the details of Transport and Program streams and associated packetization structures.

  1. This explains the differences between Transport stream and Program stream. http://www.vbrick.com/docs/VB_WhitePaper_TransportStreamVSProgramStream_rd2.pdf

  2. This explains the over view of MPEG and includes packetization as well.
    http://www.img.lx.it.pt/~fp/cav/Additional_material/MPEG2_overview.pdf

  3. THis explains the other aspects of transport streams on how programs are selected using tables etc. http://www.bitrouter.com/pdf/tutorial-psip.pdf

Basically, you need to depacketize the transport stream and decompose into PES packets (along with the time stamps) and then apply the program stream packetization process.

The crucial thing is how do you maintain the relative gap and timing of the packets in PS streams when you mux it back. Hence, you must preserve the PTS/DTS timestamps in the PES packets.

I am listing some tools here - that are good example for part of your work - and they are better known to be with compliance to MPEG2 systems standard.

  1. tstools ( http://tstools.berlios.de/)
  2. mplex (from mjpegtools)
  3. dvb-mplex (part of libdvb, http://www.metzlerbros.org/dvb/)
  4. DVB-replax (also part of libdvb, http://freshmeat.net/projects/dvb-replex/ or http://www.metzlerbros.org/dvb/)
  5. avidemux. http://avidemux.sourceforge.net/

Another good way to begun learning is to use Gstreamer plug-in framework if you want to understand the broader flow quickly.

风吹雪碎 2024-10-08 09:58:18

FFMPEG 可用于将 TS 转换为 MPEG。更多信息此处

FFMPEG can be used to convert from a TS to MPEG. More info here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文