Allow size-specific resizers
[jpcrr.git] / streamtools / new-jpcrr-dumpformat
blob5bbc8dc5b2e12c68b07ba014ba981dad6b727e9d
1 Idea for new JPC-RR dumpformat:
3 All numbers are big-endian.
5 BYTE is 1 byte, WORD is 2, DWORD is 4, QWORD is 8.
7 VARIABLE has bit 7 set for all but the last byte, and only 7 low bits in each
8 byte .contribute.
10 Main file structure:
11 * Magic: FFFFh JPCRRMULTIDUMP
12 * Number of channels (WORD). Must be nonzero.
13 * Channels table (consists of channel elements)
14 * Data table (consists of data elements and special elements)
16 Channel element structure:
17 * Channel number (WORD, FFFFh is reserved an MUST NOT be used) All channel
18   numbers must be unique within segment, but there are no uniqueness requirements
19   between segments.
20 * Channel type (WORD):
21 ** 0000h                Video output channel.
22 ** 0001h                PCM audio output channel.
23 ** 0002h                FM audio output channel.
24 ** 0003h                Dummy channel.
25 ** 0004h                Subtitle channel.
26 ** 0005h                Runinfo channel.
27 ** All other values are reserved.
28 * Channel name length. WORD, 0 if channel has no name.
29 * Channel name (UTF-8, channel name length bytes).
31 Special element (time skip):
32 * Magic: FFFFFFFFFFFFh
34 Signals that no events occur in 2^32-1 ns. Last known timestamp is updated.
36 Special element (segment restart):
37 * Magic: FFFFh JPCRRMULTIDUMP
39 Signals that new segment begins from here. Channel tables are reset. Stream
40 base time will be time of last event in current segment.
42 Data element structure:
43 * Channel number. WORD, FFFFh MUST NOT be used.
44 * Time in nanoseconds (DWORD) relative to last known timestamp (will be
45   updated)
46 * Event subtype (BYTE)
47 * Event data size (VARIABLE, not including headers).
48 * Event data (format channel/subtype dependent)
50 Channel type 0 subtypes 0-1 (Frame)
52 * Frame width (WORD)
53 * Frame height (WORD)
54 * Frame data. What's exactly here depends on subtype:
55 ** subtype 0: Raw RGBx video data.
56 ** subtype 1: RGBx video data with zlib compression
58 Channel type 1 subtype 1 (PCM sample)
60 * Left sample (signed WORD)
61 * Right sample (signed WORD)
63 Channel type 2 subtype 1 (FM low write)
65 * Register to write (BYTE)
66 * Value to write (BYTE)
68 Channel type 2 subtype 2 (FM high write)
70 * Register to write minus 256 (BYTE).
71 * Value to write (BYTE).
73 Channel type 2 subtype 3 (FM Reset)
75 * No data.
77 Channel type 1 subtype 0 or channel type 2 subtype 0 (set volume)
79 * Left volume numerator (DWORD).
80 * Left volume denumerator (DWORD).
81 * Right volume numerator (DWORD).
82 * Right volume denumerator (DWORD).
84 Channel type 3 subtypes 0-255:
86 * Ignored
88 Channel type 4 subtype 0 (Subtitle)
90 * Length of subtitle display (QWORD)
91 * UTF-8 encoded text to use as subtitle.
93 Channel type 5 subtype 71 (Game name)
95 * UTF-8 encoded game name.
97 Channel type 5 subtype 76 (Length)
99 * Length of run in nanoseconds (QWORD).
101 Channel type 5 subtype 82 (Rerecords)
103 * Number of rerecords (QWORD).
105 Channel type 0 subtype 3-255, channel type 1 subtype 2-255, channel type
106 2 subtype 4-255, channel type 4 subtypes 1-255 (reserved) and other
107 channel type 5 subtypes are reserved.
111 These are reserved.
113 Picturestodump options:
114 -----------------------
115 Syntax: picturestodump.exe <options> <input>... <output>
117 The image input is PxM P1-P6 files. The specified images are converted into
118 video dump stream.
120 Valid <options> are:
121 --fps=<fps>
122                 Assume framerate of <fps>. Default 60.
124 Tip: Static 2s image can be created with:
126 picturestodump.exe --fps=0.5 image.ppm static.dump
128 Audiotodump options:
129 --------------------
130 Syntax: audiotodump <options> <input> <channel> <output>
132 The input is RAW audio data. It is converted into audio dump stream with
133 specified channel <channel> of PCM type.
135 Valid <options> are:
136 --rate=<rate>
137                 Assume input rate of <rate>. Default 44100.
138 --8bit
139                 Assume 8bit input.
140 --16bit
141 --16bit-little-endian
142                 Assume 16bit little-endian input. Default.
143 --16bit-big-endian
144                 Assume 16bit big-endian input.
145 --stereo
146                 Assume stereo input. Default.
147 --stereo-swapped
148                 Assume swapped-channel stereo input.
149 --mono
150                 Assume mono input.
151 --signed
152                 Assume signed input. Default.
153 --unsigned
154                 Assume unsigned input.
155 --volume=<lvol>,<rvol>
156                 Write initial volume change with left volume <lvol> and right volume <rvol>.
157 --volume=<vol>
158                 Write initial volume change with left volume <vol> and right volume <vol>.
160 mknulldump options:
161 -------------------
162 Syntax: mknulldump.exe <length> <output>
164 Makes null dump of <length> seconds and writes it into <output>
166 Demuxdump options:
167 ------------------
168 Syntax: demuxdump.exe <input> <channel> <output>
170 Writes data for channel <channel> from <input> into <output>.
172 Muxdump options:
173 ----------------
174 Syntax: muxdump.exe <input>... <output>
176 Reads <input> files and muxes the channels, writing result to <output>.
178 Cutdump options:
179 ----------------
180 Syntax: cutdump.exe <input> <low> <high> <output>
182 Cuts range <low>-<high> from <input> and writes it to <output>.
184 Fmtopcm options:
185 ----------------
186 Syntax: fmtopcm.exe <input> <channel> <rate> <output>
188 Decodes channel <channel> from <input> as FM and and writes PCM version of
189 it (at specified rate <rate>) together with other channels into <output>.
191 Dumpconvert options:
192 --------------------
193 Input options:
194 --input=<file>
195                 Read input from <file>. If multiple files are specified, they are treated as concatenation.
197 Output options:
198 --output-rawaudio=<file>
199                 Dump the processed audio to <file> in raw format.
200 --output-wav=<file>
201                 Dump the processed audio to <file> in wav format.
202 --audio-rate=<rate>
203                 Specify the rate to sample audio at. Default is 44100. Can be specified at most once.
204 --output-rawrgbx=<file>
205                 Dump the raw RGBx video data to <file>
206 --output-timecodev2=<file>
207                 Dump the timecode data in v2 format to <file>
208 --output-srt=<file>
209                 Dump the subtitlte data in srt format to <file>.
210 --audio-delay=<delay>
211                 Delay the audio by specified amount of seconds. Can be negative.
212 --subtitle-delay=<adjust>
213                 Adjust the subtitle timing by <adjust> seconds.
216 Video scaling options:
217 --video-width=<width>
218                 Rescale the video width to <width>.
219 --video-height=<height>
220                 Rescale the video height to <height>.
221 --video-scale-algo=<algo>
222                 Set the rescale algo.
223 --video-framerate=<fps>
224                 Output video at specified framerate <fps>. Default is 60. Exclusive with
225                 --video-max-dedup.
226 --video-framerate=auto
227                 Enables variable-fps mode (useful to enable it without turning on dedupping).
228 --video-max-dedup=<frames>
229                 Number of consequtive frames that can be elided by dedupping. Setting this to 0
230                 disables dedupping entierely. Setting this to nonzero enables variable-fps mode.
231                 Default 0.
233 Audio processing options:
234 If <channel> is specified, the processing occurs on specified channel before mixing. Otherwise it occurs after
235 mixing. The filtering on individual channels and in output occurs in order filters are specified in command
236 line.
238 --audio-mixer-filter=[<channel>:]<a0>,<a1>,...
239 --audio-mixer-filter=[<channel>:]<a0>,<a1>,...;<b0>,<b1>,...
240                 Perform FIR filitering (y0 = a0*x0 + a1*x1 + ... + an*xn).
241                 Perform IIR filitering (b0*y0 + b1*y1 + ... bm*ym = a0*x0 + a1*x1 + ... + an*xn).
242 --audio-mixer-attenuate=[<channel>:]<amount>
243                 Attenuate sound by <amount> decibels.
244 --audio-mixer-gain=[<channel>:]<amount>
245                 Amplify sound by <amount> decibels.
246 --audio-mixer-silence=
247 --audio-mixer-silence=<channel>:
248                 Silence the sound.
250 Video processing options:
251 --video-hardsub-font=<file>
252                 Use the specified font for hardsubs.
253 --video-hardsub-size=<size>
254                 Set the font point size for hardsubs. Default is 16.
255 --video-hardsub-xpos=<pixels>
256                 Place the left edge of hardsubs at this x-coordinate.
257 --video-hardsub-xpos=left
258                 Place the left edge of hardsubs at display left edge.
259 --video-hardsub-xpos=center
260                 Place the left edge of hardsubs so that subs are centered. Default.
261 --video-hardsub-xpos=right
262                 Place the left edge of hardsubs so that sub right edge is at display right edge.
263 --video-hardsub-ypos=<pixels>
264                 Place the top edge of hardsubs at this y-coordinate.
265 --video-hardsub-ypos=top
266                 Place the top edge of hardsubs at display top edge.
267 --video-hardsub-ypos=center
268                 Place the top edge of hardsubs so that subs are centered.
269 --video-hardsub-ypos=bottom
270                 Place the top edge of hardsubs so that sub bottom edge is at display bottom edge. Default.
271 --video-hardsub-duration=<duration>
272                 Set the display duration for hardsubs to <duration> seconds. Default 5.
273 --video-hardsub-halo=<thickness>
274                 Set the halo thickness. 0 disables halo. Default 0.
275 --video-hardsub-foreground-color=<a>
276 --video-hardsub-foreground-color=<rgb>,<a>
277 --video-hardsub-foreground-color=<r>,<g>,<b>
278 --video-hardsub-foreground-color=<r>,<g>,<b>,<a>
279                 Set the color at characters to specified color. If color is not specified, it defaults to white.
280                 If alpha is not specified, it defaults to 255 (opaque).
281 --video-hardsub-halo-color=<a>
282 --video-hardsub-halo-color=<rgb>,<a>
283 --video-hardsub-halo-color=<r>,<g>,<b>
284 --video-hardsub-halo-color=<r>,<g>,<b>,<a>
285                 Set the color at halo to specified color. If color is not specified, it defaults to black.
286                 If alpha is not specified, it defaults to 255 (opaque).
287 --video-hardsub-background-color=<a>
288 --video-hardsub-background-color=<rgb>,<a>
289 --video-hardsub-background-color=<r>,<g>,<b>
290 --video-hardsub-background-color=<r>,<g>,<b>,<a>
291                 Set the color at background to specified color. If color is not specified, it defaults to black.
292                 If alpha is not specified, it defaults to 0 (transparent).
293 --video-hardsub-textalign=<align>
294                 Set text alignment to <align>. Valid values are 'left' (align left), 'center' (center the text)
295                 and 'right' (align right). Default is 'center'.
296 --video-hardsub-spacing=<spacing>
297                 Set text line spacing. Default is 1.
298 --video-hardsub-text=<timecode>,<text>
299                 Place the text <text> at timecode <timecode>. '\\' stands for backslash. '\n' stands for newline.
300 --video-hardsub-reset
301                 Reset all hardsub settings that have defaults to their defaults.
302 --video-hardsub-push
303                 Push all hardsub settings into temporary storage stack.
304 --video-hardsub-pop
305                 Pop all hardsub settings from temporary storage stack.
306 --video-hardsub-script=<file>
307                 Read <file> as hardsub commands.
309 Note: --video-hardsub uses the previous value of each setting. If none is set, defaults are used.
312 dumpplayback options:
313 ---------------------
314 Syntax: dumpplayback <common options> <playback options> <input>...
316 Plays back concatenation of <input>s. <common options> is any of the audio or video processing options
317 in dumpconvert.
319 Playback options:
320 --speed=<speed>
321                 Play at <speed> percent speed. Default 100.