Panteltje's Linux DVD software page

Panteltje's Linux DVD software page

~

On this page you will find all tools needed to make a Video DVD,
with up to 8 audio channels in mp2 or ac3,
and up to 32 sub picture channels,
from an European DVB-s satellite transmission, or other sources of course.

Some tools I just rewrote, some I modified so it would also work with the defective kernel 2.4.5,
some I wrote new.

Full sources are in the .tgz packages, license is GPL, code is C.



Editing out commercials from a .ts with lve, an example.

Voice control with xdipo and perlbox-voice

If you install perlbox-voice and use this script named 'show' with xdipo,
then you can either type in an xterm:
show rtl
show bbc1
etc..
or make an entry in perlbox-voice like this:
command execute
show bbc oneshow bbc1
show rtlshow rtl

and whenever you speak those command words in the mike, mplayer or xine will appear with it!
Now here is the future, and away with the remotes!
If you want no voice control, 'show' has a menu these days, it uses 'dialog'.
Here is my .dialogrc config file, put it in the home dir for the correct colors.

An idea..

There is this article on nytimes.com about this guy who sells this soft that allows one to
view the TV from far away over a DSL line.
Now if you have a DVB card and a DSL connection, you can do it too for free:
First start the listening side (your laptop on DSL for example at your office):
/usr/bin/netcat \
-l \
-p 1234 \
| \
/usr/local/bin/mplayer \
-cache 8000 \
-fs \
-

Have the following script installed on your main computer, and executable:
/usr/bin/nice \
-n -19 \
/usr/local/bin/dvbstream \
-f 11054 \
-p h \
-s 27500 \
-o 160 80 \
-ps \
| \
/usr/local/bin/ffmpeg \
-f mpeg \
-i - \
-f avi \
-vcodec mpeg4 \
-b 800 \
-g 300 \
-bf 2 \
-acodec mp2 \
-ab 128 \
-s 720x576 \
-y \
/dev/fd/1 \
| \
/usr/bin/netcat \
-w 100 \
$1 \
1234

This one is tuned to RTL on 13 east, but you get the idea, the frequency, polarization, symbolrate, apid, and vpid.
'1234' is the port used in this example, use whatever gets you past office firewall etc..

Now telnet to your main computer (the one with the DVB card),
if not logged in as root (X may refuse), do setuid root -

Start the script with as argument the IP address of the laptop.
You can find your own IP address here.

Now after cache fill (a few seconds) you should have RTL on your laptop.

This example assumes your main PC DSL can upload at 1000kbps.
If you have a slower DSL line, the -b 800 is the video bitrate, and the -ab 128 the audio bitrate,
the sum of these should be about 90% of what your DSL can upload.
If you go to even lower bitrates, try a smaller size, with -s 352x288 perhaps, this should allow to 300kbps...
I have tested -b 220 with -ab 56 and -s 400x300 on a 800x600 computer screen, this uses about 280kbps,
and could work even on a DSL line with 315kbps upload.
In all cases the processor power must be enough, I have <70% CPU usage on a Duron 950 in the main PC,
with this low bitrate. These values are likely the minimum usable.
You can test your true DSL speed for example here.
I have only tested on the local machine, just to see if it works.
Look up and read netcat documentation!

back to the regular stuff


These days I use wintv nova with xdipo and kernel 2.6.17.9 #1PREEMPT, and modified the DVB driver (see below).

more info here.
Diseqc-1.2 compatible positioner, recorder, pid filter, also supports goto angle, unlimited timers.
The build in timers automatically steer the dish to a satellite, select a transponder and PIDS, and record the stream.
Supports both GUI and script mode, for example xdipo "13 E" will send the dish to 13 east and exit.
Typing 'xdipo' all by itself shows the GUI, the timers only work in GUI mode, else use crontab.
Build in satellite position calculator.
This version can replace dvbstream if you want to record full transponder from a script.
xdipo also can be used as tuner / recorder without positioner if you have only one LNB.
xdipo records only in .ts (transport stream) format.

Attention,

if you do cat /dev/dvb/adapter0/dvr0 > file.ts and get error 'Value too large for defined data type',
then this indicates a buffer overflow in the DVB driver!
In this case modify dmxdev.h in the DVB driver so it reads:
#define DVR_BUFFER_SIZE (100*188*1024) // was 10*188*1024
You can do this if you have a kernel source >= 2.6 in the driver (check with uname -a):
/usr/src/linux/drivers/media/dvb/dvb-core/dmxdev.h
then recompile (make modules?).
Or if you have an older kernel, you can download the modified driver linux-dvb.2003-11-08-bigger-dvr-buffer.bz2
that I use with kernel 2.4.25.
When recording a full transponder, for example all BBC channels on 10773.00 H on Astra2, I get more then
10 GB / hour, and the driver mod is really needed.
I recommed using xdipo with jpinfo and jpvtx and xvtx-p.

This is the driver I used in the past with the SkyStar1.
dvb-0.9.3-panteltje-0.1.tgz
dvb-driver0.9.3-panteltje driver for Skystar 1 PC DVB-s card,
original from www.linux.tv.org by Ralph Metzler, some mofifications in mpegtools,
modified for kernel 2.4.5, 2.4.20 and 2.4.25, and to work with my defective LNB :-).
You probably want to use a later version from www.linux.tv.org, but the ts2pes
and es_demux or whatever must work with that version.

This is the dvbstream I used with the SkyStar1 and the above driver.
dvbstream-panteltje-0.1.tgz
dvbstream-panteltje is a modified version of the dvbstream from Dave Chapman dave@dchapman.com.
dvbstream-panteltje will only work with the dvb-0.9.3-panteltje-0.1.tgz driver,
so check out the link to the original if you use a different driver.
This allows recording of up to 8 PIDs, so for example 1 video and several audio channels,
or up to 4 video plus audio channels (so 4 programs), from the same transponder.
Modified to also work with kernel 2.4.5.
Dave has made a version for SkyStar2 that gives clean TS and demuxes PIDS, ask him.

But now I do it like this with xdipo:

xdipo \
-l /video/vie-bit-errors.txt \
-g "13 E" \
-c 10 \
-a "4416 4417 4418 4419 4420 4421 4422 4423" \
-o \
-f 12092 \
-p h \
-s 27500 \
> /video/vie-all-languages.ts

This logs bit errors (if any) and the time these occurred,
and that is nice if you have to later process the audio. It positions the dish too.

jpvtx-0.2.1.tgz
Video text decoder specially for budget cards, it accepts transport stream from stdin, and writes that
to stdout, decoding teletext to /video/vtx/1/.
It can be used with jpcam (and then gets the pids from that) or with pid[s] specified on the command line.
To be used with dvbstream, and teletext viewer xvtx-p.

xvtx-p-0.1.1.tgz
Video text viewer to be used with jpvtx.
xvtx-p displays 4 teletext pages at any time. It runs in Xwindows only.

super_demux-0.3.tgz
Super_demux, a better transport stream TS to ES demultiplexor.
This one will produce clean ES where mplayer and ts2pes + es_demux of convergence.de fail.
If you get header problems with the demuxed audio .mp2, run it through mpgedit like this:
mpgedit -e0 q2.mp2
This will produce a correct mp2.
You can find mpgedit here.

xste-3.5.9.tgz
xste-3.5.9 subtitle editor, the latest version with now also output for subtitler-yuv.
Add your own subtitles in your own language, using an audio file as reference.
Changes from 3.5.8: selectable support for both libmpeg3-1.5.3 and libmpeg3-1.7, see xste-3.5.9.lsm.

Now with animation templates, these ONLY works with subtitler-yuv-0.6.5 (or later perhaps).


This is an interim release, with chapters.txt output, for use with dvdwizard by Wolfgang Wershofen.
You can find dvdwizard here: dvdwizard-0.4.2
There is still work in progress on the format for dvdwizard, so thing will change,
many new options have been planned it.
Contact Wolfgang for the latest version.
The xste chapters.txt format is however compatible with dvdwizard and dvdauthor.
Because of the many possibilities, testing is getting more complex, please report any problems.
This will ONLY work with submux-dvd-0.5.1 or later (see link below), or subtitler-0.8.5 (see my subtitle page) for embedded subs.
EBU .STL format output coded, but NOT TESTED, so likely will not work.
In each subtitle you can set font parameters and color (try middle mouse on a browser line).
You can also set character and line spacing in each subtitle.
This version has some anti-aliasing in DVD sub mode, using emphasis2 for grey 50%.
This way the subs on DVD players look nicer.
This version also has a video display in preview! With subs! Using latest mpeg3lib.
Use with tcmplex-panteltje-0.4.7.tgz, submux-dvd-0.5.1 or later, and dvdauthor-0.6.10 or later, or subtitler-yuv-0.6.4.9 or later.

Xste news

Salvador Eduardo Tropea wrote a perl script that he released under the GPL that:
1) Takes a .sub file (submux format) and converts it to the .xml spec for spumux.
2) Converts all the .BMPs into .PNGs with transparency.
He says:
'The conversion is quite lame because I assume a that the transparent color is the RGB FF/00/FF
("pink" used by various tools). I also assume the other colors are solid.'
Well, despite that, it maybe very useful in some cases, you can download it here: xste_sub2xml.pl

Anti aliased subtitles made with xste and menus made with spumux combined in dvdauthor IS POSSIBLE: read more, examples!

The mailing list for xste is NOT WORKING at the moment.

This because of ISP problems and problems with the 'mailman' software.
Email me at cw5o55v02@sneakemail.com if you have questions about xste or other software on this page.




subtitler-yuv-0.6.5.tgz
subtitler-yuv for use with mjpegtools for adding subtitles, pictures, and effects embedded in the picture.

combine_wave-0.3.1.tgz
combine_wave, to sync up 2 audio channels and / or combine 2 mono audio channels into one stereo wave channel,
command line tool.

multimux-0.2.5.2.tgz
multimux-0.2.5.2.lsm lsm info file.
multimux combines up to 8 audio mono wave channels into one big multi channel wave file, that can then be
turned in for example AC3 surround with ffmpeg.
That way you can have an AC3 channel on the DVD that has for example:
front left English, front right Spanish, rear left French, and rear right Italian.
For example in a hall you can have English on the PA, and several headphones for the other three
languages for people from other countries.
5 languages also works OK, use center speaker, but 6 will not work, LFE output is only for low frequencies.
This requires a DVD player with 5.1 channel output, or a 4 channel (at least)
soundcard if you play the DVD or .vob on the PC.
Delays can be specified for each channel, so you can align the sound.
Now with support for files > 2 GB, tested on AMD64 too.
Automatic ffmpeg interface.
command line tool.

pwavecat-0.4.5.tgz
concatenates any number of audio files to stdout.
All input files need to be in the same format (as the first), output file will also be in that format.
command line tool.

substract_wave-0.3.tgz
This program substracts 2 mono wave files from each other by a factor specified on the command line.
It can also add 2 wave files (of half amplitude).
The input files must be in the same format.
This can be used to cancel a background main language in a translation channel.
Here mono stereo via net is an interesting experiment using substract wave.
Here mono stereo via net with AC3 the same experiment with low bitrate AC3.
command line tool.

xpequ audio processor page
xpequ features a 10 band graphics equalizer, oscilloscope, voice level activated recording, ALSA and OSS support
Has GUI and command line mode, can process wave files at > 1 x speed.

If you want to remove hum or some other nasty frequency with harmonics, this could help:
humfilter:
Audio comb filter, programmable frequency, works with wave files and / or stdin to stdout, command line utility.
humfilter-0.1.tgz click here download humfilter.
humfilter-0.1.lsm click here for the lsm info file.

tcmplex-panteltje-0.4.7.tgz
tcmplex-pantelje, audio video multiplexer from the transcode distribution,
re-wrote it for 8 audio channels, this version fixes an AC3 bug causing 'pts moves backward' messages in dvdauthor.
Timing problem with delays fixed, compile problem with gcc-3.3.3 fixed, error if no -c flag fixed.
Patch by Skyttä Ville to make the original tcmplex command line options also work added.

submux-dvd-0.5.2.tgz
submux-dvd, subtitle multiplexer, muxes subtitles into .vob,
based on original 'submux' for CVD and SVCD by unknown author,
changed for DVD muxing and coding support (use only DVD!).
This accepts xste .sub output.
Extensive research on DVD specifications has been done by Adrie Stolk to make this re-write possible.
A Python script for format conversion is being developed by Mike Albon.

dvdauthor
To author a DVD:
If you use tcmplex-panteltje, followed by submux-dvd, you can use dvdauthor-0.5.3.tar.gz or later,
those versions have subtitle support and multiple audio support build in.

cdrecord
To make a video DVD image.

dvd+rw-tools
To burn the image to a DVD+.

dvdimagecmp-0.3.tgz
dvdimagecmp can compare a burned DVD against the original image, to check for any errors (should be zero errors).

ogle
To view the Video DVD on the PC.


osdplay-0.4.tgz
A small utility to add subtitles from a .sub file to mplayer -vo mpegpes via the SkyStar1 DVB-s card.
Colored subtitles supported, xste .sub, and vob2sub (from submux-dvd) .sub output supported.

scripts, these are examples using some of the above software:


A tip, no authoring required!

Do you have a 4.7 GB movie, and want to save it, and no disk space, or perhaps no time for authoring?
If you are going to play back on the PC, no need for authoring! Not even for a filesystem!
growisofs -Z /dev/dvd=my.mpg (or .ts or whatever)
Play back later with:
cat /dev/dvd | nice -n -19 mplayer -cache 8192 -vop pp=0x20000 -
Write on the DVD box what it is! And how to play / get it back.
Note that you can record a whole transponder (say several programs) that way, as transport stream:
dvbstream -f 12092 -p h -s 27500 -o 8192 > my.ts
Write to DVD as above, find the pids, maybe at http://www.kingofsat.net, and write on the DVD box.
Playback the program you want like this:
cat /dev/dvd | ts2pes VPID APID | nice -n -19 mplayer -cache 8192 -vop pp=0x20000 -
This all works because in Unix a device is also a file.

OK now for the DVD stuff that wil play on standalone players

A very complicated script / procedure used to combine a 4 and 7 language transmission, add subs,
correct audio dropouts because of a dropped mpeg2 frame caused by interference in one recording,
and cut start and end, all without video and audio editor!
For the profies and brave, and those who edit text with cat ;-)
(but no audio / video editor beats this for accuracy, it can be done even better with substract-wave,
as the cancellation point is the exact time to the sample).

Generic use of dvbstream (you need an ethernet card).

dvbstream-panteltje -f FREQ -p POL -s SYMBOLRATE -o -v VPID1 -a APID1 VPID2 APID2 VPID3 APID3 VPID4 APID4 > my.ts

Record 1 video and 7 audio channels from satellite into a .ts transport stream from Hotbird 13 east Visions Europe:

# Visions Sundays, Thuesdays, Thursdays, Spanish English French Italian German Portuguese Greek Hebrew
dvbstream-panteltje \
-f 12092 \
-p h \
-s 27500 \
-o \
-v 4416 \
-a 4417 \
4418 4419 4420 4421 4422 4423 \
> /video/vie1-big.ts

Record 4 TV channels with the SkyStar1 at once from the same transponder into a .ts transport stream:

dvbstream-panteltje -f FREQ -p POL -s SYMBOLRATE -o -v VPID1 -a APID1 VPID2 APID2 VPID3 APID3 VPID4 APID4 > my.ts

Extract a TV channel or audio channel from the recorded transport stream:

cat my.ts | ts2pes VPID APID > my.pes
It is then recommended to take the my.pes, and correct it with PVAstrumento either in MS windows or
Linux wine (windows emulator), this will adjust AV sync, and also in case of distorted signal due to poor
reception, keep A/V synchronized.
Do this ONLY for the first APID!
(the convergence driver does not seem to give correct timing info in the 3rd and higher apids).

Or play it directly with mplayer:
cat my.ts | ts2pes VPID APID | mplayer -

From here you can go 2 ways:
Either record the my.ts directly as a file to a DVD (data), and play back as above for the audio
and video PID you want (copy to hard disc perhaps for short access times / un-interrupted play),
or follow the below procedure to make a Video DVD (plus or min).
(All my latest archives are on data DVD+R with .ts format).
I use DVD+RW as video DVD, so I can, if I think of something new, make new video DVDs).

Extract a clean mpv and mp2 from the (perhaps corrected) .pes:

es_demux my.pes my.mp2 my.mpv
Do this for each audio pid if multiple audio pids.

If you are going to use xste to write your own subs, make a 44100 wave file from each audio mp2:

mpg123 -w sound-48000.wav $1
sox sound-48000.wav -r 44100 sound.wav resample

Sync audio 2 through 8 against audio 1 with combine_wave:

sync wave PID 4417 is reference, for all PIDs
combine_wave -a -l 4417.wav -r 4419.wav -k -s 30000000 | play
Adjust the delay until left and right audio matches, and note the delays!
You will need these in the multiplexers.

Make a multichannel ac3 surround file with one language on each speaker

In such a case, make a mono .wave first like this (here I only use the right channel, see man sox):
sox english.wav -c 1 english-only.wav avg -r
sox greek.wav -c 1 greek-only.wav avg -r
sox italien.wav -c 1 italien-only.wav avg -r
sox hebrew.wav -c 1 hebrew-only.wav avg -r
# make 4 channel surround wave channel, the delays you can find with combine-wave.
multimux -d 0,0,0,0 \
-o english-greek-italien-hebrew.wav \
english-only.wav greek-only.wav italien-only.wav hebrew-only.wav
Now use ffmpeg to make a Dolby 5.1 surround ac3 file, with 4 channels like this:
ffmpeg -i english-spanish-french-italian.wav -ab 256 -ac 4 -acodec ac3 english-spanish-french-italian.ac3
This will give you english-greek-italien-hebrew.ac3, which you can mux with tcmplex-panteltje,
just like the .mp2.
It is possible to mix mp2 and ac3 in the multiplex.
You can play ac3 in Linux with a52dec, you can also use that to convert from ac3 to wave.
The latest version of mjpegtools mplex also works very well with dvdauthor, but you cannot specify delays
in the same way.
You can however cut the language files with wavcut, so these start earlier, and then use multimux.
In wavcut use -bs xxx, where xxx = 48 x the delay in milliseconds (because 1 second is 48000 samples,
1ms is 48 samples, in case of 48000 audio from satellite).

Perhaps add in screen subtitles and effects to .mpv (mpeg2 stream) with subtitler-yuv (from xste .ppml output):

see the subtitler-yuv docs.

Mux 1 video and 8 audio channels (1 x mpeg2 + 5 x mp2 2 channel + 3 x ac3 4 channel) into a .VOB:

tcmplex-panteltje \
-m d \
-o ./movie-8-audio.vob \
-i 4416.mpv \
-0 english-spanish.mp2 \
-1 english-french.mp2 \
-2 english-german.mp2 \
-3 english-italien.mp2 \
-4 english-portuguese.mp2 \
-5 english-spanish-french-german.ac3 \
-6 english-greek-italien-hebrew.ac3 \
-7 english-greek-italien-portuguese.ac3 \
-D 820,285,1000,155,155,253,278,301 \
-c 0-3600

Multiplex a spu (add a subtitle) channel from xste .sub source into an existing .VOB:

# make infile.sub with xste submux output, settings DVD
# run in directory where infile.sub and the bitmaps are:
submux-dvd infile.vob infile.sub outfile-subbed.vob

Make a video-DVD from a .VOB with several audio and subpicture channels:

dvddirgen
dvdauthor -a ac3+en+2ch,ac3+es+2ch,ac3+fr+2ch,ac3+de+2ch,ac3+it+2ch,ac3+4ch,ac3+4ch,ac3+4ch -s nl,xx -p xste-palette.dat peace_needs_to_be_felt_surround.vob
# Note the previous, starting with dvdauthor, should be ONE big line, some browsers will reformat!!
# xste-palette.dat is generated by xste, this if you made your own subs.
dvdauthor -T

Image a DVD Video:

mkisofs -dvd-video DVDDIR(as in dvddirgen) > /video/dvd_images/dvd_image

Burn a DVD+ Video DVD (just an other one) from the image:

IMAGEDIR=/video/dvd_images
echo "Ready to burn DVD+."
echo
echo "Insert a clean DVD+R or DVD+RW."

let cd_type=2
echo "Are you using a DVD+R y/n?"
read user_reply

if [ "$user_reply" = "y" ]
then
let cd_type=0
fi

if [ $cd_type -ne 0 ]
then
echo "Are you using an UNFORMATTED DVD+RW(y/n)? (Note: used DVD+RW *IS* formatted)"
read user_reply

if [ "$user_reply" = "y" ]
then
let cd_type=1
fi
fi

if [ $cd_type -eq 0 ]
then
echo "DVD+R"
elif [ $cd_type -eq 1 ]
then
echo "New DVD+RW, formatting will be done."
else
echo "Formatted DVD+RW, erasing of old data will be done."
fi

echo
echo PLEASE DO NOT USE COMPUTER AND DO NOT BUMP OR VIBRATE WHILE BURNING DVD
echo
echo "Press to continue or press Ctrl-C to quit."
read user_reply

echo "******************** C O M M I T ********************"
echo
echo Starting DVD burning process
echo
echo Wait for message Ready!!! Do not stop before that!!!
echo

if [ $cd_type -eq 0 ]
then
echo "DVD+R setting CDROM flag."
dvd+rw-booktype -dvd-rom -unit+r /dev/dvd

growisofs -dvd-video -Z /dev/dvd=$IMAGEDIR/dvd_image
elif [ $cd_type -eq 1 ]
then
echo "New DVD+RW formatting."
dvd+rw-format /dev/dvd

growisofs -dvd-video -Z /dev/dvd=$IMAGEDIR/dvd_image

echo "Setting CDROM flag."
dvd+rw-booktype -dvd-rom -media /dev/dvd
elif [ $cd_type -eq 2 ]
then
echo "Formatted DVD+RW."
growisofs -dvd-video -Z /dev/dvd=$IMAGEDIR/dvd_image

echo "Setting CDROM flag"
dvd+rw-booktype -dvd-rom -media /dev/dvd
else
echo "Weard error"
exit
fi

eject /dev/dvd
echo Ready

Verify a DVD (video) byte by byte:

dvdimagecmp /dev/dvd /video/dvd_images/dvd_image

Play a DVD with ogle.


Play a multi audio channel DVD with mplayer on the PC via /dev/dsp2 using de-interlace:

WARN subtitle timing in latest mplayer MPlayer 1.0pre4-2.95.3 seems broken!

echo "title number? (1, 2, 3 etc..)"
read title_number
echo "language number? (use mplayer -v /dev/dvd to list ac3 audio stream IDs)"
read language_number
echo "subtitle number?"
read subtitle_number
mplayer \
-dvd $title_number \
-aid $language_number \
-sid $subtitle_number \
-ao oss:/dev/dsp2 \
-channels 6 \
-vop pp=0x20000 \
-fs /dev/dvd

See also my subtitle page for CVD and SVCD and more on subtitler, and my satellite page.



I here want to thank all Linux authors and also the authors of PVAstrumento and BeSweet (windows),


and the great hackers in alt.satellite.tv.crypt for all cool contributions,


also Adrie for doing research on the DVD specifications, and giving valuable info.


Also You Know Who for the inspiration.

Click here to send mail