# PTV file format specification
PTV is the file format used by VideoStitch. It uses full [JSON](http://www.json.org/) syntax. Projects are simply defined by populating the root object with a few named variables.
## Objects
VideoStitch will interpret the following objects. An object is of course free to have other members in addition to these.
In the tables below, mandatory members are shown in bold. If not set, optional members take a default value specified in the "Default value" column.
### Root
VideoStitch will interpret the following members of the root object:
Member | Type | Default value | |
width | int | - | The output width, in pixels. |
height | int | - | The output height, in pixels. |
length | int | - | The length of an edge of the cubemap, in pixels. |
hfov | double | - | The horizontal field of view, in degrees. |
proj | string | - | The projection. See possible values below. |
spherescale | string | - | The stitching sphere scale. |
precomputed_coordinate_buffer | bool | false | Whether to precompute the coordinate buffer for looking up pixel value. If yes, the program will use more GPU memory and run slightly faster. |
precomputed_coordinate_shrink_factor | bool | false | If precomputed_coordinate_buffer is true, the precomputed coordinate buffer will be downsampled by this factor to run faster. |
inputs | array[object] | - | The list of input objects (see below). |
overlays | array[object] | - | The list of overlay objects (see below). |
wrap | boolean | true | If wrap is true, hfov is 360.0, and the projection supports it, then the panorama will wrap seamlessly across 360 border. |
ev | double | 0.0 | Exposure value correction. |
global_yaw | object | null | The panorama's global yaw. Can depend on time. Default is no global yaw. |
global_pitch | object | null | The panorama's global pitch. Default is no global pitch. |
global_roll | object | null | The panorama's global roll. Default is no global roll. |
rig | object | array[object] | Rig definition for calibration presets. See the algorithm documentation for full format. |
cameras | object | array[object] | Cameras definition for calibration presets. See the algorithm documentation for full format. |
Possible values for (Pano)
Member | Type | Default value | |
width | int | - | The input width, in pixels. |
height | int | - | The input height, in pixels. |
hfov | double | - | The horizontal field of view, in degrees (old syntax, replaced by "horizontalFocal" in geometries). |
yaw | double | - | The yaw, in degrees (old syntax, now in geometries). |
pitch | double | - | The pitch, in degrees (old syntax, now in geometries). |
roll | double | - | The roll, in degrees (old syntax, now in geometries). |
reader_config (previously filename) | string or object | - | The reader configuration. Usually a filename, but can be more elaborated to enable advanced features. See the Readers section below. |
proj | string | - | The projection. Possible values |
geometries | curve object | - | The camera geometry curves. |
crop_left | int | 0 | Crop that many pixels from the left of the input. |
crop_right | int | =width | Crop that many pixels from the right of the input. |
crop_top | int | 0 | Crop that many pixels from the top of the input. |
crop_bottom | int | =height | Crop that many pixels from the bottom of the input. |
viewpoint_model | string | "hugin" | Viewpoint model: "hugin" or "ptgui". |
translation_x | double | 0.0 | Viewpoint translation along the X axis (old syntax, now in geometries). |
translation_y | double | 0.0 | Viewpoint translation along the Y axis (old syntax, now in geometries). |
translation_z | double | 0.0 | Viewpoint translation along the Z axis (old syntax, now in geometries). |
viewpoint_pan | double | 0.0 | Viewpoint pan (if viewpoint_model=="ptgui"). |
viewpoint_tilt | double | 0.0 | Viewpoint tilt (if viewpoint_model=="ptgui"). |
dist_center_x | double | 0.0 | Horizontal shift (old syntax, replaced by "center_x" in geometries). |
dist_center_y | double | 0.0 | Vertical shift (old syntax, replaced by "center_y" in geometries). |
response | string | "emor" | Camera response model. One of "emor", "gamma", "linear", "inverse_emor" or "curve". |
gamma | double | 1.0 | If response is "gamma", the gamma response parameter. |
emor_a | double | 0.0 | If response is "emor" or "inverse_emor", the first emor response parameter. |
emor_b | double | 0.0 | If response is "emor" or "inverse_emor", the second emor response parameter. |
emor_c | double | 0.0 | If response is "emor" or "inverse_emor", the third emor response parameter. |
emor_d | double | 0.0 | If response is "emor" or "inverse_emor", the fourth emor response parameter. |
emor_e | double | 0.0 | If response is "emor" or "inverse_emor", the fifth emor response parameter. |
response_curve | [int] | [] | If response is "curve", a list of 1024 integers describing the camera response curve by value. |
ev | double | 0.0 | Exposure value correction. |
red_corr | double | 1.0 | Red white balance multiplier. |
blue_corr | double | 1.0 | Blue white balance multiplier. |
lens_dist_a | double | 0.0 | Lens distortion parameter (degree 0) (old syntax, replaced by "distort_a" in geometries). |
lens_dist_b | double | 0.0 | Lens distortion parameter (degree 1) (old syntax, replaced by "distort_b" in geometries). |
lens_dist_c | double | 0.0 | Lens distortion parameter (degree 2) (old syntax, replaced by "distort_c" in geometries). |
vign_a | double | 1.0 | Vigneting parameter (degree 0). |
vign_b | double | 0.0 | Vigneting parameter (degree 1). |
vign_c | double | 0.0 | Vigneting parameter (degree 2). |
vign_d | double | 0.0 | Vigneting parameter (degree 3). |
vign_x | double | 0.0 | Vigneting center along x axis, relative to image center. |
vign_y | double | 0.0 | Vigneting center along y axis, relative to image center. |
frame_offset | int | 0 | Offset of this input relative to the origin of time, in frames. |
preprocessors | list | [] | A list of processors to run before mapping. See below for a list of available preprocessors. |
mask_data | string | "" | An inline, base64 encoded 2-color colormapped png file, the size of the input. Red pixels are masked out. |
no_delete_masked_pixels | bool | false | If true, masked pixels will just have alpha 0. If false, they will also influence how stitching seams are computed. To get smooth blending around masked areas, always disable no_delete_masked_pixels. |
Possible values for (Input)
horizontalFocal | double | 1000.0 | The horizontal focal parameter, allowing to transform meters into pixels on the sensor plane. |
verticalFocal | double | - | The vertical focal parameter, allowing to transform meters into pixels on the sensor plane. If no value is provided, it is considered equal to the horizontalFocal. |
center_x | double | 0.0 | Principal point / center of distortion horizontal shift in pixels w.r.t. the sensor center. |
center_y | double | 0.0 | Principal point / center of distortion vertical shift in pixels w.r.t. the sensor center. |
distort_a | double | 0.0 | Lens radial distortion parameter (degree 0). |
distort_b | double | 0.0 | Lens radial distortion parameter (degree 1). |
distort_c | double | 0.0 | Lens radial distortion parameter (degree 2). |
distort_p1 | double | 0.0 | First lens tangential distortion parameter. |
distort_p2 | double | 0.0 | Second lens tangential distortion parameter. |
distort_s1 | double | 0.0 | First lens thin-prism distortion parameter. |
distort_s2 | double | 0.0 | Second lens thin-prism distortion parameter. |
distort_s3 | double | 0.0 | Third lens thin-prism distortion parameter. |
distort_s4 | double | 0.0 | Fourth lens thin-prism distortion parameter. |
distort_tau1 | double | 0.0 | First lens Scheimpflug distortion angle parameter, in radians. |
distort_tau2 | double | 0.0 | Second lens Scheimpflug distortion angle parameter, in radians. |
yaw | double | 0.0 | Camera yaw, in degrees. |
pitch | double | 0.0 | Camera pitch, in degrees. |
roll | double | 0.0 | Camera roll, in degrees. |
translation_x | double | 0.0 | Camera translation along the X axis, in meters. |
translation_y | double | 0.0 | Camera translation along the Y axis, in meters. |
translation_z | double | 0.0 | Camera translation along the Z axis, in meters. |
### Overlay
This specifies the geometry and photometry options for each input.
Member | Type | Default value | |
reader_config (previously filename) | string or object | - | The reader configuration. Usually a filename, but can be more elaborated to enable advanced features. See the Readers section below. |
width | int | - | The overlay input width, in pixels. |
height | int | - | The overlay input height, in pixels. |
frame_offset | int | 0 | Offset of this overlay input relative to the origin of time, in frames. |
globalOrientationApplied | [boolean] | [] | Boolean to apply the stitcher orientation to the overlay input. |
scaleCurve | [curve object] | [] | The overlay object size scale curve, value should be in the interval [0.0, 1.0]. |
.
alphaCurve | [curve object] | [] | The overlay object alpha blending curve, value should be in the interval [0.0, 1.0]. |
.
transXCurve | [curve object] | [] | The overlay object position X translation curve, in meters. |
.
transYCurve | [curve object] | [] | The overlay object position Y translation curve, in meters. |
.
transZCurve | [curve object] | [] | The overlay object position Z translation curve, in meters. |
.
rotationCurve | [curve object] | [] | The overlay object position Yaw, Pitch, Roll orientation curve. |
.
### Mergers
Mergers specify how to blend remapped images.
Member | Type | Default value | |
filename | string | - | Output filename, without extension. |
video_codec | string | "h264" | The video codec. Available values are: "mpeg2", "mpeg4" (MPEG4 part2, not h264/AVC), "h264", "mjpeg" (Motion JPEG) |
fps | double | 25 | The framerate. Available values range from 1 to 1000. |
bitrate | int | 15000000 | The bitrate in bits per second. Available values range from 500000 to 110000000. |
gop | int | 25 | Group Of Pictures: set the interval between random-access pictures. Available values range between 1 frame to 10 times the fps value (i.e. 10 seconds). |
b_frames | int | 2 | Specifies the number of B frames in an IP(B)* GOP pattern. Available values ranges from 0 to 5. Ignored with the "mjpeg" video codec. |
pass | int | 1 | The number of pass for video encoding. The higher the better quality. Available values range from 1 to 2. |
bitrate_mode | string | "VBR" | The rate-control mode. Available values are "VBR" (Variable Bit Rate) and "CBR" (Constant Bit Rate). |
max_video_file_chunk | int | - | When this value in bytes is set, the video writer will split the video file into multiple ones if the file size reaches this limit. Due to buffered frames, headers and trailers, a safety margin is taken, the video files chunks will be approximately 5% below this limit. |
max_moov_size | int | - | Reserves at most this space for the moov atom at the beginning of the file instead of placing the moov atom at the end. The file writer will try to reserve dedicated space at the beginning of the files to fill the moov atom. If the estimated space needed is larger than max_moov_size the moov atom will be added at the end of the file and the file will be post processed. Disabled if max_video_file_chunk is not set. |
min_moov_size | int | - | Reserves at least this space for the moov atom at the beginning of the file. Disabled if max_video_file_chunk is not set. |
extra_params | string | "" | Some custom coma-separated parameters to be directly pushed to the libav encoder. Example: "preset=superfast,profile=baseline" |
#### Audio output