From: Josef Wolf <jw@raven.inka.de>
To: linux-dvb@linuxtv.org
Subject: Re: [linux-dvb] How to convert MPEG-TS to MPEG-PS on the fly?
Date: Thu, 28 Aug 2008 00:00:20 +0200 [thread overview]
Message-ID: <20080827220019.GM32022@raven.wolf.lan> (raw)
In-Reply-To: <949376.11164.qm@web46110.mail.sp1.yahoo.com>
On Wed, Aug 27, 2008 at 12:26:00AM -0700, barry bouwsma wrote:
[ ... ]
Thanks for your patience and your efforts, Barry!
Inspired by your detailed description, I decided to hack together an
quick-n-dirty script to analyze dvbsnoop's timing output. I attach
the script at the end of this mail. First, I'd like to present some
of the results. Given a file containing TS (z.ts), I ran those commands:
$ rm z.mpg
$ ffmpeg -f dvd -acodec copy -vcodec copy -i z.ts z.mpg
$ ./parsesnoop z.mpg 20
pkt-nr id len PTS DTS ESCR SCR
00000001 0xba 0x000c 14:05:04.5660
00000005 0xba 0x000c 14:05:04.7942
00000007 0xe0 0x0800 22:35:16.0619 13:44:30.5997
00000008 0xe0 0x0800 26:05:52.7719 19:59:24.0657
00000009 0xe0 0x0800 25:29:04.5040 11:43:55.6654
00000010 0xe0 0x0800 25:09:57.5575 4:39:52.5434
00000011 0xe0 0x0800 1:42:31.9742
00000012 0xe0 0x0800 11:05:40.9000 6:14:46.3895 14:34:14.3564
00000014 0xe0 0x0800 26:22:35.1851 5:58:32.8467 9:35:17.3297
00000015 0xe0 0x0800 0:27:29.7839 23:55:23.4698
00000016 0xe0 0x0800 0:31:07.6702
00000017 0xe0 0x0800 25:25:02.1821
00000018 0xe0 0x0800 22:08:07.7717
00000019 0xe0 0x0800 25:42:03.2501
00000020 0xe0 0x0800 4:08:35.6544 11:21:31.4357 23:12:35.3037
00000022 0xe0 0x0800 25:34:24.0965
00000023 0xe0 0x0800 12:24:51.4790
00000024 0xe0 0x0800 16:35:12.6386 9:34:01.5197
00000025 0xe0 0x0800 1:17:22.1240 20:05:57.9732
00000026 0xe0 0x0800 23:02:50.3471 13:38:26.3393
00000027 0xe0 0x0800 24:19:14.5942 7:04:21.1562
All of those times look pretty much wired to me. There seem to be no
consistency at all. Just some random numbers. But this stream plays
very good on all the players I tried.
Then I tried:
$ libdvb-0.5.5.1/dvb-mpegtools/ts2ps 120 110 <z.ts >z.ts2ps
$ ./parsesnoop z.ts2ps 20
pkt-nr id len PTS DTS ESCR SCR
00000001 0xba 0x000e 4:42:57.2304
00000003 0xe0 0x0800 17:58:19.1292 17:58:19.0092
00000033 0xe0 0x0800 17:58:19.0492
00000042 0xe0 0x0800 17:58:19.0892
00000052 0xe0 0x0800 17:58:19.2492 17:58:19.1292
00000055 0xba 0x000e 4:42:56.9789
00000056 0xc0 0x0800 17:58:18.8777
00000079 0xe0 0x0800 17:58:19.1692
00000091 0xe0 0x0800 17:58:19.2092
00000100 0xe0 0x0800 17:58:19.3692 17:58:19.2492
00000121 0xe0 0x0800 17:58:19.2892
00000122 0xba 0x000e 4:42:57.1469
00000123 0xc0 0x0800 17:58:19.0457
00000132 0xe0 0x0800 17:58:19.3292
00000141 0xe0 0x0800 17:58:19.4892 17:58:19.3692
00000161 0xe0 0x0800 17:58:19.4092
00000174 0xe0 0x0800 17:58:19.4492
00000183 0xe0 0x0800 17:58:19.6092 17:58:19.4892
00000188 0xba 0x000e 4:42:57.3149
00000189 0xc0 0x0800 17:58:19.2137
00000204 0xe0 0x0800 17:58:19.5292
$
This looks much more consistent. The only strange thing is that ESCR
is missing. But all the players I tried (except mplayer) fail to play
this stream in one way or another.
Please note that both streams were created from identical input. I can
see ts2ps timestamps in the original stream. But I can fine none of
the ffpeg timestamps in the original stream. Strange enough, the
ts2ps stream (the one that preserves original timestamps) does not play
on any player (except mplayer) and the stream with fantasy-timestamps
plays virtually anywhere.
> And now, I'm wondering just how `replex' is arriving at these
> timestamps from the TS file.
Same question for ffmpeg...
> Anyway, it's not all that relevant, no? I'm just muttering to
> myself out loud, yes? I'm not slowly going insane, right?
> I'll be off in my corner, rocking back and forth
Oh, you start feeling like me ;-)
Please, can somebody recommend a _good_ book explaining all this mess?
Here's the script that I used to generate the output listed above:
#! /usr/bin/perl
use strict;
use warnings;
my ($infile, $packets) = (shift, shift);
my $dvbsnoop = "dvbsnoop-1.4.50/src/dvbsnoop -s ps -ph 0 -nohexdumpbuffer";
open (my $snoop, "$dvbsnoop -if '$infile'|") or die;
print " pkt-nr id len PTS DTS ESCR SCR\n";
my ($nr, $len, $sid, %ts);
while (my $line = <$snoop>) {
$line =~ s/system_clock_reference_base/SCR_base/;
$nr=$1, $len=$2 if $line =~ /^PS-Packet: (\d+).*Length: \d+ \(([0-9a-fx]+)\)/;
$sid=$1 if $line =~ /^Stream_id: \d+ \(([0-9a-fx]+)\)/;
$ts{$1}=$2 if $line =~ /(PTS|DTS|E?SCR).*Timestamp: ([\d\:\.]+)/;
next unless $line =~ /=========/;
next unless keys %ts;
print join (" ", $nr, $sid, $len,
map {
sprintf ("%13s", exists $ts{$_} ? $ts{$_} : "");
} qw(PTS DTS ESCR SCR)), "\n";
$sid=undef;
%ts=();
last if --$packets<0;
}
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
next prev parent reply other threads:[~2008-08-27 22:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-20 21:10 [linux-dvb] How to convert MPEG-TS to MPEG-PS on the fly? Josef Wolf
2008-08-20 21:17 ` Steven Toth
2008-08-20 21:48 ` Josef Wolf
2008-08-21 12:10 ` barry bouwsma
2008-08-21 17:45 ` Josef Wolf
2008-08-22 1:07 ` Kevin Sheehan
2008-08-22 5:15 ` barry bouwsma
2008-08-22 15:16 ` Josef Wolf
2008-08-22 14:44 ` Josef Wolf
2008-08-22 15:44 ` Nick Ludlam
2008-08-25 19:02 ` Josef Wolf
2008-08-26 6:49 ` Nico Sabbi
2008-08-26 12:00 ` barry bouwsma
2008-08-26 22:45 ` Josef Wolf
2008-08-27 7:26 ` barry bouwsma
2008-08-27 22:00 ` Josef Wolf [this message]
2008-08-28 14:40 ` Johannes Stezenbach
2008-08-28 19:34 ` Josef Wolf
2008-08-28 21:09 ` Johannes Stezenbach
2008-08-28 22:48 ` Josef Wolf
2008-08-29 5:49 ` Josef Wolf
2008-08-29 15:45 ` [linux-dvb] PTS/DTS clarification (Was: How to convert MPEG-TS to MPEG-PS on the fly?) Josef Wolf
2008-08-26 22:31 ` [linux-dvb] How to convert MPEG-TS to MPEG-PS on the fly? Josef Wolf
2008-08-21 19:17 ` Josef Wolf
2008-08-21 21:14 ` Josef Wolf
2008-08-22 8:10 ` [linux-dvb] RE : " Thierry Lelegard
2008-08-25 19:55 ` Josef Wolf
2008-08-26 6:50 ` Nico Sabbi
2008-08-26 21:19 ` Josef Wolf
2008-08-22 7:57 ` Thierry Lelegard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080827220019.GM32022@raven.wolf.lan \
--to=jw@raven.inka.de \
--cc=linux-dvb@linuxtv.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox