Multiple programs

From LinuxTVWiki
Revision as of 22:31, 15 July 2006 by Lak loho (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Handle multiple streams at once: In most of the cases, the DVB broadcast stream transmits many channels, so your DVB card recieves more than one PID/MPEG2 Elementary Stream at the tuned frequency. In theory, it therefore is possible to watch, record or process streams of many channels broadcasted at the same frequency (in one MPEG2 Transport Stream) at once. This page suggests various possibilities to make use of this fact.


Record Multiple Streams

Record all PIDs of the tuned frequency

dvbstream can record the whole broadcast TS at the tuned frequency by using the pseudo-PID 8192:

 dvbstream 8192 -o >all.mpeg


dvbd

dvbd is a tool specially written for recording multiple streams and separating the single streams out of it.


VDR

VDR supports multiplexing as well. A nice tool for recording that handles the logic and scheduling behind this is the web-interface vdradmin-am, which nicely shows with colours if two programs scheduled for recording at the same time actually can be recorded (are in the same frequency).

As with single programs that get recorded, each program ends up in its own folder as its program stream with the EPG description - there is no need to manually separate them any more.

Note: VDR states on its webpage that one needs one FF DVB card to watch; if one wants to record at the same time, one must add another card (perferable budget as that's cheaper). That's true - but only if one wants to watch. If one only wants to record to harddisk, a single DVB card is enough, even a budget one.


Post-process multiple streams - Separating single streams out

The more difficult question is what to do with the file as created by dvbstream above. Recording multiplex streams is only half of the story - postprocessing is what makes their contents accessable and useful. For example, xine could play multiplex channels, but one has to specify the PIDs of the right streams as a bash option. So it's pretty unhandy. And what's the point to watch a single channel from a file which has much more data in it (and is far too big for archiving).

A better idea is to separate the individual channels out, each as an MPEG-2 on its own. One could also convert the video/audio to a different format than MPEG2 (depending on which program you'll use in the same step), but for this option have a look at the more general post-processing page.


mencoder

mencoder can extract individual PIDs and does a good job in error correcting (it does it automatically so it does more than the option "copy" might suggest). At the same time, it keeps audio and video together in one MPEG PS file, avoiding those annoying de-synchronisation issues that arrise with other programs.

 mencoder -forceidx -lavdopts er=4 -vc ffmpeg12 -of mpeg -oac copy -ovc copy -aid 600 -vid 601 all.ts -o BBC4_cleaned_ps.mpeg


Metzler brothers' libdvb package

tspids, part of the Metzler brothers' libdvb package. Use tspids to see a list of the PIDs the stream contains:

 tspids <original_file.ts

Now extract the PIDs you want, for example 641 and 642:

 ts2ps 641 642 <all.ts >BBC4_psstream.mpeg


Transcode

To see what PIDs are in an MPEG TS, use tcprobe from transcode

 tcprobe -i original_file.mpeg

dear wiki reader: please continue this subsection yourself


Project X

Project X (formerly known as ds.jar) is a Java program, driven by GUI or command line option, that allows to recode files, error-correct them and separate PIDs out.


VDRsync

Although bearing the name VDR in it, VDRsync will work without VDR on the system. It just has to get VDR recording files (.vdr) as input files (but it is not able to handle MPEG2 TS file, e.g. those recorded with dvbstream videopid audiopid > myfile.ts).

It supports demultiplexing (actually separating each elementary audio and each video stream out which can be more than the PID, e.g. often there are two audio streams), but also very handy features such as instant creating a "normal" (PS) MPEG-2 file or DivX transcodes or DVD-masters or DVD-images in ISO format.

I'm not sure if the program does some error correction/compensation, but I guess not too much, because it can't handle the program change in my daily Simpsons recordings (error message "Found no ts at GOP start" and then vdrsync quits) - whereas mencoder just tells me there is an error but continues.


VDR Plugins

There are a couple of VDR plugins that do the job, namely VdrTransXvid, Vdr-requant.sh, Recoder-Tools, mplayercluster-plugin


Further Steps

After having done the demultiplexing, you might want to do further post-processing and re-encoding (recoding) to other formats such as XviD.