热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

GStreamer与MPEG-TSVideo4LinuxATSC/DVB录音。-GStreamerwithMPEG-TSVideo4LinuxATSC/DVBRecording

ImhavinganimpossibletimesettingupafiltergraphtoreadfromarecordingthatImadefrommy

I'm having an impossible time setting up a filtergraph to read from a recording that I made from my DVB video4linux device. Any help would be vastly appreciated.

我有一个不可能的时间来设置一个filtergraph来读取我从DVB video4linux设备上录制的记录。任何帮助都将得到极大的赞赏。

How I made the recording:

我是如何录制的:

To tune the channel:

优化渠道:

azap -c ~/channels.conf "Florida"

To record the channel:

纪录频道:

cat /dev/dvb/adapter0/dvr0 > /tmp/test

This is the way that recordings must be made (I can not use any GST DVB plugins to do this for me).

这就是录制的方式(我不能使用任何GST DVB插件来为我做这个)。

I used tstools to identify that the recording is a TS stream:

我使用了tstools来识别记录是TS流:

tstools/bin$ ./stream_type ~/recordings/20130129-202049
Reading from /home/dustin/recordings/20130129-202049
It appears to be Transport Stream

...but that there are no PAT/PMT frames:

…但没有PAT/PMT框架:

tstools/bin$ ./tsinfo ~/recordings/20130129-202049
Reading from /home/dustin/recordings/20130129-202049
Scanning 10000 TS packets

Found 0 PAT packets and 0 PMT packets in 10000 TS packets

I was able to produce a single ES (elementary stream) stream, by running ts2es:

通过运行ts2es,我能够生成一个单一的ES(基本流)流。

tstools/bin$ ./ts2es -pid 97 ~/recordings/20130129-202049 ~/recordings/20130129-202049.es
Reading from /home/dustin/recordings/20130129-202049
Writing to   /home/dustin/recordings/20130129-202049.es
Extracting packets for PID 0061 (97)
!!! 4 bytes ignored at end of file - not enough to make a TS packet
Extracted 219258 of 248113 TS packets

I am able to play the ES stream (even though the video is frozen on the first frame):

我可以播放ES流(尽管视频在第一帧被冻结):

gst-launch-0.10 filesrc location=~/recordings/20130129-202049.es ! decodebin2 ! autovideosink
gst-launch-0.10 filesrc location=~/recordings/20130129-202049.es ! decodebin2 ! xvimagesink
gst-launch-0.10 playbin2 uri=file:///home/dustin/recordings/20130129-202049.es

No matter what I do, though, I can't get the original TS file to open. However, it opens in Mplayer/FFMPEG, perfectly (but not VLC). This is the output of FFMPEG:

无论我做什么,我都无法打开原始的TS文件。然而,它在Mplayer/FFMPEG中打开,非常完美(但不是VLC)。这是FFMPEG的输出:

ffmpeg -i 20130129-202049

ffmpeg version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 18:03:14 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[mpeg2video @ 0x9be7be0] mpeg_decode_postinit() failure
    Last message repeated 4 times
[mpegts @ 0x9be3aa0] max_analyze_duration reached
[mpegts @ 0x9be3aa0] PES packet size mismatch
Input #0, mpegts, from '20130129-202049':
  Duration: 00:03:39.99, start: 9204.168844, bitrate: 1696 kb/s
    Stream #0.0[0x61]: Video: mpeg2video (Main), yuv420p, 528x480 [PAR 40:33 DAR 4:3], 15000 kb/s, 30.57 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0.1[0x64]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
At least one output file must be specified

This tells us that the video stream has PID 0x61 (97).

这告诉我们视频流的PID 0x61(97)。

I have been trying for a few days, so the following are only examples of a couple of attempts. I'll provide the playbin2 example first, since I know that thousands of people will respond, insisting that I just use that. It doesn't work.

我已经尝试了几天,所以下面只是几个尝试的例子。我将首先提供playbin2示例,因为我知道有成千上万的人会响应,并坚持我只是使用它。它不工作。

gst-launch-0.10 playbin2 uri=file:///home/dustin/recordings/20130129-202049

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstMpegTSDemux:mpegtsdemux0: Could not determine type of stream.
Additional debug info:
gstmpegtsdemux.c(2931): gst_mpegts_demux_sink_event (): /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstMpegTSDemux:mpegtsdemux0:
No valid streams found at EOS
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

It fails [probably] because no PID has been specified with which to find the video (the "EOS" error, I think).

它失败了(很可能),因为没有指定一个PID来查找视频(我认为是“EOS”错误)。

Naturally, I tried the following to start by demuxing the TS format. I believe it's the "es-pids" property that receives the PID in the absence of PMT information (which tstools said there weren't any, above), but I tried "program-number", too, just in case. gst-inspect indicates that one is hex and the other is decimal:

很自然地,我尝试了以下的方法,以demuxing的TS格式开始。我相信这是“es-pids”属性,它在没有PMT信息的情况下接收PID (tstools说没有任何一个),但是我也尝试了“程序编号”,以防万一。gst-inspect表示一个是十六进制,另一个是十进制:

gst-launch-0.10 -v filesrc location=20130129-202049 ! mpegtsdemux es-pids=0x61 ! fakesink
gst-launch-0.10 -v filesrc location=20130129-202049 ! mpegtsdemux program-number=97 ! fakesink

Output:

输出:

gst-launch-0.10 filesrc location=20130129-202049 ! mpegtsdemux es-pids=0x61 ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstMpegTSDemux:mpegtsdemux0: Could not determine type of stream.
Additional debug info:
gstmpegtsdemux.c(2931): gst_mpegts_demux_sink_event (): /GstPipeline:pipeline0/GstMpegTSDemux:mpegtsdemux0:
No valid streams found at EOS
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
dustin@dustinmicro:~/recordings$ gst-launch-0.10 -v filesrc location=20130129-202049 ! mpegtsdemux es-pids=0x61 ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstMpegTSDemux:mpegtsdemux0: Could not determine type of stream.
Additional debug info:
gstmpegtsdemux.c(2931): gst_mpegts_demux_sink_event (): /GstPipeline:pipeline0/GstMpegTSDemux:mpegtsdemux0:
No valid streams found at EOS
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
dustin@dustinmicro:~/recordings$ gst-launch-0.10 -v filesrc location=20130129-202049 ! mpegtsdemux es-pids=0x61 ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstMpegTSDemux:mpegtsdemux0: Could not determine type of stream.
Additional debug info:
gstmpegtsdemux.c(2931): gst_mpegts_demux_sink_event (): /GstPipeline:pipeline0/GstMpegTSDemux:mpegtsdemux0:
No valid streams found at EOS
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

However, when I try mpegpsdemux (for program streams (PS), as opposed to transport streams (TS)), I get further:

但是,当我尝试mpegpsdemux(对于程序流(PS),而不是传输流(TS))时,我得到了进一步的:

gst-launch-0.10 filesrc location=20130129-202049 ! mpegpsdemux ! fakesink

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_event_new_new_segment_full: assertion `position != -1' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_mini_object_ref: assertion `mini_object != NULL' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_pad_push_event: assertion `event != NULL' failed
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_event_new_new_segment_full: assertion `position != -1' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_mini_object_ref: assertion `mini_object != NULL' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_pad_push_event: assertion `event != NULL' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_event_new_new_segment_full: assertion `position != -1' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_mini_object_ref: assertion `mini_object != NULL' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_pad_push_event: assertion `event != NULL' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_event_new_new_segment_full: assertion `position != -1' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_mini_object_ref: assertion `mini_object != NULL' failed

(gst-launch-0.10:14805): GStreamer-CRITICAL **: gst_pad_push_event: assertion `event != NULL' failed


...


Got EOS from element "pipeline0".
Execution ended after 1654760008 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I'll still get the same problem whenever I use the mpegtsdemux, even if it follows mpegpsdemux, above.

无论何时使用mpegtsdemux,我仍然会遇到相同的问题,即使它遵循mpegpsdemux。

I don't understand this, since I haven't even picked a PID yet.

我不明白这一点,因为我还没有选一个PID。

What am I doing wrong?

我做错了什么?

Dustin

达斯汀

1 个解决方案

#1


0  

Bingo.

宾果。

It turns out that this issue was primarily caused by the invalid frames typical of MPEG-TS broadcast streams. By first running the TS file through mencoder to reconstruct it (no reencode), playbin2 suddenly worked:

事实证明,这个问题主要是由MPEG-TS广播流典型的无效帧引起的。通过通过mencoder对TS文件进行重构(没有重新编码),playbin2突然工作:

mencoder 20130129-202049 -oac copy -ovc copy -o 20130129-202049.copy

As I've been told by the authors of the mpegtsdemux, flutsdemux is newer, and should be preferred over the older mpegtsdemux. flutsdemux may also handle these malformed frames better.

正如我已经被mpegtsdemux的作者所告知的,flutsdemux是较新的,并且应该优于旧的mpegtsdemux。flutsdemux也可以更好地处理这些畸形的框架。

EDIT

编辑

Unfortunately, this was incorrect. mencoder, although being instructed to -copy- the stream, repackages it as an AVI, rather than keeping it as MPEGTS:

不幸的是,这是不正确的。mencoder,尽管被指示-拷贝- - - - -流,重新包装它作为一个AVI,而不是保留它作为MPEGTS:

$ gst-discoverer-1.0 ~/capture_0051_WXEL.dvb.distill
Analyzing file:///home/dustin/capture_0051_WXEL.dvb.distill
Done discovering file:///home/dustin/capture_0051_WXEL.dvb.distill

Topology:
  container: Audio Video Interleave (AVI)
    audio: AC-3 (ATSC A/52)
    video: MPEG-2 Video

Properties:
  Duration: 0:00:12.696016666
  Seekable: yes
  Tags: 
      encoder: MEncoder svn r34540 (Ubuntu), built with gcc-4.7
      container format: AVI
      audio codec: AC-3 audio
      bitrate: 384000
      video codec: MPEG 2 Video

That being said, it looks like PMT packets are not present when I record from off the air. mplayer/mencoder seem to cope with this, whereas GStreamer and VLC choke on the data. When I used the same device to record an ATSC/NTSC cable feed, the PMT packets were there as expected. You can determine the presence of certain packet types using "tsreport" from the "tstools" package:

也就是说,当我从空中记录下来的时候,PMT数据包就不存在了。mplayer/mencoder似乎处理了这个问题,而GStreamer和VLC阻塞了数据。当我使用相同的设备记录ATSC/NTSC电缆馈线时,PMT包就像预期的那样。您可以使用“tstools”包中的“tsreport”来确定某些包类型的存在:

The OTA feed:

OTA提要:

$ tsreport -v capture_20130621-0402.trunc | grep PMT
!!! 60 bytes ignored at end of file - not enough to make a TS packet

The cable feed:

电缆提要:

$ tsreport -v capture_20130621-1118.ntsc.qam256.Florida.dvb | grep PMT
   31960: TS Packet 171 PID 0230 [pusi] PMT
   73508: TS Packet 392 PID 0230 [pusi] PMT
  101520: TS Packet 541 PID 0230 [pusi] PMT
  164688: TS Packet 877 PID 0230 [pusi] PMT

Hopefully this saves someone some time. It took enough of mine.

希望这能节省一些时间。我受够了。


推荐阅读
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 关于我们EMQ是一家全球领先的开源物联网基础设施软件供应商,服务新产业周期的IoT&5G、边缘计算与云计算市场,交付全球领先的开源物联网消息服务器和流处理数据 ... [详细]
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • FeatureRequestIsyourfeaturerequestrelatedtoaproblem?Please ... [详细]
  • 成功安装Sabayon Linux在thinkpad X60上的经验分享
    本文分享了作者在国庆期间在thinkpad X60上成功安装Sabayon Linux的经验。通过修改CHOST和执行emerge命令,作者顺利完成了安装过程。Sabayon Linux是一个基于Gentoo Linux的发行版,可以将电脑快速转变为一个功能强大的系统。除了作为一个live DVD使用外,Sabayon Linux还可以被安装在硬盘上,方便用户使用。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • C++字符字符串处理及字符集编码方案
    本文介绍了C++中字符字符串处理的问题,并详细解释了字符集编码方案,包括UNICODE、Windows apps采用的UTF-16编码、ASCII、SBCS和DBCS编码方案。同时说明了ANSI C标准和Windows中的字符/字符串数据类型实现。文章还提到了在编译时需要定义UNICODE宏以支持unicode编码,否则将使用windows code page编译。最后,给出了相关的头文件和数据类型定义。 ... [详细]
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • Vagrant虚拟化工具的安装和使用教程
    本文介绍了Vagrant虚拟化工具的安装和使用教程。首先介绍了安装virtualBox和Vagrant的步骤。然后详细说明了Vagrant的安装和使用方法,包括如何检查安装是否成功。最后介绍了下载虚拟机镜像的步骤,以及Vagrant镜像网站的相关信息。 ... [详细]
  • ***byte(字节)根据长度转成kb(千字节)和mb(兆字节)**parambytes*return*publicstaticStringbytes2kb(longbytes){ ... [详细]
  • SpringBoot整合SpringSecurity+JWT实现单点登录
    SpringBoot整合SpringSecurity+JWT实现单点登录,Go语言社区,Golang程序员人脉社 ... [详细]
author-avatar
小啊丌-619
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有