| 1 |
|
| 2 |
README.subtitles |
| 3 |
- modifications by Roland Stadtmueller ([email protected]) . 2010/03/13 |
| 4 |
|
| 5 |
Intention: |
| 6 |
========== |
| 7 |
|
| 8 |
The intention of the adding subtitle support was to enable mplex to mux all streams |
| 9 |
necessary for a DVD so that the mpeg2 stream created can be used directly for |
| 10 |
further dvd creation. Please be aware that i do not use the term "authoring" |
| 11 |
|
| 12 |
Limitations: |
| 13 |
=========== |
| 14 |
mplex does NOT support the creation, editing or rendering of subtitles and menues yet. |
| 15 |
It is still - and will probably always be - a muliplexer tool. |
| 16 |
This means, that you need a handy binary subtitle stream at hand to be able to mplex |
| 17 |
them into your target stream, text-based subtitle formats are not supported. |
| 18 |
|
| 19 |
Palette handling |
| 20 |
================ |
| 21 |
DVD's have their color palettes (color definitions for subtitles) in the PGC structure |
| 22 |
(part of the IFO file). As mplex does not know about IFO there's no palette handling |
| 23 |
within mplex. Fortunately enough, stand-alone players define a default palette for |
| 24 |
subtitles. Within dvdauthor you can add a palette using the "-p" switch. |
| 25 |
|
| 26 |
Supported formats: |
| 27 |
================== |
| 28 |
Currently only PS1 streams as generated by tcextract (from transcode > 0.6.x) are |
| 29 |
supported. As tcextract extracts the ps1 stream from a program stream, all other |
| 30 |
binary formats are supported indirectly whenever tcextract can extract them accordingly |
| 31 |
(see format details) |
| 32 |
|
| 33 |
|
| 34 |
What is it then all about? |
| 35 |
========================== |
| 36 |
For subtitle multiplexing, mplex takes a subtitle stream created by tcextract |
| 37 |
(from the transcode package) and multiplexes it into the target stream. |
| 38 |
The syntax is pretty much the same as you already know from mplex with following additions: |
| 39 |
|
| 40 |
--subpicture-delay |-d <delay [suffix]>[:<stream-id>] [, [...]] |
| 41 |
|
| 42 |
Specifies the offset between start of the subtitle and the video. This is necessary as in |
| 43 |
real life the subtitles do not begin exactly with the start of the video but some seconds |
| 44 |
later. There's no automatic way to detect the correnct value, so you have to play around |
| 45 |
a bit within your mplex'ed video. |
| 46 |
|
| 47 |
You can specify following suffixes to the delay: |
| 48 |
* ms <default> : sync offset in milliseconds |
| 49 |
* s : sync offset in seconds |
| 50 |
* mpt : sync offset in 90KHz ticks |
| 51 |
* c : sync offset in 90KHz*300 ticks |
| 52 |
|
| 53 |
The optional subtitle stream-id overrides the subtitle stream id as provided in the source stream |
| 54 |
(aka mappping). |
| 55 |
Valid subtitle stream are in a range of 32-63 (including). |
| 56 |
|
| 57 |
You may want to specify each stream you mplex, use "," to delimit each stream. |
| 58 |
|
| 59 |
Example given: |
| 60 |
If you want to mux one video, one audio and two subtitle streams having delays of 500 and 1000 ms, |
| 61 |
the first shall have id 32, the second is 33 (Subtitle stream 0 and 1): |
| 62 |
|
| 63 |
$ mplex -f 8 -o my_mpeg.mpeg -d 500:32,100:33 video_in.mpv audio_in.m2a subtitle_0.ps1 subtitle_1.ps1 |
| 64 |
|
| 65 |
|
| 66 |
Creating subtitle PS1 streams with transcode |
| 67 |
============================================ |
| 68 |
This is a quite simple approach: |
| 69 |
|
| 70 |
$ tcextract -i chapter_5.vob -a 0x21 -x ps1 > chp5_1.ps1 |
| 71 |
extracts subtitle 1 (id 33) from chapter_5.vob into the chp5_1.ps1 |
| 72 |
|
| 73 |
If you have a VObSub file (these are the ones coming with "*.sub + *.idx" suffixes), you can do the same: |
| 74 |
|
| 75 |
$ tcextract -i subtitle.sub -a 0x20 -x ps1 > chp5_1.ps1 |
| 76 |
There's no need for the idx file here. |
| 77 |
|
| 78 |
By the way, you can create a vobsub (*.sub + *.idx) file by using subtile2vobsub (included in the subtitleripper package) |
| 79 |
|
| 80 |
The biggest drawback for now: as far as i know there's no (*NIX-) possibility to create ps1/vobsub streams directly from |
| 81 |
text based subtitles. All the tools i know (mplayer, spumux) expect to have at least a program stream to cope with. |
| 82 |
If you have (even a empty, useless ) stream, you can tcextract again. |
| 83 |
|
| 84 |
PS 1 stream format (from tcextract) |
| 85 |
=================================== |
| 86 |
(this should go to transcode, but anyway...) |
| 87 |
Each subtitle entry starts with the tag "SUBTITLE", followed by a header entry: |
| 88 |
typedef struct { |
| 89 |
|
| 90 |
unsigned int header_length; |
| 91 |
unsigned int header_version; |
| 92 |
unsigned int payload_length; |
| 93 |
|
| 94 |
unsigned int lpts; |
| 95 |
double rpts; |
| 96 |
} subtitle_header_v3_t; |
| 97 |
|
| 98 |
The header version is 0x00030000. The header_length specifies the length of the header w/o "SUBTITLE" and might |
| 99 |
point behind the header struct (enclosing additional data). The header_data points to the beginning of the subtitle entry. |
| 100 |
The subtitle entry length is specified by.payload_length. The "Subtitle entry" is the full subtile includung control |
| 101 |
sequences and RLE-coded pictures as used in dvd subtitles (The "Subtitle entry" is a 1:1 copy of the source stream actually). |
| 102 |
"lpts" and "rpts" is the presentation time stamp of subtitle. LPTS seems to be the old fashioned way to do it and is not |
| 103 |
in use anymore. |
| 104 |
|
| 105 |
|