README
1README for the TOOLS directory
2==============================
3
4Preamble
5--------
6
7In this directory you can find some nice scripts and code that makes
8using MPlayer and MEncoder easier, for example scripts for DVD track
9encoding in three pass mode or creating SVCDs from a movie.
10
11FIXME: Document the following tools:
12
13bmovl-test
14
15
16MPlayer scripts in the TOOLS dir
17--------------------------------
18
19edgedetect.fp, emboss.fp
20
21Author: Reimar Döffinger
22
23Description: Examples of custom fragment program for OpenGL video out driver
24
25Usage: mplayer -vo gl:yuv=4:customprog=edgedetect.fp
26
27
28midentify.sh
29
30Author: Tobias Diedrich
31
32Description: Runs 'mplayer -identify' for all arguments while preventing
33 video window flashing.
34
35Usage: midentify.sh file1 [file2 ...]
36
37
38mpconsole.sh
39
40Author: Rich Felker
41
42Description: Script to run MPlayer on the console (fbdev/mga_vid/etc.) without
43 the console text and/or flashing cursor getting in the way.
44
45Usage: mpconsole.sh [mplayer options]
46
47
48mplmult.sh
49
50Author: Reimar Döffinger
51
52Description: Example how to output video on multiple windows in sync. Might
53 be even more useful in combination with -vo ggi to distribute
54 the video arbitrarily.
55
56Usage: mplmult.sh <n> <options>
57 n Number of MPlayer instances that display the video.
58 options Any options you would pass to MPlayer, more than
59 one file will usually not work.
60
61
62subsearch.sh
63
64Author: Alex Beregszaszi
65
66Description: Collects subtitle files from the directory given as argument
67 ('.' if none is given) and its subdirectories and prints
68 them as a comma separated list to stdout.
69
70Usage: subsearch.sh [directory]
71 mplayer -sub `subsearch.sh` movie
72
73
74wma2ogg.pl
75
76Author: Peter Simon
77
78Description: Converts WMA files to Ogg or MP3.
79
80Usage: wma2ogg [options] <-f FILE1 | -f FILE2 ... | -a>
81 -f, -file filename
82 -a converts all WMA files in the current directory
83 -t output filetype (ogg, mp3) [default=ogg]
84 -lame I wanna use L.A.M.E. sure enough!
85 -br bitrate (kb/s) [default=from the WMA]
86 -del remove WMA file(s) after the transcoding
87
88
89
90MEncoder scripts in the TOOLS dir
91---------------------------------
92
93divx2svcd.sh
94
95Author: Miklos Vajna
96
97Description: A simple utility that creates an SVCD from a video in an AVI
98 container.
99
100Usage: divx2svcd.sh <input_avi> [options]
101 see 'divx2svcd.sh -h' for more info
102
103
104mencvcd.sh
105
106Author: Jürgen Hammelmann
107
108Description: Converts DVD (or anything else that MPlayer plays) to (S)VCD
109
110Usage: mencvcd.sh <basename> [mencvcd.sh options] [mplayer options]
111 see 'mencvcd.sh -h' for more info
112
113Note: Requires MPlayer, mjpegtools, VCDImager, cdrdao, and optionally
114 LAME, tooLAME and SoX.
115
116
117dvd2divxscript.pl
118
119Author: Florian Schilhabel
120
121Description: Yet another DVD to divx helper script.
122 This script encodes a DVD track in three pass mode to MPEG-4 with
123 libavcodec. Optionally it writes the resulting movie file to
124 CD-ROM the corresponding audio track to MP3. It can also shut
125 down the computer when it finishes. If you like, you can
126 watch the MEncoder output on /dev/tty8.
127
128Usage: --help show help
129 --abr (AudioBitRate) Please enter the desired bitrate this
130 can be either [96|128|192] kbit/sec (default: 128).
131 --lang Specify the Language of the audio track this can be
132 for example <en> or <de> (default: <de>).
133 --dvd Specify the DVD track you want to encode.
134 --cdsize Specify the size of your CD-ROM (default: 700MB).
135 --shutdown Shutdown the system, when the encoding process has
136 finished. Needs appropriate privileges.
137 --out Specify the name of your encoded movie. The file
138 extension will be appended automatically.
139 --writecd Takes the newly created movie and writes it to a
140 CD-ROM.
141 --writedev cdrecord device identifier, for example 0,1,0
142 --speed writing speed (default: 4)
143 --dvd-device device to pull the video off (default: /dev/dvd)
144
145
146aconvert.sh
147
148Author: Jonas Jermann
149
150Description: A hack to allow MEncoder to read respectively encode from audio
151 only files.
152
153Usage: aconvert.sh <"input file"> <"output file"> <"options">
154 If no options are specified the following is assumed:
155 -oac lavc -lavcopts acodec=mp3:abitrate=192
156
157Note: The script is probably bash dependent and it's just a quick
158 hack, feel free to improve it (or much better: fix MEncoder ;).
159
160
161
162qepdvcd.sh
163
164Author: Reynaldo H. Verdejo Pinochet
165
166Description: converter from any supported format to VCD/SVCD PAL/NTSC
167
168Usage: qepdvcd.sh file <options>
169 Run with no arguments to see the list of options.
170
171Note: You will need vcdimager/cdrecord to master/burn the resulting
172 files.
173
174
175
176Tech scripts in the TOOLS dir
177-----------------------------
178
179calcbpp.pl
180
181Author: Moritz Bunkus
182
183Description: A script that calculates the $bpp for a movie, mentioned in
184 DOCS/tech/encoding-tips.txt, see that document for more info.
185
186Usage: calcbpp.pl <resolution> <aspect ratio> <bitrate> <fps>
187 resolution: the cropped but unscaled resolution
188 (use '-vf cropdetect')
189 aspect ratio: the encoded aspect ratio. All DVDs come at
190 720x576 but contain a flag that tells the player
191 wether it should display the DVD at an aspect
192 ratio of 4/3 (1.333) or at 16/9 (1.777). Have a
193 look at MPlayer's output - there's something
194 about 'prescaling'. That's what you are looking
195 for.
196 bitrate: the video bitrate in kbit/s
197 fps: the fps
198
199 example: calcbpp.pl 720x440 16/9 896 25
200
201
202countquant.pl
203
204Author: Moritz Bunkus
205
206Description: Counts the quantizers used for the encoding, mentioned in
207 DOCS/tech/encoding-tips.txt, see that document for more info.
208
209Usage: countquant.pl < divx2pass.log
210 It will print out which quantizer was used how often. If you see
211 that e.g. the lowest quantizer (vqmin=2) gets used for > 95% of
212 the frames then you can safely increase your picture size.
213
214
215plotpsnr.pl
216
217Author: Jonas Jermann
218
219Description: Draw PSNR log graphs using gnuplot.
220
221Usage: plotpsnr.pl [options] <file>
222 -h, --help Display this help message
223 -quant Display quantizers
224 -size Display size
225 -psnr Display PSNR
226 -iframes Display I-frames
227 -pframes Display P-frames
228 -bframes Display B-frames
229 -aframes Display all frames in different colors
230 -cmp <file2> Compare two files
231 -qs <style> Quantizer style
232 -ss <style> Size style
233 -ps <style> PSNR style
234
235 Default: -quant -size -psnr -qs "p" -ss "i" -ps "p"
236
237Note: Requires gnuplot. Comparison is based on file2. Comparison
238 assumes that the frame numbers of both files fit.
239
240
241psnr-video.sh
242
243Author: Matthias Wieser
244
245Description: Calculates the PSNR between two existing video files.
246 The PSNR is calculated frame by frame.
247 Also prints the overall PSNR.
248 The script can be used to:
249 * Compare different softwarescalers (should I use
250 -sws 1 or -sws 2 ?)
251 * Compare different resolutions (is it better to scale
252 down to 640x360 or to 560x320)
253 * Compare different deinterlacers
254 * Compare different video codecs
255 * Compare video filters (is it better to use -vf hqdn3d
256 or lavcopts:nr=400)
257 * [...]
258
259Usage: psnr-video.sh <file1> <file2> [<frames>] [<options1>] [<options2>]
260
261 <file1> and <file2> are the video files for which the PSNR
262 should be calculated.
263 [<frames>] is the number of frames to process, starting
264 from frame 1.
265 [<options1>] are additional MPlayer options for <file1>
266 [<options2>] are additional MPlayer options for <file2>
267
268 A file called ./psnr.dat will be created with the following
269 content:
270
271 File;Y;Cb;Cr
272 00000001.ppm;34.23;39.54;40.06;35.426
273 00000002.ppm;33.03;38.71;39.26;34.271
274 00000003.ppm;33.45;38.91;39.28;34.655
275 00000004.ppm;32.72;38.69;38.85;33.972
276 [...]
277 00000247.ppm;35.55;40.84;42.15;36.785
278 PSNR:;35.9887
279
280Note: This script relies on the the tool "pnmpsnr" for the
281 frame-by-frame PSNR calculation.
282 Be aware that psnr-video.sh needs a lot of temporary space
283 in /tmp/.
284
285
286asfinfo
287
288Author: Arpi
289
290Description: a simple ASF header display program
291
292Usage: asfinfo <filename.asf>
293
294Note: Also see MPlayer's -identify option.
295
296
297avi-fix
298
299Author: Arpi
300
301Description: A simple tool to fix chunk sizes in RIFF AVI files.
302
303Usage: avi-fix [-fix] <badfile.avi>
304
305Note: It does not check or fix the index, to do this use
306 'mencoder -forceidx -oac copy -ovc copy'.
307
308
309checktree.sh
310
311Author: Ivo van Poorten
312
313Description: Check the source tree for anomalies.
314
315Usage: checktree.sh -help
316
317Note: This script is meant for developers to check the current
318 source tree and/or the patches they are working on.
319
320
321mphelp_check.py
322
323Author: Uoti Urpala
324
325Description: Check console message translations for common errors.
326
327Usage: mphelp_check.py [--missing] <master file> <files to check>
328
329Note: Compares MPlayer translation files against a master file and
330 reports conflicting arguments, extra strings not present in
331 the base file and (optionally) missing strings.
332
333
334cpuinfo
335
336Author: Jürgen Keil
337
338Description: the prototype ../cpuinfo.c
339
340Note: Used by configure to emulate /proc/cpuinfo on non-Linux systems.
341
342
343dump_mp4
344
345Author: Arpi
346
347Description: MPEG4-ES stream inspector, dumps the stream startcodes.
348
349
350fastmemcpybench
351
352Author: Felix Bünemann
353
354Description: benchmark/testbed for fastmemcpy stuff
355
356Note: Also see fastmem.sh.
357
358
359movinfo
360
361Author: Arpi
362
363Description: Show QuickTime MOV file structure.
364
365Usage: movinfo <filename.mov>
366
367
368vivodump
369
370Author: Arpi
371
372Description: Dump H.263 frame headers from VIVO files.
373
374Usage: vivodump <input_file> <output_file>
375
376
377
378Miscellaneous scripts in the TOOLS dir
379--------------------------------------
380
381subedit.pl
382
383Author: Michael Klepikov
384
385Description: A script for pipelined editing of subtitle files.
386
387Usage: subedit.pl [switches]
388 -if,--input-format <fmt> input format; supported: SRT (default: SRT)
389 -of,--output-format <fmt> output format; supported: SRT
390 (default: input format)
391 -s,--shift <time> shift all subtitles by <time>
392 (format: [-]hh:mm:ss,fraction)
393 -c,--scale <time> scale by adding <time> to overall duration
394 -f,--split-from <time> drop subtitles that end before <time>
395 -t,--split-to <time> drop subtitles that start after <time> (will
396 truncate timing if it overlaps a boundary)
397 -r,--renumber renumber SRT subtitles in output
398 -d,--debug enable debug output
399 -h,--help help message
400
401
402w32codec_dl.pl
403
404Author: Tom Lees
405
406Description: This script will use the Windows Media Player codec download
407 infrastructure to aquire the codecs listed in codecs.conf and put
408 them in a directory named "codecs/" below the current directory.
409
410Usage: w32codec_dl.pl <codecs.conf location>
411
412Note: You will need the libwww-perl stuff and the cabextract utility
413 which can be found at http://www.kyz.uklinux.net/cabextract.php3.
414
415
416binary_codecs.sh
417
418Author: Andrea Menucci, thuglife
419
420Description: Downloads binary codecs from mplayerhq.hu and installs them
421 on a Debian system.
422
423Usage: binary_codecs.sh install
424 binary_codecs.sh uninstall
425
426
427vobshift.py
428
429Author: Gábor Farkas
430
431Description: Adjust the time-info in vobsub files
432
433Usage: vobshift.py in.idx out.idx +8.3
434 Will shift the time by 8.3 seconds
435
436
437subrip.c
438
439Author: Kim Minh Kaplan
440
441Description: Transform VOBsub subtitles into Subrip text subtitles using
442 GOCR/JOCR.
443
444Usage: subrip <vobsub basename> [subid [output filename] ]
445
446Note: Requires at least JOCR/GOCR 0.37.
447 You will have to change the 'vobsub_id' value if you want a
448 subtitle different from number 0. Hint: You can view the
449 subtitle that is being decoded with "display subtitle-*.pgm".
450
451
452alaw-gen.c
453
454Author: Arpi
455
456Description: Generates alaw/ulaw tables.
457
458Note: Created to work around a past license issue, no longer useful.
459
460
461avisubdump.c
462
463Author: Tobias Diedrich
464
465Description: Dumps vobsub soft subtitles streams embedded in AVI files.
466
467Usage: avisubdump <movie.avi>
468
469
470vfw2menc.c
471
472Author: Gianluigi Tiesi
473
474Description: Creates a codec settings file from the Video for Windows codecs
475 found in the mplayer codec packs.
476
477Usage: vfw2menc -f <fourcc> -d <codec.dll> -s <settingsfile.mcf>
478 -h|--help - displays this help
479 -d|--driver filename - dll or drv to load
480 -f|--fourcc fourcc - fourcc of selected driver
481 -s|--save filename - save settings to file
482 -c|--check filename - load and show setting in filename
483 -v|--view - displays the config dialog and do nothing
484
485Notes: Works on Windows/Linux x86 only.
486
487
488modify_reg.c
489
490Author: Alan Nisota
491
492Description: Modifies registry file (usually ~/.mplayer/registry)
493
494Usage: modify_reg -r <registry_file> -l
495 modify_reg -r <registry_file> -k <key> [-d|-v <value>[-t <type>]]
496 -r|--registry - path to registry file
497 -l|--list - shows all keys and values
498 -k|--key - registry key
499 -d|--del - delete key
500 -v|--value - new value for key
501 -t|--type - key type: string (default) or dword
502
503Notes: Necessary to use CoreAVC with MPlayer
504
505
506compare.c
507
508Author: Michael Niedermayer
509
510Description: Simple file compare program that detects the number of rounding
511 errors and dies if the error is too large.
512
513Usage: compare <file1> <file2>
514
515
516realcodecs/
517
518Author: miscellaneous
519
520Description: Wrappers for Linux Real binary codecs used to analyze, alter and
521 dump the data flow between RealPlayer and its codecs.
522
523Usage: - Set the path to the RealPlayer codecs directory in the C files.
524 - Run 'make realcodecs'.
525 - Rename the original codecs to match the names expected in the
526 wrapper sources. The default is to give them a "real" prefix,
527 e.g. realcook.so.6.0.
528 - Put the wrappers in the RealPlayer codecs directory.
529
530Notes: Known to work at least on Linux x86 with RealPlayer8.
531
532
533
534netstream - access remote streams
535---------------------------------
536
537netstream allows you to access most MPlayer stream types from a remote host.
538The main purpose of this feature is to make it possible to directly use the
539CD or DVD drive of another computer on the network (provided you have the
540required bandwidth). On the downside some stream types (currently TV and MF)
541are not usable remotely because they are implemented at the demuxer level.
542
543Be aware that currently the server is not secure at all.
544
545Compile the server by running 'make TOOLS/netstream' ('make TOOLS/netstream.exe'
546on windows) from the root of mplayer source and then copy the netstream binary
547to the right place on your system (usually /usr/local/bin on Unix). Start the
548netstream server on the computer you intend to access remotely. There are no
549command line arguments.
550
551Play the second track of a VCD on the server with:
552
553 mplayer -cache 5000 mpst://servername/vcd://2
554
555Access files on this server with:
556
557 mplayer -cache 5000 mpst://servername//usr/local/movies/lol.avi
558
559Note that paths which do not start with a / will be interpreted as relative to
560the directory where the server is running. The '-cache' option is not needed
561but highly recommended.
562
563netstream will not take -dvd-device, so you must either symlink
564your drive to /dev/dvd/ or use the dvd:///path/to/dvd.
565for example: mpst://audioserver/dvd:////dev/optical/lg_black_dvd
566