public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
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, 21 Aug 2008 19:45:12 +0200	[thread overview]
Message-ID: <20080821174512.GC32022@raven.wolf.lan> (raw)
In-Reply-To: <369347.83967.qm@web46113.mail.sp1.yahoo.com>

Thank you for the extensive answer, Barry!

On Thu, Aug 21, 2008 at 05:10:10AM -0700, barry bouwsma wrote:
> --- On Wed, 8/20/08, Josef Wolf <jw@raven.inka.de> wrote:
> 
> > > >I'd like to convert live mpeg-ts streams from DVB-S on the fly into
> > > >a mpeg-ps stream.  I know that (for example)
> > 
> > In principle, yes.  But there is a big drawback to such a solution:
> > the pipes (and demuxing/muxing in a different process) will introduce
> > lots of context switches.  Since I want to convert four full
> > transponders at the same time (about 25 channels), this will certainly
> > kill my 450MHz PII machine.  Let alone the 25 additional mencoder
> > processes all running in parallel.
> 
> Can I ask for more details?  As I'm using a 200MHz and similar
> machines for full- and partial-TS work from 4 DVB cards, I have
> some concerns, that may or may not be a problem.
> 
> What sort of cards are you using -- internal PCI or external USB?

Technotrends internal PCI budget cards.

> When I'm handling a high bandwidth (BBC-HD) program on my internal
> PCI card, not even a full transport stream, I start to feel the
> CPU pinch, which will be far worse for USB streams.

I am not interested in HD (yet).  But surely this will change at
some point in time.

> Given about
> 36Mbit/sec per transponder, you'll be schlepping quite a bit of
> data, which may give you concern.  Keep an eye on idle time.

Grabbing 18 TV TS streams from 3 transponders gives 60% idle at the
moment. (my fourth card has died and I have not bought a replacement
yet.  AFAIK they have stopped manufacturing the cards :-(( )

> Of course, my machine is only an MMX Pentium, and only 32MB RAM,
> so will by far reach its capacity well before yours; mine seems to
> max out with a 15Mbit/sec HD stream (internal PCI), a full 16Mbit/
> sec transport stream via USB of DVB-T, and two filtered USB1 partial
> radio streams, doing nothing but writing files to internal disks.

Watch out for a catch when writing to internal (ext3) disks: When
the commit-interval is reached and the journal is flushed, write(2)
blocks for a significant time.  You risk buffer overruns on the
incoming TS if you are reading in the same thread.  I had this problem
a long time ago when I did my first experiments with DVB drivers.

> Are you intending to use the PSen in real-time like it seems you
> describe, or will you/can you be recording for later use?

Both.  But the recording would probably be by grabbing the already
converted real-time stream via

  wget http://dvb.local:1234/zdf.ps

or something.  Decoupling recording from demuxing saves me from the
above mentioned catch.  In addition, recording can be done on every
host in my network.  I could even roll a script based on LWP to get
the start/end time of the recording correct.

> It sounds like you may, given your example of ZDF, be streaming
> the oeffis from 10744 (arte & Co), 11836 (ARD & Co), ZDF, and some
> Dritte programs at 12110.

11836 + 11954 + 12188 + 12545.  Unfortunately, they have moved arte
from 12188 and a fifth card is not supported by the drivers :-(

> If I'm not mistaken, your program stream should include the video PID
> data, plus an audio PID (only one, I'll assume the primary mp2 audio,
> though you may choose the AC3 where present) from each channel, so no
> worry about second/alternative audio, teletext, or additional program
> tables sent in the full stream.

No, I want to get all the streams so I can select language on the client
(vlc or something).

> The program `ts2ps', part of the dvb-mpegtools suite, or something
> similar from those programs, can be used to repack the data into
> PS, and should be a lot more lightweight than mencoder.

This would still need the pipes.  Introducing pipes would introduce
significant context switching since pipes are (AFAIR) only 8kbytes.
So, assuming 500kbytes/sec, I would get 240 context switches per
second for every program.  This gives a total of 6000 context switches
every second.  You need _really_ big iron to cope with this.

> Timing data is partially within each PID, so you should be able to
> get a usable PS from just the two PIDs.

Yes, timing is within the PID.  But there are lots of times there:
 - PCR, OPCR, DTS_next_AU from the adaptation field
 - PTS, DTS, ESCR_base, ECSR_extension, ES_rate from the PES header
 - there's the possibility that the PCR is carried in a different
   PID (indicated by the PCR_PID field in the PMT)

Which one do I have to use to create the PS header?  I guess I have to
use the PTS from the PES, but I fail to deduce this from the iso-13818-1.

> Given the amount of data you'll be handling on your 450MHz machine,
> you may see lost packets and thus corruption at full load, so test
> by working your way from a single functioning transponder up to the
> full workload.

I don't have lost packets, but still artefacts in the video.  Looks like
the additional stream_id's on the video-PID disturbs vlc's decoder.

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

  reply	other threads:[~2008-08-21 17:50 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 [this message]
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
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=20080821174512.GC32022@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