MPEG-2 Transport Stream Support

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
bochawa
Posts: 4
Joined: Mon Oct 15, 2007 11:56 pm

Post by bochawa »

Just an update: the version I compiled myself (Version 0.9.1 (2007101500)) also reported the same "No Valid Title Found" error that I've been experiencing with this one particular eyeTV exported program stream.

Activity window reports: [14:46:09] scan: could not get a decoded picture
Preceded by a lot of: [14:46:09] hb_demux_ps: not a PS packet (00000654)

I'm guessing I have a malformed program stream and there's not much I can do about it?
awk
Enlightened
Posts: 109
Joined: Sat Mar 31, 2007 11:55 pm

Post by awk »

bochawa wrote:Just an update: the version I compiled myself (Version 0.9.1 (2007101500)) also reported the same "No Valid Title Found" error that I've been experiencing with this one particular eyeTV exported program stream.

Activity window reports: [14:46:09] scan: could not get a decoded picture
Preceded by a lot of: [14:46:09] hb_demux_ps: not a PS packet (00000654)

I'm guessing I have a malformed program stream and there's not much I can do about it?
Yep - In a perfect (or at least better) world the parsers/demuxers in Handbrake would get past this - however the MPEG2 parser is more 'oriented' for DVD Parsing where stream errors are pretty uncommon.

It's possible the transport stream does have a redundant packet in it (the spec supports this - but I've rarely seen it).

If you can work with the transport stream directly you could try chopping off pieces off the front and see if you can get it past the error, you might miss a few seconds/minutes of the program but perhaps that would be OK ?
bochawa
Posts: 4
Joined: Mon Oct 15, 2007 11:56 pm

Post by bochawa »

Thanks for the feedback. I think for this particular file I'll use eyeTV's built in export option - hopefully future recordings don't have this same problem.

When the season DVD comes out, I'll probably re-encode using HB anyway! :D
dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

Post by dynaflash »

awk, would just like to chime in and say thanks as well.

Just picked up an eyetv hybrid and am recording and converting for my atv. Works great. Durations are correct and everything. Outstanding working with some HD content in HB. Thanks again :)
eddyg
Veteran User
Posts: 798
Joined: Mon Apr 23, 2007 3:34 am

Post by eddyg »

awk wrote: Yep - In a perfect (or at least better) world the parsers/demuxers in Handbrake would get past this - however the MPEG2 parser is more 'oriented' for DVD Parsing where stream errors are pretty uncommon.
Hi awk,

I believe that the issue is all in the scan rather than when we encode. We are pretty resilient to errors when encoding.

When we scan errors cause us to bail on that title. I've already changed the scan code to not bail if a preview can not be constructed, it sounds like there are more error conditions that could be ignored.

I don't actually have any of these problem streams and so don't know which scan error conditions are being hit. If anyone does have one that is an issue (and if they don't mind my grabbing it, if it is small) I'll have a go at changing the scan to not be so picky.

Cheers, Ed.
awk
Enlightened
Posts: 109
Joined: Sat Mar 31, 2007 11:55 pm

Post by awk »

eddyg wrote:
awk wrote: Yep - In a perfect (or at least better) world the parsers/demuxers in Handbrake would get past this - however the MPEG2 parser is more 'oriented' for DVD Parsing where stream errors are pretty uncommon.
When we scan errors cause us to bail on that title. I've already changed the scan code to not bail if a preview can not be constructed, it sounds like there are more error conditions that could be ignored.
Yep - I saw that change and think it's going to help a lot, I ran into a problem where the scan would abort on a very small stream because the last 10% of the file didn't represent a complete picture (High-Def stream - and it was very small 8-). Your change made the scan complete and accept that there was only 9 preview images. Very helpful.

I have some problem clips I've collected and once Leopard is out and I have gotten the first release of my project out the door I'll see if I can run them against the latest sources and get some ideas where we're still failing.
bochawa
Posts: 4
Joined: Mon Oct 15, 2007 11:56 pm

Post by bochawa »

I just realized that if I set the aspect ratio to 16:9 in eyeTV's display options for the recording, eyeTV will crop to that aspect ratio when using the built-in iPod export feature, yielding a 320x180 video. This eliminates the need for me to use Handbrake to cut out the black bars on widescreen content.

Sorry if I wasted too much of the developer's time with my query - I still appreciate all the work you guys are doing, keep it up!
Honeyko
Posts: 33
Joined: Mon Sep 24, 2007 4:10 pm

Post by Honeyko »

I was directed to this thread from this one; as noted there, I'm attempting to get HB to play with a stand-alone MPEG2 file. The MPEG2 was created by using VideoReDo Plus to stream-copy join several MPEG2 chapters produced by MagicDVDripper. (The individual chapter MPEG2s are encodable by HB, but the combined file is not due to lack of titles)

I've installed Streamclip 1.1 (using Windows here), but haven't had any luck yet getting it to produce a file HB will open and convert.

How might I do this?
eddyg
Veteran User
Posts: 798
Joined: Mon Apr 23, 2007 3:34 am

Post by eddyg »

Maybe you could paste the result of the scan into the forum, it should explain why it couldn't find any viable titles.

Include the whole thing if you could.

Cheers, Ed.
siromega
Posts: 36
Joined: Mon Jul 02, 2007 5:06 am

Post by siromega »

Your "Problem" answered in your Thread -Mod

I'm having problems converting a MPEG2 file from a TiVo..

TiVoToGo -> VideoReDo -> Handbrake
I've also tried TiVoToGo -> DirectShowDump -> VideoReDo -> Handbrake

Here is what happens at the command line...


C:\Program Files\Handbrake>hbcli.exe -i "C:\Documents and Settings\Anthony\My Documents\My TiVo Recordings\The Big Bang Theory - ''The Big Bran Hypothesis'' (Recorded Oct 1, 2007, KLASDT) (02).mpg" -t 0 -c 1 -o "C:\Documents and Settings\Anthony\My Documents\My TiVo Recordings\Big Bang Theory - Big Bran Hypothesis.m4v" -e x264 -E faac -w 480 -l 272 --crop 0:0:0:0 -m -b 960 -2 -x cabac=0:ref=1:analyse=all:me=umh:subme=6:no-fast-pskip=1:trellis=1 -B 128 -R 48 -v
[21:55:47] hb_init: checking cpu count
[21:55:47] hb_init: starting libhb thread
[21:55:47] thread ed2398 started ("libhb")
HandBrake 0.9.1 (2007100800) - http://handbrake.m0k.org/
2 CPUs detected
Opening C:\Documents and Settings\Anthony\My Documents\My TiVo Recordings\The Big Bang Theory - ''The Big Bran Hypothesis'' (Recorded Oct 1, 2007, KLASDT) (02).mpg...
[21:55:47] hb_scan: path=C:\Documents and Settings\Anthony\My Documents\My TiVo Recordings\The Big Bang Theory - ''The Big Bran Hypothesis'' (Recorded Oct 1, 2007, KLASDT) (02).mp
[21:55:47] thread ed2580 started ("scan")
[21:55:47] scan: trying to open with libdvdread
ERROR: dvd: DVDOpen failed (C:\Documents and Settings\Anthony\My Documents\My TiVo Recordings\The Big Bang Theory - ''The Big Bran Hypothesis'' (Recorded Oct 1, 2007, KLASDT) (02).mpg)[21:55:47] scan: trying to open as MPEG-2 Stream
[21:55:47] scan: decoding previews for title 0
[21:55:47] scan: preview 1
[21:55:47] scan: AC3, rate=48000Hz, bitrate=384000
[21:55:47] scan: preview 2
[21:55:47] scan: preview 3
[21:55:47] scan: preview 4
Scanning title 0 of 1...
[21:55:47] scan: preview 5
[21:55:47] scan: preview 6
[21:55:47] scan: preview 7
[21:55:48] scan: preview 8
Scanning title 0 of 1...
[21:55:48] scan: preview 9
[21:55:48] scan: preview 10
[21:55:48] scan: 1920x1088, 29.970 fps, autocrop = 0/8/0/0
[21:55:48] hb_stream_update_audio: id=80bd, lang=Unknown (AC3) (2.0 ch), 3cc=und
, rate = 48000, bitrate = 384000, flags = 0x2 (2)
[21:55:48] scan: title (0) job->width:1920, job->height:1072
[21:55:48] thread ed2580 exited ("scan")
[21:55:48] thread ed2580 joined ("scan")
[21:55:48] libhb: scan thread found 1 valid title(s)
+ title 0:
+ vts 0, ttn 0, cells 0->0 (0 blocks)
+ duration: 00:20:40
+ size: 1920x1088, aspect: 1.78, 29.970 fps
+ autocrop: 0/8/0/0
+ chapters:
+ 1: cells 0->0, 0 blocks, duration 00:20:40
+ audio tracks:
+ 1, Unknown (AC3) (2.0 ch), 48000Hz, 384000bps
+ subtitle tracks:
[21:55:48] thread ed2398 exited ("libhb")
[21:55:48] thread ed2398 joined ("libhb")
HandBrake has exited.[/u][/b]
mduell
Veteran User
Posts: 8196
Joined: Sat Apr 21, 2007 8:54 pm

Post by mduell »

Honeyko wrote:I was directed to this thread from this one; as noted there, I'm attempting to get HB to play with a stand-alone MPEG2 file. The MPEG2 was created by using VideoReDo Plus to stream-copy join several MPEG2 chapters produced by MagicDVDripper. (The individual chapter MPEG2s are encodable by HB, but the combined file is not due to lack of titles)

I've installed Streamclip 1.1 (using Windows here), but haven't had any luck yet getting it to produce a file HB will open and convert.

How might I do this?
I'm having pretty much the same problem. I've used DVD Decrypter to concatenate all of the main movie VOBs into a single file. VLC plays it fine, but the HandBrake input code isn't robust enough to handle it.
Honeyko
Posts: 33
Joined: Mon Sep 24, 2007 4:10 pm

Post by Honeyko »

In my case, a DVD with six cartoon episodes and some extras has the whole mass congealed into a single monster file with about fifty chapters. The cartoons are six or seven chapters each. At first, I used MagicDVDripper to create chapter output, and then merged the appropriate chapters into single episode MPEG2 files (Handbrake will not open, and Streamclip wasn't any help re-streaming them into anything HB would open). Next, I tried using Streamclip's merge feature on an ISO of the DVD as well as a drive folder rip of the DVD; in both cases, it gave me read errors at various chapter breaks. It also haphazardly sorted chapters when I selected more than two to merge -- so I would have to merge two, and then the next, and then the next two, etc, and them merge two of those, and then two of those, until I got a full episode. Assuming no read errors dooming the attempt.... Ugh.

I am presently using HB upon relevant chapters directly, but this requires the interim step of ripping the whole DVD to chapter output in order to tell what each chapter is (because HB doesn't have a built-in viewer). While this produces the output I want in this particular case, it gets me no closer to opening previously converted or encoded files lacking proper "titles" and what-not.
zuzu
Posts: 8
Joined: Mon Aug 27, 2007 2:00 pm

Post by zuzu »

awk wrote:A little more digging shows that the tables (PMT) are present, however they're not being decoded correctly since they're much larger than any I've seen in the past and as such span multiple Transport Stream Packets - and the code doesn't handle that correctly. I'm working on a fix.
I was recently told by a technical support representative that this is a kind of broadcast flag or "conditional access" (or digital restrictions management (DRM) ) added to the signal to be read by their cablebox to limit what can be recorded. (there have been many examples online posted of CableCo DVRs that auto-delete content after a certain time or prevent users from fast-forwarding.) so if anyone from the EFF (e.g. Seth David Schoen) or AVSforum or anyone here in this forum wants to follow up on this, empirical evidence may be examined.

(apparently the business model in mind is to extract rents from the mandatory cablebox by trying to break compatibility with industry standard QAM.)
kdorff
Posts: 2
Joined: Wed May 16, 2007 11:01 pm

Also having problems encoding VideoRedo MPG file with HB

Post by kdorff »

I am having the same issue as siromega. I am using HandbreakCLI version 0.9.1. The parameters are generated using HandBreak (GUI) version 2.4.1. VideoRedo Plus is version 2.5.4. I am using a patched version of Vista. The source MPG file plays without complaint (at least spot checking it) in VLC Media Player.

Source MPG video is TiVo -> TiVo Desktop -> VideoRedo (remove commercials) then to Handbreak with the PSP settings, selecting the appropriate (and only) video and turning on two pass. When I encode it says

Code: Select all

C:\winbin\Handbrake>HandBrakeCLI.exe  -i "SourceFile.mpg" -t 0 -c 1 -o "DestFile.mp4" -e ffmpeg -E faac -w 368 -l 208 --crop 0:0:0:0  -b 1024 -2  -B 160 -R 48 -v
[11:23:26] hb_init: checking cpu count
[11:23:26] hb_init: starting libhb thread
[11:23:26] thread 18823e8 started ("libhb")
HandBrake 0.9.1 (2007100800) - http://handbrake.m0k.org/
1 CPU detected
Opening SourceFile.mpg...
[11:23:26] hb_scan: path=SourceFile.mpg, title_index=0
[11:23:26] scan: trying to open with libdvdread
[11:23:26] thread 18825b0 started ("scan")
ERROR: dvd: DVDOpen failed (SourceFile)[11:23:26] scan: trying to open as MPEG-2 Stream
[11:23:26] scan: decoding previews for title 0
[11:23:26] scan: preview 1
[11:23:26] scan: AC3, rate=48000Hz, bitrate=384000
[11:23:26] scan: preview 2
Scanning title 0 of 1...
[11:23:26] scan: preview 3
Scanning title 0 of 1...
[11:23:26] scan: preview 4
[11:23:26] scan: preview 5
Scanning title 0 of 1...
[11:23:26] scan: preview 6
[11:23:27] scan: preview 7
Scanning title 0 of 1...
[11:23:27] scan: preview 8
Scanning title 0 of 1...
[11:23:27] scan: preview 9
[11:23:27] scan: preview 10
Scanning title 0 of 1...
[11:23:27] scan: 1920x1088, 29.970 fps, autocrop = 0/0/0/0
[11:23:27] hb_stream_update_audio: id=80bd, lang=Unknown (AC3) (5.1 ch), 3cc=und, rate = 48000, bitrate = 384000, flags = 0x17 (23)
[11:23:27] scan: title (0) job->width:1920, job->height:1088
[11:23:27] thread 18825b0 exited ("scan")
[11:23:28] thread 18825b0 joined ("scan")
[11:23:28] libhb: scan thread found 1 valid title(s)
+ title 0:
  + vts 0, ttn 0, cells 0->0 (0 blocks)
  + duration: 01:23:27
  + size: 1920x1088, aspect: 1.78, 29.970 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 01:23:27
  + audio tracks:
    + 1, Unknown (AC3) (5.1 ch), 48000Hz, 384000bps
  + subtitle tracks:
[11:23:28] thread 18823e8 exited ("libhb")
[11:23:28] thread 18823e8 joined ("libhb")
HandBrake has exited.
Any thoughts out there on this or how to narrow down the problem?
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Problem with an HDHomeRun stream

Post by jbrjake »

Last night I recorded an episode of an hour-long 1080i TV show using my HDHR, with the command line util:

Code: Select all

./hdhomerun_config 1011DE85 save /tuner0 super.ts
I'd tested it out with a 10 minute clip of another show on the same network, earlier in the week, and it encoded fine. But this time, with a 60 minute stream, HandBrake spits out the following when I try to encode:

Code: Select all

[10:56:16] decode_program_map - Elementary Stream Info Present, decode language codes ?
[10:56:16] hb_ts_stream_find_pids - found the following PIDS
[10:56:16]     Video PIDS : 
[10:56:16]       0x31 (49)
[10:56:16]     Audio PIDS : 
[10:56:16]       0x34 (52)
[10:56:16] scan: decoding previews for title 0
[10:56:16] scan: preview 1
[10:56:16] scan: preview 2
qScanning title 0 of 1...
[10:56:16] scan: preview 3

[10:56:16] hb_ts_stream_decode - Bad transport packet (no sync byte 0x47)!
After that it just repeats the "Bad transport packet" error over and over again.

I've gotten the same problem in the past with .ts files I didn't know the provenance of, but didn't expect it with an untouched stream from an HDHR....

Any clue why this happens, or how I can avoid it in the future? Is it a problem reading > 4GB files, perhaps?
Cavalicious
Moderator
Posts: 1804
Joined: Mon Mar 26, 2007 12:07 am

Post by Cavalicious »

>4gb isn't an issue as all of my .mpg sources are around 10gb.

I have run into the same error when I try to rename a non-Transport Stream container to a .ts file. Did you try:

Code: Select all

./hdhomerun_config 1011DE85 save /tuner0 super.mpg
...maybe your save should be Program Streams and not Transport Streams?
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Cavalicious wrote:...maybe your save should be Program Streams and not Transport Streams?
Nope...SiliconDust's FAQ says to save to .ts, and when I try it as an .mpg, HB tells me "not a PS packet" over and over.
awk
Enlightened
Posts: 109
Joined: Sat Mar 31, 2007 11:55 pm

Post by awk »

jbrjake wrote:
Cavalicious wrote:...maybe your save should be Program Streams and not Transport Streams?
Nope...SiliconDust's FAQ says to save to .ts, and when I try it as an .mpg, HB tells me "not a PS packet" over and over.
HDHomeRun is giving you a transport stream, there's no program stream support.

My suspicion is that you have 'corruption' in the stream (most likely a lost UDP packet since HDHomeRun uses UDP) which means that the repeating pattern of 0x47 every 188 bytes is being broken. i.e. you have a short transport stream packet (or one long one depending on when the corruption occured) The demux code probably needs to be 'hardened' against this such that if the pattern is broken it can recover, probably not too hard it just needs some example bad data.

As you know I'm trying to get something else fixed up right now 8-) 8-) But if you can try and cut out the problem area +/- approx. 5 MBytes and get it to me I can probably use it to improve the transport stream demux algorithm.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

awk wrote:But if you can try and cut out the problem area +/- approx. 5 MBytes and get it to me I can probably use it to improve the transport stream demux algorithm.
Hrm...unfortunately, when I trim the stream in StreamClip, the problem goes away, and is replaced by a different one:

Code: Select all

[15:31:31] hb_ts_stream_decode - Unknown Audio Stream type ! 0x6 (6)
...which leads HB to think this:

Code: Select all

  + audio tracks:
    + 1, English (MPEG) (2.0 ch)
...when the stream is AC3.

UPDATE:

Okay, by making some very dirty changes to stream.c, I forced my trimmed stream to encode. I applied a kludge to hb_stream_set_audio_id_and_codec to force it to use AC3 when it wants to use MP2, and set hb_ts_stream_decode to see 0x06 as valid for AC3. Unfortunately, the stream is useless for debugging, since it doesn't have the sync packet problem.

Now, the errors start popping up on the 3rd preview. So I thought, okay, previews are spaced at each ten percent, so I'll just do a trim around that point. But this ends up encoding too. I'd think it was StreamClip cleaning up the problems, but when I do a full-length edit in StreamClip to remove commercials, the bad sync packet problem remains. Just not on shorter trims, even ones that should include the problem spot. Oh...and they all play fine in VLC.

Since I can't seem to isolate the problem area in a small clip, are there any debugging lines I could add to stream.c that might help, awk?
van
Veteran User
Posts: 417
Joined: Wed Aug 29, 2007 6:35 am

Post by van »

I've been seeing similar random errors on most large (>2GB) transport streams. The following change fixed things:

Code: Select all

Index: libhb/stream.c
===================================================================
--- libhb/stream.c      (revision 1043)
+++ libhb/stream.c      (working copy)
@@ -790,7 +790,7 @@
        if (pos == 188)
                pos = 0;                // failed to find anything!!!!!?
 
-       fseek(f, start+pos, SEEK_SET);
+       fseeko(f, start+pos, SEEK_SET);
 
        return pos;
 }
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

van wrote:The following change fixed things:
Thanks, van! It worked for me too =)

Oh, wow...actually, that one-line fix is letting me load all sorts of .ts files into HandBrake that wouldn't before! This is awesome, van!

Also, awk: I'm finding a bunch of transport streams I have are reporting AC3 audio as type 0x06 instead of 0x04 or 0x81...you have that noted in a comment in one part of the code (decode_program_map), but hb_ts_stream_decode isn't aware of it. And hb_stream_set_audio_id_and_codec thinks they're MPEG audio when they're definitely not...this, I can definitely give you a small sample of, if you want.
Cavalicious
Moderator
Posts: 1804
Joined: Mon Mar 26, 2007 12:07 am

Post by Cavalicious »

Will it be easy to now let a .ts or .mpg Title be called out as Title =1 instead of 0? Its confusing some and if by chance we start edcoding ripped HD/Blu-ray DVDs (.ts with multiple titles), this could cause an issue.
van
Veteran User
Posts: 417
Joined: Wed Aug 29, 2007 6:35 am

Post by van »

I bet the title = 0 instead of 1 was just an oversight - most of the stuff in the title struct is dvd specific & isn't initialized for transport streams. The following patch makes .ts, .mpg or .vob streams say title 1.

Code: Select all

Index: libhb/stream.c
===================================================================
--- libhb/stream.c      (revision 1043)
+++ libhb/stream.c      (working copy)
@@ -206,6 +206,7 @@
 {
     // 'Barebones Title'
     hb_title_t *aTitle = hb_title_init( stream->path, 0 );
+    aTitle->index = 1;
 
        // Copy part of the stream path to the title name
        char *sep = strrchr(stream->path, '/');
Last edited by van on Sun Nov 04, 2007 6:39 am, edited 1 time in total.
van
Veteran User
Posts: 417
Joined: Wed Aug 29, 2007 6:35 am

Post by van »

jbrjake wrote:Also, awk: I'm finding a bunch of transport streams I have are reporting AC3 audio as type 0x06 instead of 0x04 or 0x81...you have that noted in a comment in one part of the code (decode_program_map), but hb_ts_stream_decode isn't aware of it. And hb_stream_set_audio_id_and_codec thinks they're MPEG audio when they're definitely not...this, I can definitely give you a small sample of, if you want.
According to ISO-13818-1 stream type 6 is "PES private". The encoder for this must be putting the audio type in the tags rather than the PMT stream header so it would help to see all the tags in the entry. There's a really excellent transport stream dumper from inkling called atscut. It was available at http://www.nop.org/inkling/dtv/pchdtvr.tar.gz and perhaps at http://sourceforge.net/projects/atscap/. It compiles and runs fine on a mac if you apply the following patch then do "make atscut".

Code: Select all

diff -ru pchdtvr.orig/Makefile pchdtvr/Makefile
--- pchdtvr.orig/Makefile       2006-03-15 20:22:06.000000000 -0800
+++ pchdtvr/Makefile    2007-11-03 22:55:57.000000000 -0700
@@ -93,7 +93,7 @@
 # compile flags, need librt to time certain events
 atscut: atscut.c
        @echo building a shiney object
-       @$(CC) $(CFLAGS) -lrt -o $@ $^
+       @$(CC) $(CFLAGS) -o $@ $^
 
 # X11 and DVB flags
 xsig: xsig.c
Only in pchdtvr: Makefile.orig
Only in pchdtvr: RCS
diff -ru pchdtvr.orig/atscut.c pchdtvr/atscut.c
--- pchdtvr.orig/atscut.c       2006-03-15 20:13:41.000000000 -0800
+++ pchdtvr/atscut.c    2007-10-04 16:33:23.000000000 -0700
@@ -6800,14 +6800,22 @@
 void
 start_timer( void )
 {
+#if 0
     clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &cap_start);
+#else
+    memset( &cap_start, 0, sizeof(cap_start));
+#endif
 }
 
 static
 void
 stop_timer( void )
 {
+#if 0
     clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &cap_stop);
+#else
+    memset( &cap_stop, 0, sizeof(cap_stop));
+#endif
     memcpy( &cap_et, &cap_stop, sizeof(cap_et) );
 
     // if nanos subtracts borrow
Do "atscut -m2 foo.ts | head -60" (replace "foo.ts" with some stream that has the weird audio entry) and you should get something like:

Code: Select all

 MPEG PMT PID 0040: SLen 080 VN 08 CNI 1 SN 00 LSN 00
  PCRPID 0041 Program Info Len 006
   PROGRAM MAP DESCRIPTORS:
     Tag 05 DLen 04 Registration: Format ID [GA94]

   PROGRAM MAP STREAM TYPES AND DESCRIPTORS:
    Stream Type (02) MPEG2 Video ES PID 0041 ES Info Len 0017
    *Tag 11 DLen 01 ISO/IEC 13818-1 Reserved: 11 01 FF 
     Tag 10 DLen 06 Smoothing Buffer: Leak Rate 19392800 bits/s Size 2048
     Tag 06 DLen 01 Stream Alignment: PIC, GOP or SEQ
     Tag 86 DLen 07 Caption Service: Number of Services 1
      [eng] Type ATVCC Service Number 01 Easy Reader 0 Wide Aspect Ratio 0

    Stream Type (81) A/52 Audio ES PID 0043 ES Info Len 0016
     Tag 05 DLen 04 Registration: Format ID [AC-3]
     Tag 81 DLen 08 A/52 Audio: Sample Rate 48 kHz, bsid 08
      Exact Bit Rate 384 kbits/second (0E) Surround Not Indicated (00)
      Service Main Audio: Complete Main, Channels 1+1  Full Service 1
     Tag 0A DLen 04 ISO 639 Language(s): [eng]  Audio Type 00 ATSC Normal

    Stream Type (81) A/52 Audio ES PID 0044 ES Info Len 0016
     Tag 05 DLen 04 Registration: Format ID [AC-3]
     Tag 81 DLen 08 A/52 Audio: Sample Rate 48 kHz, bsid 08
      Exact Bit Rate 128 kbits/second (08) Surround Not Indicated (00)
      Service Main Audio: Complete Main, Channels 1+1  Full Service 1
     Tag 0A DLen 04 ISO 639 Language(s): [fre]  Audio Type 00 ATSC Normal

    Stream Type (81) A/52 Audio ES PID 0045 ES Info Len 0016
     Tag 05 DLen 04 Registration: Format ID [AC-3]
     Tag 81 DLen 08 A/52 Audio: Sample Rate 48 kHz, bsid 08
      Exact Bit Rate 128 kbits/second (08) Surround Not Indicated (00)
      Service Main Audio: Complete Main, Channels 1+1  Full Service 1
     Tag 0A DLen 04 ISO 639 Language(s): [spa]  Audio Type 00 ATSC Normal
If you can post the full PMT dump I'll try to fix up hb_ts_stream_decode (I'm already whacking on it to add the correct language codes).
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

van wrote:There's a really excellent transport stream dumper from inkling called atscut. It was available at http://www.nop.org/inkling/dtv/pchdtvr.tar.gz and perhaps at http://sourceforge.net/projects/atscap/.
I can't seem to get through to anywhere with the code available, but I'll keep trying.

UPDATE:

Okay, I googled my way to an old tarball of atscap and made atscut -- I had to make a few more mods to get it to build, and the output doesn't look quite the same as yours, van:

Code: Select all

atscut 1.1.0 Copyright (C) 2004-2007 inkling@nop.org
Released under the GNU General Public License Version 2
ATSC timebase Sun Jan  6 00:00:00 1980: unix diff 315982800 TZ diff -18000
Input file name /Volumes/Walter/super-edited.ts
Input size 5,217,622,844 bytes, 27,753,313 packets
Testing packets in /Volumes/Walter/super-edited.ts

PMT CRC B1285B0E OK
 MPEG PMT PID 0100: SLen 01A VN 00 CNI 1 SN 00 LSN 00
  Program 0001 PCRPID 0101 Program Info Len 000
   PROGRAM MAP DESCRIPTORS:

   PROGRAM MAP STREAM TYPES AND DESCRIPTORS:

    Stream Type (02) MPEG2 Video ES PID 0031 ES Info Len 0000

    Stream Type (06) A/90 PES sync ES PID 0034 ES Info Len 0003
     STREAM DESCRIPTORS
    *Tag 6A DLen 01 User Private: 6A 01 00 

PMT CRC B1285B0E OK
 MPEG PMT PID 0100: SLen 01A VN 00 CNI 1 SN 00 LSN 00
  Program 0001 PCRPID 0101 Program Info Len 000
   PROGRAM MAP DESCRIPTORS:

   PROGRAM MAP STREAM TYPES AND DESCRIPTORS:

    Stream Type (02) MPEG2 Video ES PID 0031 ES Info Len 0000

    Stream Type (06) A/90 PES sync ES PID 0034 ES Info Len 0003
     STREAM DESCRIPTORS
    *Tag 6A DLen 01 User Private: 6A 01 00 

PMT CRC B1285B0E OK
 MPEG PMT PID 0100: SLen 01A VN 00 CNI 1 SN 00 LSN 00
  Program 0001 PCRPID 0101 Program Info Len 000
   PROGRAM MAP DESCRIPTORS:

   PROGRAM MAP STREAM TYPES AND DESCRIPTORS:

    Stream Type (02) MPEG2 Video ES PID 0031 ES Info Len 0000

    Stream Type (06) A/90 PES sync ES PID 0034 ES Info Len 0003
     STREAM DESCRIPTORS
    *Tag 6A DLen 01 User Private: 6A 01 00 

PMT CRC B1285B0E OK
 MPEG PMT PID 0100: SLen 01A VN 00 CNI 1 SN 00 LSN 00
  Program 0001 PCRPID 0101 Program Info Len 000
   PROGRAM MAP DESCRIPTORS:

   PROGRAM MAP STREAM TYPES AND DESCRIPTORS:

    Stream Type (02) MPEG2 Video ES PID 0031 ES Info Len 0000

    Stream Type (06) A/90 PES sync ES PID 0034 ES Info Len 0003
     STREAM DESCRIPTORS
    *Tag 6A DLen 01 User Private: 6A 01 00 
Post Reply