Set the cut path properly when a non-default output path is specified
[atscap.git] / xtscut.1
blobd2ccb4742b689fc4c01cb4ce31133434c8498bef
1 .TH Xtscut 1 "2008-Jan-02" "Xtscut-1.3.5" "(C) 2005-2008 inkling@users.sourceforge.net"
2 .SH NAME
3 .B Xtscut \- ATSC Transport Stream Cutter for X
5 .SH SYNOPSIS
6 .PP
7 .B xtscut infile
8 .IP
9 .B [\-1dgknr]
10 .B [\-fix]
11 .B [\-hv]
12 .br
13 .B [\-a FPUbits]
14 .br
15 .B [\-b framecount]
16 .br
17 .B [\-c even|odd|all]
18 .br
19 .B [\-o outname]
20 .br
21 .B [\-p outpath]
22 .br
23 .B [\-w divisor]
24 .br
26 .SH DESCRIPTION
27 .PP
28 This manual page describes the options for
29 .B Xtscut,
30 the Xlib graphical tool to cut ATSC MPEG Transport Streams at Sequence headers.
32 .SH BACKGROUND
33 MPEG2 usually needs a Non-Linear Editor (NLE) to handle simple cuts.
34 .PP
35 NLEs can be slow if they don't have some hardware assist because they have
36 to render the entire Sequence, all of the frames, and then encode a new
37 Sequence of frames that has the cut frames removed. This is much easier
38 if you have a hardware encoder, but not many people have HDTV grade Main
39 Profile @ High Level hardware encoders available to them. Software encoders
40 are very slow for HDTV, even on new systems.
42 .SH THEORY OF OPERATION
43 .B Xtscut
44 avoids all of the demux, decode, encode, and remux hoops that you have to
45 jump through for the typical NLE hardware or software.
46 .PP
47 .B Xtscut
48 doesn't concern itself with precise frame cuts, but instead only cuts at
49 the start of a Sequence. The first video frame after a Sequence header
50 is an Intra frame in ATSC. This Intra frame is a still picture that doesn't
51 need any other P or B frames to describe it. These make very good preview
52 and cut points for the ATSC Transport Stream.
53 .PP
54 .B Xtscut
55 tracks the byte offsets of the Sequence headers and uses these for the cut
56 points. Aside from the Intra frame preview, which isn't used when writing the
57 cuts, no MPEG2 decoding of the stream is done.
58 .PP
59 The advantages to this method not only apply to speed, but also reliability.
60 Since the stream isn't parsed during cuts, a few (or even a lot) of bad packets
61 will not affect the cutting process. This method performs the cuts with a few
62 seeks and a lot of reads and writes. This makes
63 .B Xtscut
64 one of the fastest, if not the fastest, ATSC Transport Stream cutters
65 available today. It's also less expensive than other solutions because:
66 .IP
67 a) it's free software and
68 .IP
69 b) it's fast.
70 .PP
71 Time is like money. The more you save, the more you have.
72 .SH DISCLAIMER
73 .B Xtscut
74 is not designed nor intended to be a perfect substitute for a Non-Linear
75 Editor. If you have the need for frame accurate editing, or special effects,
76 there are various hardware and software solutions that may suit you better.
77 Intra frame cuts are good enough for me.
79 .SH OPTIONS WITHOUT PARAMETERS
80 These options act mostly as toggles for the compiled defaults (arg_*).
82 .TP
83 .B \-h
84 Help. This may be more up-to-date than this manual page.
86 .TP
87 .B \-v
88 Show program banner and exit.
90 .TP
91 .B \-1
92 Cut to multiple files, -r -cX modifies this.
93 .br
94 Default is to cut to one, possibly giant, file. The [w] key in the GUI will
95 reset this to writing multiple files. The [m] key in the GUI will toggle this 
96 between multiple and single file cut writes.
98 .TP
99 .B \-d
100 Delay writes to reduce I/O load on one drive, default no.
103 .B \-n
104 Write NULL packets at the start of each cut. This may or may not help with
105 initial playback stuttering. Still testing it. Consider it experimental.
106 The [n] key in the GUI will toggle NULL packet generation on and off.
108 .B \-r
109 Renumber odd/even cuts to .01.ts ... .99.ts, default no.
111 See also
112 .B -1 -c
114 .SH OPTIONS WITH PARAMETERS
115 These options set user supplied parameters.
118 .B \-a method
119 Default is to let libmpeg2 autodetect which FPU method to use for the IDCT.
120 If you need to override this, you can use one of the numerical values found
121 in mpeg2.h. The default should work well for most people.
124 .B \-b decimal
125 Benchmark the Intra frame render. It's only useful for comparative testing
126 with option -w1 vs other -w sizes, and for Imlib1 vs Imlib2 vs XVideo testing.
127 Give it file.ts and it will try to render num Intra frames as fast as it can.
128 It doesn't do the histogram render, so it will be faster than actual use.
131 .B \-c e|o|a
132 If *.tsc file exists, cut odd, even or all and exit.
133 Use with options for scripts that don't need the GUI.
135 See also:
136 .B -1 -r -c
139 .B \-o name
140 Basename to write cuts as
141 .B name.00.ts ... name.99.ts
144 .B \-p path
145 Save output *.ts to
146 .B path.
149 .B \-w divisor
150 Default video window is 960x544 (16x9). Specifying this option will instead
151 use the source material frame size with this divisor. The divisors are
152 limited to 1, 2, 4 and 8 to prevent interlacing artifacts (banding). If you
153 have a 1920x1200 display, you can use -w1 for a big 1920x1080 window. You
154 may also use -w1 to present SD material at the correct aspect ratio. You
155 may use -w0 to reset the video window to 960x544.
158 .B \-k n
159 By default the last video Sequence is discarded because this is usually cruft.
160 However, if you're re-cutting a previous cut, or are using source material
161 (i.e., a camcorder or a previous cut) that has a known good final Sequence,
162 use the -k1 option to keep the last Sequence instead of discarding it. This
163 prevents any cutting-related generational losses of the last Sequence.
164 .SH WARNING: Xtscut will crash if you try to preview a corrupted Sequence.
165 The crashes may occur in bad streams, or at last Sequence preview.
167 The Good News is this happens very seldom. The Bad News is this happens very
168 far down into libmpeg2 and crashes it before mpeg2_parse() can return
169 STATE_INVALID_END. Currently there is no workaround for this other than
170 discarding the last Sequence, which is the default.
171 .B Xtscut
172 may also crash if it previews a corrupted Sequence anywhere, not only at
173 the end of the stream.
175 .B NOTE: Cuts are auto-saved so you shouldn't lose much if it crashes.
178 .SH OPTIONS FOR DEBUGGING
179 These options can be used when modifying the source code. You probably
180 won't have to use these unless I missed a really bad bug somewhere.
183 .B \-f
184 Function name verbosity
187 .B \-i
188 Intra Frame processing verbosity
191 .B \-x
192 X function verbosity
194 .SH USER INTERFACE DESCRIPTION
195 .B Xtscut
196 cuts ATSC Transport Stream (and possibly some camcorder) captures, .ts files,
197 using Sequence and Frame data files, .tsx files, generated by:
198 .B atscap -m
200 .B atscut -s
201 to determine where to make the cuts.
203 If you don't have a .tsx file for the stream you want to cut,
204 .B Xtscut
205 will try to generate the .tsx file for you. If that fails, you may try:
207 .B $ atscut -s file.ts
209 If it does need to create the .tsx file, please be patient. Depending on the
210 speed of your system, it may take longer than 30 seconds per gigabyte of
211 source material before the
212 .B Xtscut
213 GUI is able to start.
215 The histogram shows frame number as X-offset. The height of the histogram
216 gives a general overview of the bandwidth usage for each frame type.
218 You can use middle mouse, button2, as coarse stream navigation by percentage
219 of horizontal video window area to set the percentage of stream. For example,
220 clicking MMB in the middle of the video window will put you about halfway
221 into the stream. Think of it as an invisible always available slider.
223 The cyan lines are Sequence/Intra-frame starts where you can make a cut.
224 The right mouse button, button3, previews that Sequence start. The left
225 mouse button, button1, inserts or removes a cut at that Sequence start.
227 The magenta and yellow lines are P & B frames, respectively. These are
228 not selectable for cuts, but can help to quickly find a cut point by
229 graphically representing the packet drop-off that occurs in a blank spot.
231 You may use the left mouse button, button 1, to click on the IPB buttons to
232 enable or disable the frame histogram for each of the 3 frame types.
234 Generally speaking, you cut at the nearest blank Sequence, or as close as
235 you can get, to what you want to cut. It does Sequence-accurate cuts, not
236 Frame-accurate cuts. Cut wide if you want to edit B and P frames later
237 with a proper NLE.
240 Cuts are indicated by a red line with a number at the bottom, which
241 is the number of the cut to the
242 .B LEFT
243 of the red line.
246 If you have a scroll-wheel mouse you can use that for navigation.
247 When navigating, the white line in the center is the preview position.
248 If or when the scroll-wheel is too slow, you may use the following keys:
250 .B NAVKEYS --- FUNCTIONS
252 [  HOME  backward to start of stream + half screen width
254 y  PGUP  backward 2 screen widths
256 u  UP    backward 1 screen width
258 MB4      backward 1/2 screen width (scrollwheel up)
260 j  LEFT  backward 1 Intra frame
262 k  RIGHT forward 1 Intra frame
264 MB5      forward 1/2 screen width
266 i  DOWN  forward 1 screen width
268 o  PGDN  forward 2 screen widths
270 ]  END   forward to end of stream - half screen width
272 .SH MORE KEYS
273 These keys set various options that control cutting and display.
275 d     Display detailed cut information
277 w     Write all cuts to separate files
279 e     Write even numbered cuts
281 r     Write odd numbered cuts
283 a     Jump to previous cut
285 s     Jump to next cut
287 c     Clear all cuts
289 -     Decrease histogram scale
291 +     Increase histogram scale
293 m     Toggle multiple/single file cut writes   
295 n     Toggle writing of NULL packets at start of each cut
297 g     Toggle writing of GOP broken flag at start of each cut
299 t     Toggle time-code/frame count display
301 F1    Toggle histogram display on/off
303 F2    Toggle IPB button display on/off
305 F3    Toggle frame number/timecode at top on/off
307 F4    Toggle slider bead (visual position) on/off
309 F5    Toggle shading and rounded corners on/off
311 q     Quit
313 .SH EXAMPLE USAGE
315 You may want to start
316 .B Xtscut
317 from a script so you can see the data in the xterm, otherwise all the stdout
318 will wind up on the console that started X. A script like this will work:
320 #/bin/bash
322 xterm -fn 10x20 -fg white -bg black -n Xtscut -e xtscut $*
325 Edit a file so what you want has even numbered cuts, and hit [d] key to view
326 the cut-list. You can then either hit [e] to write the even cuts, or [q] key
327 to quit for processing the cuts later.
329 Scripted processing can be done to extract even cuts to one file for playback:
331 .B $ xtscut -ce file.ts
333 Where
334 .B file.ts
335 is the name of the capture file.
337 .SH CONFIGURATION FILE
338 .B Xtscut
339 stores the current configuration in /etc/atscap/xtscut.conf. You may
340 safely delete this file to revert to the compiled defaults. It will
341 be regenerated for you the next time you start
342 .B Xtscut.
345 .SH PERFORMANCE
346 The performance can be improved by cutting to a different physical
347 volume with the
348 .B -p path
349 option. 
351 Modern systems and hard drives should be capable of an aggregate read/write
352 throughput of 80+ megabytes per second, if the system is otherwise idle.
354 .SH LIMITATIONS
355 .B Xtscut
356 only works with single virtual channel/program captures. If you have a
357 multiplexed stream with more than one video program, you will need to
358 extract a single program n by using the following:
360 .B $ atscut -e n file.ts
363 Bad Sequence/Intra-frame data has been known to crash the libmpeg2 library.
364 Future versions of the libmpeg2 library may address this issue. Cut points
365 are automatically saved when selecting them, in case it does crash.
368 If you change the window size, it may introduce some banding or other visual
369 artifacts. The default window size of 960x544 gives good results. The -w0
370 option may be used to reset the initial video window size to the default of
371 960x544. If you have a 1920x1200 display, try -w1 on HD 1080i content. SD
372 video will not look right with the default 960x544 window size, so use 
373 .B -w1
374 option to set the correct aspect ratio.
377 Benchmarking with -b mode doesn't take into account the histogram render time.
379 .SH BUGS
381 I use
382 .B Xtscut
383 every day, so a lot of effort has gone into making
384 .B Xtscut
385 a fast and reliable ATSC Transport Stream cutter.
387 If you think you have found a bug, please send a bug report via SourceForge,
388 either with the bug tracking system or post to atscap-users forum.
390 You may find a link to the latest atscap version here:
392 http://atscap.sourceforge.net
394 The main project page is here:
396 http://sourceforge.net/projects/atscap/
398 .SH COMPATIBILITY
399 .B Xtscut
400 has mostly been tested with ATSC broadcast streams. Cable and satellite
401 streams may not contain the MPEG2 video as one picture per payload and
402 will not work with
403 .B Xtscut,
404 however some cable streams are known to work OK. MPEG4 is not supported,
405 but could be added in the future if someone contributes the code for it.
408 If you have a camcorder that outputs an MPEG2 Transport Stream that does
409 use one picture per payload, it may work OK with
410 .B Xtscut,
411 but you will probably want to use the -k1 option to keep the last Sequence
412 or else you might wonder why the last frames are missing from the output.
415 .B Xtscut
416 should work with any X11R6 server. It has been tested on X11R6V3 and
417 X11R6V4 from X.org. Some users have reported that it works with third-party
418 X servers running on other "operating systems". PMX X11R5 anyone? :>
420 .SH ENVIRONMENT VARIABLES
422 This may fix the wobbly problem associated with the Compiz Window Manager.
423 .B Xtscut
424 1.2.9 and later will set the environment variable listed below.
426 Thanks to Peter Knaggs for finding and reporting this fix:
428 $ XLIB_SKIP_ARGB_VISUALS=1 Xtscut file.ts
431 .SH DEPENDENCIES
432 .B Xtscut
433 depends on a few libraries (and package versions):
436 libImlib (1.9.14) handles RGB preview for XFree86 3.x+
438 libImlib2 (1.4.0) handles RGB preview for XFree86 3.x+
440 libXv (4.0.3+) handles XVideo YUV preview for XFree86 4.0.3
442 libmpeg2 (0.4.1) handles MPEG2 preview image decoding
444 libmpeg2convert (0.4.1) handles image conversion for RGB
446 librt clock_gettime() handles benchmarking
448 libX11 handles X processing
451 You should install mpeg2dec if you haven't already. You may need to install
452 the relevant header files (-devel or -dev packages) too. The other
453 libraries should have been installed by your distribution, but will also
454 require the various header files to get Xtscut to compile.
456 .SH SEE ALSO
458 atscap(1), atscut(1), mpeg2dec(1)
460 .SH AUTHOR
462 The author of this manual page is <inkling@users.sourceforge.net>.
463 .SH COPYRIGHT
465 This manual page is part of the atscap-1.1 distribution software.
467 Xtscut is Copyright (C) 2005-2008 by
468 .B <inkling@users.sourceforge.net>
471 This GPL software contains GPL software from the libmpeg2 distribution:
473 Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
475 Copyright (C) 2003      Regis Duchesne <hpreg@zoy.org>
477 Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
480 .SH LICENSE
482 Permission is granted to you to copy, distribute and/or modify this software
483 only under the terms of the GNU General Public License, Version 2.
485 A copy of the license with the file name COPYING or LICENSE should have been
486 included in this distribution. If it was not included, or you did not receive
487 the source code for this software, please contact me,
488 .B <inkling@users.sourceforge.net>,
489 or write to:
491  The Free Software Foundation, Inc.
492  51 Franklin Street, Fifth Floor
493  Boston, MA 02110-1301, USA