TRANSCODE(1) | 14th July 2008 | TRANSCODE(1) |
NAME
transcode - LINUX video stream processing tool
SYNOPSIS
transcode -i name [-o name] [-y vmod,amod] [-w vbitrate [ ,vkeyframes [ ,vcrispness ] ]] [-a atrack [ ,vtrack ]] [-b abitrate [ ,is_vbr [ ,quality [ ,mode ] ] ]] [-M demuxer_mode] [-F codec_string] [other options]
QUICK SUMMARY
transcode supports a huge range of options, as described in detail in further section. Only one option is mandatory: -i name, for supplying the input main (video) source. All other options are discretionary and they can be skipped. Most commonly needed options are -o, -y, -w, -a, -b, -M, -F and a fair number of transcode session needs a little more than those. See section below for full description of all transcode options. To inspect the properties of a module, such as their parameters or the help text, use the ´tcmodinfo´ tool.
DESCRIPTION
transcode is a linux text-console utility for video stream processing, running on a platform that supports shared libraries and threads.
It supports a huge range of options, as described in detail in further section. Only one option is mandatory: -i name, for supplying the input main (video) source. All other options are discretionary and they can be skipped. Most commonly needed options are -o, -y, -w, -a, -b, -M, -F and a fair number of transcode session needs a little more than those. See section below for full description of all transcode options.
Decoding and encoding is done by loading modules that are responsible for feeding transcode with raw video/audio streams (import modules) and encoding the frames (export modules).
It supports elementary video and audio frame transformations, including de-interlacing or fast resizing of video frames and loading of external filters.
A number of modules are included to enable import of DVDs on-the-fly, MPEG elementary (ES) or program streams (VOB), MPEG video, Digital Video (DV), YUV4MPEG streams, NuppelVideo file format, AVI based codecs and raw or compressed (pass-through) video frames and export modules for writing DivX;-), XviD, DivX 4.xx/5.xx or uncompressed AVI and raw files with MPEG, AC3 (pass-through) or PCM audio.
Additional export modules to write single frames (PPM) or YUV4MPEG streams are available, as well as an interface import module to the avifile library.
It´s modular concept is intended to provide flexibility and easy user extensibility to include other video/audio codecs or filetypes. A set of tools is included to demux (tcdemux), extract (tcextract) and decode (tcdecode) the sources into raw video/audio streams for import, probing (tcprobe) and scanning (tcscan) your sources and to enable post-processing of AVI files, fixing AVI file header information (avifix), merging multiple files (avimerge), splitting large AVI files (avisplit) to fit on a CD and avisync to correct AV-offsyncs.
OPTIONS
-A
-B n[,m[,M]]
-C mode
1
2
3
-D num
-E r[,b[,c]]
-F codec_string
-G val
-H n
-I mode
1
"interpolate scanlines" linear interpolation (takes the average of the surronding even rows to determine the odd rows), and copies the even rows as is.
2
"handled by encoder" tells the encoding code to handle the fact that the frames are interlaced. Most codecs do not handle this.
3
"zoom to full frame" drops to to half size, then zooms out. This can cause excessive blurring which is not always unwanted. On the other hand results are quite good.
4
"drop field / half height" drop every other field and keep half height.
5
"interpolate scanlines / blend frames" linear blend (similar to -vop pp=lb in mplayer) this, like linear blend calculates the odd rows as the average of the surrounding even rows, and also calculates the even rows as an average of the original even rows and also calculates the even rows as an average of the original odd rows and averages the calculated and original rows. Something like avg (avg(row1,row3), avg(row2, row4))
-J filter1[,filter2[,...]]
-L n
-K
-M mode
Overview
0
1
2
3
4
-N format
Available format for old-style behaviour are:
0x1
0x50
0x55
0x2000
0xfffe
-O
-P flag
You can pass-through DV video, AVI files and MPEG2 video. When doing MPEG2 pass-through (together with the -y raw module), you can give a requantization factor by using -w (for example -w 1.5), this will make the MPEG2 stream smaller.
The pass-through mode is useful for reconstruction of a broken index of an AVI file. The -x ffmpeg import-module analyzes the compressed bitstream and can detect a keyframe for DIV3, MPEG4 (DivX, XviD, ..) and other formats. It then sets an internal flag which the export module will respect when writing the frame out.
-Q n[,m]
-R n[,f1[,f2]]
0 Constant bitrate (CBR) encoding. [default]
1 Variable bitrate encoding: First pass.
The video output of the first pass is not of much use and can grow very large. It´s a good idea to not save the video output to a file but directly to /dev/null. Usually the bitrate is ignored during first pass.
Disabling audio export makes sense too, so use -y codec,null. It is not recommended to disable the audio import because transcode might drop video frames to keep audio and video in sync. This is not possible when the audio import is disabled. It may lead to the fact that the codec will see a different sequence of frames which effectively renders the log file invalid.
2 Variable bitrate encoding: Second pass.
Make sure you activate both sound and video encoding during this pass.
3 Constant quantizer encoding.
-S unit[,s1-s2]
-T t[,c[,a]]
-U base
-V format
yuv420p is default because it is most codecs´ internal format so there is no need for conversions. Some modules may not support it though: use rgb in that case.
rgb24 is the old (pre-0.6.13) transcode internal format. Most codecs do not support this format natively and have to convert it to/from YUV first, so only use this option if you´re really sure or you want to use a module that doesn´t support YUV.
yuv422p is an experimental feature and a developers playground. Not many import, export and filter modules support this colorspace. A 4:2:2 colorspace offers much more quality than the consumer oriented 4:2:0 colorspaces like I420/YV12. Most equipment in film and video post-production uses YUV422. YUV422 doubles the precision for chroma (color difference) information in the image.
All internal transformations are supported in YUV422 mode (clipping, flipping, zooming, etc).
-W n,m[,nav_file]
-X n[,m,[M]]
-Y top[,left[,bottom[,right]]]
-Z widthxheight[,fast|interlaced]
In fast mode, a faster but less precise resizing algorithm will be used resulting in a slightly less good quality. Beside this (small) drawback, it is worth a try.
If interlaced is given, transcode will assume the frame is interlaced when resizing, and resize each field independently. This will give better results on interlaced video, but is incompatible with fast mode. Also, the height (both old and new) must be a multiple of 4.
It is also possible to omit width OR height. In this case, transcode will calculate the missing value using the import aspect ratio. The new value will be aligned to be a multiple of 8. Using an additional fast or interlaced is also possible.
Examples (assume input is a 16:9 coded file at 720x576):
-Z 576x328 uses filtered zoom.
-Z 576x328,fast uses fast zoom.
-Z 576x,fast guess 328 and do fast zoom.
-Z x328,interlaced guess 576 and do interlaced zoom.
-a ach[,vch]
-b b[,v,[q,[m]]]
The mode parameter specifies which modus lame should use for encoding. Available modes are:
0
1
2
-c f1-f2[,f3-f4[, ... ] ]
-c 500-0:5:01,:10:20-1:18:02.1
Note that transcode starts counting frames at 0 and excludes the last frame specified. That means that "-c 0-100" will encoded 100 frames starting at frame 0 up to frame 99
-d
-e r[,b[,c]]
-f rate[,frc]
1
2
3
4
5
6
7
8
9
10
11
12
13
-g WidthxHeight
-h
-i name
-j top[,left[,bottom[,right]]]
-k
-l
-m file
-n 0xnn
-o file
-p file
-q debuglevel
0
1
2
4
8
16
32
64
128
256
-r n[,m]
-s gain,[center,[front,[rear]]]
-t n,base
-u m[,n]
-v
-w b[,k[,c]]
--video_max_bitrate b
-x vmod[,amod]
-y vmod[,amod[,mmod]]
--accel type
C
ia32asm
mmx
3dnow
sse
sse2
--avi_limit N
--avi_comments F
See the file docs/avi_comments.txt for a sample input file with all tags. When the file is read, empty lines and lines starting with ´#´ are ignored. The syntax is: "TAG<space>STRING". The order of the tags does not matter. If a tag has no string following it, it is ignored. That means, you can use the file docs/avi_comments.txt as input and only fill out the fields you want.
A very simple example is:
----------------snip----------------
INAM My 1st Birthday
ISBJ My first steps!
IART My proud family
----------------snip----------------
--zoom_filter string
Bell
Box
Lanczos3 (default)
Mitchell
Hermite
B_spline
Triangle
--cluster_percentage
--cluster_chunks a-b
--export_asr C
1
2
3
4
--export_prof S
Select an export profile {vcd, svcd, xvcd, dvd} [-pal|-ntsc|-secam]. Default is no profile.
If you set this meta option to one of the values below, transcode will adjust some internal paramaters as well as geometry and clipping. If no export modules are specified, mpeg2enc for video and mp2enc for audio are used when compiled with mjpegtools support.
Valid values for S are e.g. vcd, vcd-pal, vcd-ntsc, svcd, svcd-pal, ...
xvcd profile is equal to svcd except that it allows for up to 9000 Kbps video bitrate (default is 5000) and arbitrary audio samplerate.
When one of the above is used, transcode will calculate the needed clipping and resizing values for you based on the import and export aspect ratio. This is especially handy if you want to encode a 16:9 DVD into a 4:3 SVCD for example. Transcode internally then sets --pre_clip to add the black bars ("letterboxing").
If you use "vcd" instead of "vcd-pal" or "vcd-ntsc", transcode will make an educated guess if PAL or NTSC vcd is wanted. The same is true for the other profiles. When the input file has no aspect ratio information at all, transcode guesses it based on the import frame sizes. You can set the import aspect ratio by giving --import_asr CODE.
Examples (assume input is a 16:9 coded file at 720x576 (PAL)):
--export_prof svcd clip top/bot -96; resizes to 480x576
--export_prof vcd-ntsc clip top/bot -96; resizes to 352x240
transcode -i vob/ --export_prof svcd -Z fast -o test
transcode -i vob/ --export_prof dvd -y ffmpeg -o test -m test.ac3
tcmplex -m d -i test.m2v -p test.ac3 -o test.mpg
--export_par C[,N]
To encode at non standard aspect ratios, set both C and N. E.g. to make every pixel twice as high as it´s wide (e.g. to scale back to normal size after deinterlacing by dropping every second line).
If C and N are specified, the value set for C does give the pixel aspect ratio of the width and N the one for the height. If only C is specified, the table below applies.
Valid codes for C are
1
2
3
4
5
--import_asr C
Valid codes for C are
1
2
3
4
--keep_asr
The --keep_asr options changes the meaning of -Z. It tries to fit the video into a framesize specified by -Z by keeping the original aspect ratio.
+----------------+ +---480-----+
| | | black |
|720x306 = 2.35:1| -> -Z 480x480 --keep_asr ->|-----------4
| | | 480x204 8
+----------------+ |-----------0
| black |
+-----------+
--mplayer_probe
--quantizers min,max
--divx_rc p,rp,rr
--divx_vbv_prof N
Valid profiles
0
1
2
3
4
--divx_vbv br,sz,oc
--export_fps rate[,frc]
frc rate
1
2
3
4
5
6
7
8
9
10
11
12
13
--export_frc F
--hard_fps
--pulldown
--antialias_para w,b
--no_audio_adjust
--no_bitreservoir
--config_dir dir
--lame_preset name[,fast]
<N kbps>
medium
standard
extreme
insane
(taken from http://www.mp3dev.org/mp3/doc/html/presets.html)[1]
--av_fine_ms t
--nav_seek file
--psu_mode
--psu_chunks a-b
--no_split
--multi_input
(EXPERIMENTAL) enable multiple input mode: intelligently join input files in import. The inputs can be expressed using standard POSIX globbing. While theorically all input modules are supported, it is safe to use this only when dealing with constant-sized audio (PCM) and intra-frame only video codecs (es: MJPEG). To be safe, use this mode with im, ffmpeg and raw import modules.
--pre_clip t[,l[,b[,r]]]
--post_clip t[,l[,b[,r]]]
--a52_drc_off
If you let it enabled this this will totally disable the dynamic range compression and provide a playback more adapted to a movie theater or a listening room.
--a52_demux
--a52_dolby_off
--log_no_color
--dir_mode base
--frame_interval N
--encode_fields C
Valid codes for C are:
p
t
b
--dv_yuy2_mode, --dv_yv12_mode
--write_pid file
$ transcode ... --write_pid /tmp/transcode.pid &
$ kill -2 `cat /tmp/transcode.pid`
--nice N
--progress_meter N
0
1
2
Scripts that need progress data should use type 2, since the format of type 1 is subject to change without notice.
--progress_rate N
--socket FILE
ENVIRONMENT
TRANSCODE_LOG_NO_COLOR
NOTES
*
*
-j 80 will be expanded to -j 80,0,80,0
-j 80,8 will be expanded to -j 80,8,80,8
-j 80,8,10 will be expanded to -j 80,8,10,8
*
*
*
*
*
1.
2.
1.
2.
3.
*
Bits per pixel (bits/pixel) is a value transcode calculates and prints when starting up. It is mainly useful when encoding to MPEG4 (xvid, divx, etc). You´ll see line like
[transcode] V: bits/pixel | 0.237
Simplified said, bits/pixel quantifies how good an encode will be. Although this value depends heavily on the used input material, as a general rule of thump it can be said that values greater or close to 0.2 will result in good encodes, encodes with values less than 0.15 will have noticeable artifacts.
Bits per pixel depends on the resolution, bitrate and frames per second. If you have a low value ( < 0.15), you might want to raise the bitrate or encode at a lower resolution. The exact formula is
bitrate*1000
bpp = ------------------
width*height*fps
*
AC3 / Multiple channels
When you do import an audio stream which has more then two audio channels - this is usually the case for AC3 audio - transcode will automagically downmix to two channels (stereo). You´ll see line like
[transcode] A: downmix | 5 channels -> 2 channels
This is done, because most encoders and audio filters can not handle more than 2 channels correctly. The PCM internal representation does not support more than two channels, audio will be downmixed to stereo No downmix will happen, if you use AC3 as the internal audio codec or use audio pass-through.
EXAMPLES
The following command will read it´s input from the DVD drive (I assume /dev/dvd is a symbolic link to the actual DVD device) and produce a splitted divx4 movie according to the chapter information on the DVD medium. The output files will be named my_movie-ch00.avi, my_movie-ch01.avi ...
transcode -i /dev/dvd/ -x dvd -j 16,0 -B 5,0 -Y 40,8 -s 4.47 -U my_movie -y xvid -w 1618
Option -j 16,0 will be expanded to -j 16,0,16,0 and results in 16 rows from the top and the bottom of the image to be cut off. This may be usefull if the source consists of black top and bottom bars.
Option -B 5,0 tells transcode to shrink the resulting image by 5*32=160 rows in height.
Option -Y 40,8 will be expanded to -Y 40,8,40,8 and tells transcode to ...
Option -s 4.47 tells transcode to increase audio volume by a factor 4.47.
Option -U my_movie tells transcode to operate in chapter mode and produce output to files named my_movie-ch00.avi, my_movie-ch01.avi.... You can either merge the files afterwards with avimerge or add the option --no_split to the command line.
Option -y xvid tells transcode to use the export module export_xvid.so which in turn uses the XviD encoder to encode the video.
Option -w 1618 tells transcode to set the encoder bitrate to 1618 which is lower than the default of 1800 and results in smaller files with the loss of visual quality.
Lets assume that you have an NTSC DVD (720x480) and you want to make an NTSC-SVCD
As the _original video_ has aspect ratio 16:9, first we resize to 640x360, keeping that aspect ratio. But the aspect ratio has to be changed to 4:3. To find the frame size in the new aspect ratio the height 360 is multiplied by the new aspect ratio, giving the width 480. This is accomplished with the transcode options "--export_asr 2 -Z 480x360,fast".
To avoid stretching the video height in this change (because the new aspect ratio is less than the original), black borders should be added at the top and bottom of the video, bringing the frame to the desired 480x480 @ 4:3 size. The transcode option for this is "-Y -60,0,-60,0".
If for some reason (maybe a subtitle filter) the black borders (of height 60 each) should be added before resizing the frame and changing the aspect ratio to 4:3. One reason for that would be the need of running a _pre_ filter after adding the black borders. Then the options "-j" or "--pre_clip" can be used instead of "-Y". In this case the black border height has to be recalculated by applying the aspect ratio 4:3 to the value alreadyfound: 60 * (4/3) = 80. The transcode options "-j -80,0,-80,0" or "--pre_clip -80,0,-80,0" are then used instead of "-Y -60,0,-60,0", and "-Z 480x360,fast" is replaced by "-Z 480x480,fast".
AUTHORS
Written by Thomas Oestreich <ostreich@theorie.physik.uni-goettingen.de>, Tilmann Bitterberg and the Transcode-Team
See the AUTHORS file for details.
SEE ALSO
transcode_export(1) , transcode_filter(1) , transcode_import(1) , avifix(1) , avisync(1) , avimerge(1) , avisplit(1) , tcprobe(1) , tcscan(1) , tccat(1) , tcdemux(1) , tcextract(1) , tcdecode(1) , tcmodinfo(1) , tcxmlcheck(1) , transcode(1)
WWW
Frequently asked questions (FAQ) at http://www.transcoding.org/cgi-bin/transcode?Transcode_FAQ[1] Example transcode sessions at http://www.transcoding.org/cgi-bin/transcode?Command_Examples[1]
BUGS
Yes, there are bugs in transcode! Do your part and report them immediately.
For details, see http://www.transcoding.org/cgi-bin/transcode?Reporting_Problems[1]
NOTES
14th July 2008 | transcode(1) |