Streamtools: Refactor rescaling code
[jpcrr.git] / streamtools / manual.txt
blob3e66b60b61f7aa53c44ae4673e310c76d074b4b2
1 Dumping processing tools manual
3 1 Concatenating dumps
5 Concatenation of dump files is concatenation of their contents. 
6 So cat and similar tools can be used to concatenate dumps.
8 2 Brief description of tools
10 • audiotodump.exe - Convert raw PCM audio to dump file.
12 • cutdump.exe - Save section of dump file to another.
14 • demuxdump.exe - Save stream from dump file to another.
16 • dumpconvert.exe - Convert dump files to variety of formats.
18 • dumppackets.exe - Dump contents of dump in textual form (meant 
19   for debugging).
21 • fmtopcm.exe - Convert individual FM-type stream into PCM-type 
22   stream.
24 • guessresolution.exe - Try to guess resolution of video.
26 • mknulldump.exe - Make empty dump of specified length.
28 • muxdump.exe - Mux streams from multiple dumps together.
30 • picturestodump.exe - Make dump with specified image or 
31   animation.
33 • playdump.exe - Play dump in realtime.
35 • testresizer.exe - Test various resizer algorithms on still 
36   image (meant for debugging).
38 3 audiotodump.exe
40 Converts raw PCM audio to dump file containing said audio as PCM 
41 audio track.
43 Syntax: audiotodump.exe <options> <input> <stream> <output>
45 Convert raw PCM audio from file <input> to dump named <output>. 
46 The audio data is placed as PCM-type stream named <stream>.
48 3.1 Options
50 3.1.1 --8bit
52 Assume that samples in file are 8 bits per channel.
54 3.1.2 --16bit
56 See --16bit-little-endian
58 3.1.3 --16bit-little-endian
60 Assume that sample in file are 16 bits per channel and 
61 little-endian. This is the default.
63 3.1.4 --16bit-big-endian
65 Assume that sample in file are 16 bits per channel and 
66 big-endian.
68 3.1.5 --mono
70 Assume that samples in file have only one channel.
72 3.1.6 --stereo
74 Assume that samples in file have two channels in order left, 
75 right, left, right,... This is the default.
77 3.1.7 --stereo-swapped
79 Assume that samples in file have two channels in order right, 
80 left, right, left...
82 3.1.8 --signed
84 Assume that samples in file are signed. This is the default.
86 3.1.9 --unsigned
88 Assume that samples in file are unsigned.
90 3.1.10 --rate=<rate>
92 Assume that sampling rate in input file is <rate> Hz.
94 3.1.11 --volume=<left>,<right>
96 Write initial volume <left> for left channel and <right> for 
97 right channel to output.
99 3.1.12 --volume=<volume>
101 Write initial volume <volume> for both channels to output.
103 4 cutdump.exe
105 Copies section out of the dump.
107 syntax: cutdump.exe <input> <start> <end> <output>
109 Cuts section <start> to <end> from dump <input> and saves it to 
110 <output>.
112 <start> and <end> are specified in nanoseconds if these don't 
113 contain '.'. Otherwise these are assumed to be in seconds. So for 
114 example both 100000000 and 0.1 signifies 0.1s point.
116 5 demuxdump.exe
118 Copies stream out of the dump.
120 syntax: demuxdump.exe <input> <stream> <output>
122 Copies stream <stream> from dump <input> and saves it to 
123 <output>.
125 6 dumpconvert.exe
127 The main dump to other formats converter.
129 syntax: dumpconvert.exe <options> [<subtitle options>...] [<audio 
130 options>...] <files>...
132 Convert <files>... into other formats. Note that this tool takes 
133 subtitle and audio options (and that they are shared with 
134 playdump.exe).
136 6.1 Options
138 6.1.1 --video-width=<width>
140 Set video output width to <width>. No default, must be specified.
142 6.1.2 --video-height=<height>
144 Set video output height to <height>. No default, must be 
145 specified.
147 6.1.3 --video-framerate=<fps>
149 Set video output fps to <fps>. <fps> can also be 'auto' to allow 
150 variable-framerate output. Default is fixed 60fps.
152 6.1.4 --video-scale-algo=<algo>
154 Set video scaling algorithm to <algo>. Currently following 
155 algorithms are available:
157 • 'nearest' (nearest neighbor)
159 • 'bilinear' (bilinear interpolation)
161 • 'average' (weighted average of covered pixels)
163 • 'lanczos1', 'lanczos2', 'lanczos3', 'lanczos4', 'lanczos5' 
164   (higher-quality resizeers)
166 • 'xdrop9' (drop every 9th column followed by nearest neighbor, 
167   handy for matching 720x400 text mode with 640x400 GFX mode)
169 • 'hqx2', 'hqx3', 'hqx4', 'hqx22', 'hqx32', 'hqx42', 'hqx2d', 
170   'hqx3d', 'hqx4d' (HQx resizers; requires compile with HQx 
171   support).
173 6.1.5 --video-scale-algo=”<algo> <width> <height>”
175 Set video scaling algorithm to <algo> for frames that are <width> 
176 by <height> (i.e. set special scaler for specific resolution).
178 6.1.6 --video-max-dedup=<dedup>
180 Allow up to <dedup> consequtive frames to be elided if they are 
181 indentical to previous (truly identical, not just “identical”). 
182 Requires variable framerate output.
184 6.1.7 --audio-delay=<delay>
186 Delay audio by <delay> nanoseconds/seconds (seconds if <delay> 
187 has '.', nanoseconds otherwise). Delay may be negative.
189 6.1.8 --subtitle-delay=<delay>
191 Delay subtitles by <delay> nanoseconds/seconds (seconds if 
192 <delay> has '.', nanoseconds otherwise). Delay may be negative.
194 6.1.9 --output-<format>=<filename>[,<parameters>]
196 Output to <filename> in format <format>. <parameters> is 
197 format-dependent parameters.
199 6.2 Output formats
201 6.2.1 oggenc
203 syntax: 
204 --output-oggenc=<filename>[,<oggenc-option>[,<oggenc-option[...]]]
206 Pipe audio to oggenc in order to encode OGG Vorbis to <filename>. 
207 Note that audio bitrate and format is automatically set 
208 correctly. For oggenc options in form --foo=bar, use foo=bar as 
209 <oggenc-option>. For oggenc options of form --baz, use baz as 
210 <oggenc-option>
212 6.2.2 rawaudio
214 syntax: --output-rawaudio=<filename>
216 Write 16-bit stereo little-endian signed audio track in raw 
217 format to <filename>.
219 6.2.3 rawi420
221 syntax: --output-rawi420=<filename>
223 Write video in raw I420 format to <filename>
225 6.2.4 rawi420-uvswap
227 syntax: --output-rawi420-uvswap=<filename>
229 Write video in raw I420 format to <filename>. Red and blue are 
230 swapped.
232 6.2.5 rawrgbx
234 syntax: --output-rawrgbx=<filename>
236 Write video in raw RGBx format to <filename>.
238 6.2.6 timecodev2
240 syntax: --output-timecodev2=<filename>
242 Write video timestamp data in v2 format to <filename>. Very 
243 useful for automatic-/variable-fps encoding.
245 6.2.7 wav
247 syntax: --output-wav=<filename>
249 Write audio in wav form to <filename>. Note that files with over 
250 1 billion samples are not written properly.
252 6.2.8 x264
254 syntax: 
255 --output-x264=<filename>[,<x264-option>[,<x264-option[...]]]
257 Pipe video to x264 in order to encode h.264 to <filename>. Note 
258 that video size is automatically set correctly. For x264 options 
259 in form --foo bar, use foo=bar as <x264-option>. For x264 options 
260 of form --baz, use baz as <x264-option>. 
262 BUG: Framerate is not set correctly automatically.
264 6.2.9 faac
266 syntax: --output-faac=<filename>[,<option>[,<option>[...]]]
268 Pipe audio to faac in order to encode AAC to <filename>. 
269 Interesting options include 'q=<quality>' (set quality), 
270 'c=<freq>' (force bandwidth, default is autodetect).
272 7 dumppackets.exe
274 Dump the stream in textual format (useful for debugging):
276 syntax: dumppackets.exe <file>
278 Dumps the data in <file> in textual form.
280 8 fmtopcm.exe
282 Convert given stream from FM format to PCM format (this is mainly 
283 useful for dumps somehow containing multiple FM streams).
285 syntax: fmtopcm.exe <input> <stream> <rate> <output>
287 Reads dump from <input> and converts FM output on stream <stream> 
288 into PCM output at sampling rate <rate>. The output (all other 
289 streams plus converted stream) is written to <output>.
291 9 guessresolution.exe
293 Try to guess proper encoding resolution from dump.
295 sytax: guessresolution.exe <files>...
297 Read given files <files>... and try to guess the proper 
298 resolution.
300 10 mknulldump.exe
302 Make empty clip of specified length.
304 syntax: mknulldump.exe <length> <output>
306 Make empty clip of <length> nanoseconds (seconds if <length> 
307 contains dot) and write it to <output>.
309 11 muxdump.exe
311 Mux multiple dumps into one.
313 syntax: muxdump.exe <input>... <output>
315 Read dump files <input>... and combine streams, writing result to 
316 <output>.
318 12 picturestodump.exe
320 Transform set of pictures into dump.
322 syntax: picturestodump.exe [--fps=<fps>] <input>... <output>
324 Reads pictures from <input>... and writes dump at <fps> (defaults 
325 to 60 if not specified) to <output> containing those pictures.
327 13 playdump.exe
329 Play dump in realtime.
331 syntax: playdump.exe [<subtitle options>...] [<audio options>...] 
332 [--audio-rate=<rate>]
334 [--speed=<percent>] <files>...
336 Play concatenation of <files>... at <percent>% realtime speed 
337 (default 100%). Use <rate> Hz for audio sampling rate (default 
338 44100Hz). Note that this command accepts audio and subtitle 
339 options.
341 14 testresizer.exe
343 Resize image and show result. This is mainly intended for 
344 debugging resizers.
346 syntax: testresizer.exe <image> <algo> <width> <height>
348 Read <image> and resize it to <width> by <height> using algorithm 
349 <algo> (see dumpconvert.exe option --video-scale-algo for 
350 possible algorithms). Then display the result on screen.
352 15 Audio processing options
354 Audio processing has three stages:
356 • Per-stream premix filtering
358 • Mixing
360 • Postmix filtering.
362 For each, the operations are done in order they are given on 
363 command line. If <stream> is specified for some operation, it 
364 occurs as part of premix filtering for that stream. Otherwise it 
365 occurs as postmix filtering.
367 15.1 --audio-mixer-filter=[<stream>:]<a0>,<a1>,...
369 Perform FIR filtering using coefficients <a0>, <a1>, ..., given 
370 in order of increasing delay.
372 15.2 --audio-mixer-filter=[<stream>:]<a0>,<a1>,...;<b0>,<b1>,...
374 Perform IIR filtering using input coefficents <a0>, <a1>, ..., 
375 output coefficients <b0>, <b1>,... given in order of increasing 
376 delay.
378 15.3 --audio-mixer-gain=[<stream>:]<gain>
380 Amplify signal by <gain> dB.
382 15.4 --audio-mixer-attenuate=[<stream>:]<attenuation>
384 Attenuate signal by <attenuation> dB.
386 15.5 --silence[=<stream>]
388 Silence specified stream or entiere sound output.
390 16 Subtitle processing options
392 Subtitle option of form foo=bar is given as 
393 --video-hardsub-foo=bar on command line and as foo=bar in script 
394 file. For option of form baz, the corresponding forms are 
395 --video-hardsub-baz and baz. Options are processed in order they 
396 are encountered, script files are processed immediately when 
397 script file option is encountered.
399 16.1 font=<font>
401 Syntax (command line): --video-hardsub-font=<font>
403 Syntax (script): font=<font>
405 Set the font used to <font>. No default, this has to be set 
406 before using any font rendering commands.
408 16.2 size=<size>
410 Syntax (command line): --video-hardsub-size=<size>
412 Syntax (script): size=<size>
414 Set the size used to <size>. Default is 16.
416 16.3 xpos=<xpos>
418 Syntax (command line): --video-hardsub-xpos=<xpos>
420 Syntax (script): xpos=<xpos>
422 Set the x offset to <xpos> pixels. There are also special offsets 
423 left, center and right. Default is center.
425 16.4 ypos=<ypos>
427 Syntax (command line): --video-hardsub-ypos=<ypos>
429 Syntax (script): ypos=<ypos>
431 Set the y offset to <ypos> pixels. There are also special offsets 
432 top, center and bottom. Default is bottom.
434 16.5 duration=<duration>
436 Syntax (command line): --video-hardsub-duration=<duration>
438 Syntax (script): duration=<duration>
440 Set the duration to <duration> (nano)seconds (seconds being 
441 selected if <duration> has '.'). Default is 5.0 (5 seconds).
443 16.6 halo=<thickness>
445 Syntax (command line): --video-hardsub-halo=<thickness>
447 Syntax (script): halo=<thickness>
449 Set the halo thickness to <thickness> pixels. 0 disables halo. 
450 Default is 0.
452 16.7 textalign=<align>
454 Syntax (command line): --video-hardsub-textalign=<align>
456 Syntax (script): textalign=<align>
458 Set the between-lines text alignment to <align>. Valid alignments 
459 are left, center and right. Default is center.
461 16.8 spacing=<amount>
463 Syntax (command line): --video-hardsub-spacing=<amount>
465 Syntax (script): spacing=<amount>
467 Set the between-lines text spacing to <amount> pixels. Default is 
470 16.9 script=<file>
472 Syntax (command line): --video-hardsub-script=<file>
474 Read file <file> and execute it as subtitle commands.
476 16.10 text=<timestamp>,<text>
478 Syntax (command line): --video-hardsub-text=<timestamp>,<text>
480 Syntax (script): text=<timestamp>,<text>
482 Display <text> at <timestamp> (seconds or nanoseconds, depending 
483 on presence of '.'). The following sequences are special in 
484 <text>:
486 • '\\': Literal backslash
488 • '\n': Newline
490 • '\A': Authors from runinfo
492 • '\G': Game name from runinfo
494 • '\L': Movie length from runinfo.
496 • '\R': Movie rerecord count from runinfo.
498 16.11 background-color=<color>
500 Syntax (command line): --video-hardsub-background-color=<color>
502 Syntax (script): background-color=<color>
504 Set the background color to <color>. Following <color> 
505 specifications are allowed:
507 • '<a>': Partially transparent black. <a> of 0 is fully 
508   transparent, 255 is fully opaque.
510 • '<rgb>,<a>': Partially transparent gray. <a> of 0 is fully 
511   transparent, 255 is fully opaque. <rgb> sets brightness of 
512   gray, 0 is black and 255 is white.
514 • '<r>,<g>,<b>,<a>': Partially transparent color. <a> of 0 is 
515   fuly transparent, 255 is fully opaque. <r>, <g> and <b> set the 
516   color (0-255 for each component).
518 Default is fully transparent.
520 16.12 foreground-color=<color>
522 Syntax (command line): --video-hardsub-foreground-color=<color>
524 Syntax (script): foreground-color=<color>
526 Set the foreground color to <color>. Following <color> 
527 specifications are allowed:
529 • '<a>': Partially transparent white. <a> of 0 is fully 
530   transparent, 255 is fully opaque.
532 • '<rgb>,<a>': Partially transparent gray. <a> of 0 is fully 
533   transparent, 255 is fully opaque. <rgb> sets brightness of 
534   gray, 0 is black and 255 is white.
536 • '<r>,<g>,<b>': Fully opaque color. <r>,<g>, <b> set the color 
537   (0-255 for each component).
539 • '<r>,<g>,<b>,<a>': Partially transparent color. <a> of 0 is 
540   fuly transparent, 255 is fully opaque. <r>, <g> and <b> set the 
541   color (0-255 for each component).
543 Default is fully opaque white.
545 16.13 halo-color=<color>
547 Syntax (command line): --video-hardsub-halo-color=<color>
549 Syntax (script): halo-color=<color>
551 Set the halo color to <color>. Following <color> specifications 
552 are allowed:
554 • '<a>': Partially transparent black. <a> of 0 is fully 
555   transparent, 255 is fully opaque.
557 • '<rgb>,<a>': Partially transparent gray. <a> of 0 is fully 
558   transparent, 255 is fully opaque. <rgb> sets brightness of 
559   gray, 0 is black and 255 is white.
561 • '<r>,<g>,<b>': Fully opaque color. <r>,<g>, <b> set the color 
562   (0-255 for each component).
564 • '<r>,<g>,<b>,<a>': Partially transparent color. <a> of 0 is 
565   fuly transparent, 255 is fully opaque. <r>, <g> and <b> set the 
566   color (0-255 for each component).
568 Default is fully opaque black.
570 16.14 push
572 Syntax (command line): --video-hardsub-push
574 Syntax (script): push
576 Save all settings to settings stack.
578 16.15 pop
580 Syntax (command line): --video-hardsub-pop
582 Syntax (script): pop
584 Pop all settings from settings stack and apply them.
586 16.16 reset
588 Syntax (command line): --video-hardsub-reset
590 Syntax (script): reset
592 Reset all settings that have defaults to defaults (ones that 
593 don't are not reset).