Multiple programs: Difference between revisions
m (→mencoder: Updated MEncoder link) |
(Add details about recording multiple channels/services with DVBStreamer.) |
||
Line 12: | Line 12: | ||
== dvbd == |
== dvbd == |
||
[[dvbd]] is a tool specially written for recording multiple streams and separating the single streams out of it. |
[[dvbd]] is a tool specially written for recording multiple streams and separating the single streams out of it. |
||
== DVBStreamer == |
|||
DVBStreamer allows simple record/stream of multiple channels by using multiple "service filters". |
|||
To record/stream multiple services simply tune to one of the channels on the multiplex you wish to record/stream using |
|||
<pre> |
|||
setsfmrl <Primary> <Output MRL> |
|||
select <1st Channel/Service Name> |
|||
</pre> |
|||
'''NOTE:''' ''<Primary>'' is the special name for the service filter that controls which multiplex is tuned to, |
|||
Then add service filters for the number of services - 1 you wish to stream record. |
|||
<pre> |
|||
addsf <ServiceFilter 1 Name> <Output mrl> |
|||
addsf <ServiceFilter 2 Name> <Output mrl> |
|||
... |
|||
</pre> |
|||
Output MRL can be udp://<ip address>:<port> for streaming over UDP or file://<file name> to save to a file. |
|||
Once you've setup your service filters you need to assign services to them: |
|||
<pre> |
|||
setsf <ServiceFilter 1 Name> <2nd channel/service Name> |
|||
setsf <ServiceFilter 2 Name> <3rd channel/service Name> |
|||
... |
|||
</pre> |
|||
Once you have finished recording, you can either opt to keep the service filters and set their MRL to null:// (which will close any open files) or remove then entirely. |
|||
<pre> |
|||
setsfmrl <Primary> null:// |
|||
setsfmrl <ServiceFilter 1 Name> null:// |
|||
rmsf <ServiceFilter 2 Name> |
|||
</pre> |
|||
In the above example I have stopped streaming/recording for the <Primary> service filter and the 1st service filter that was added. I have then completely remove the 2nd service filter that had been added. |
|||
Revision as of 08:51, 24 May 2007
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.
(Note: In case you want to record two programs which are not part of the same transport stream, you have to have two DVB cards in your computer. VDR can handle that much hardware comfortably. This page is not about that case.)
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.
DVBStreamer
DVBStreamer allows simple record/stream of multiple channels by using multiple "service filters". To record/stream multiple services simply tune to one of the channels on the multiplex you wish to record/stream using
setsfmrl <Primary> <Output MRL> select <1st Channel/Service Name>
NOTE: <Primary> is the special name for the service filter that controls which multiplex is tuned to,
Then add service filters for the number of services - 1 you wish to stream record.
addsf <ServiceFilter 1 Name> <Output mrl> addsf <ServiceFilter 2 Name> <Output mrl> ...
Output MRL can be udp://<ip address>:<port> for streaming over UDP or file://<file name> to save to a file.
Once you've setup your service filters you need to assign services to them:
setsf <ServiceFilter 1 Name> <2nd channel/service Name> setsf <ServiceFilter 2 Name> <3rd channel/service Name> ...
Once you have finished recording, you can either opt to keep the service filters and set their MRL to null:// (which will close any open files) or remove then entirely.
setsfmrl <Primary> null:// setsfmrl <ServiceFilter 1 Name> null:// rmsf <ServiceFilter 2 Name>
In the above example I have stopped streaming/recording for the <Primary> service filter and the 1st service filter that was added. I have then completely remove the 2nd service filter that had been added.
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 packetized elementary 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 (or a plugin for example xine, softdevice, dxr3) 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 arise 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.