Command Line Mode

Introduction

Command-line mode can be useful for automating the processing of multiple files, such as preparing for printing, or publishing to the Internet.

To do this, the application includes the command-line utility stereo-conv.

In Windows, when installed, the path to the application folder is automatically added to the PATH variable. In order for these changes to take effect, you need to re-login.

Running with the –help option, or without options, displays usage help. Example:

$ stereo-conv --help

Usage: stereo-conv [options] input input2
Converter for stereoscopic photos and videos.
https://stereophotoview.bitbucket.io/en                                                                                    
                                                                                                                           
Options:                                                                                                                   
  -h, --help                 Displays this help.                                                                           
  -v, --version              Displays version information.                                                                 
  -o, --output <file>        Output file.                                                                                  
  --input-layout <layout>    Input stereo layout (see --layouts) - optinal.                                                
  --input-revert <1|0>       Right-eye view first in the input file - optional.                                            
  --output-layout <layout>   Output stereo layout (see --layouts). Default -                                               
                             Monoscopic.                                                                                   
  --output-revert <1|0>      Right-eye view first in the output file -                                                     
                             optional.                                                                                     
  --size <width*height>      Output image size.
  --jpeg-quality <0..100>    Jpeg quality.
  --crf <1..51>              Constant rate factor. Default - 23.
  --preset <preset>          Preset for H264 codec (see --presets). Default -
                             medium.
  --operations <operations>  List of operations separated by a semicolon (see
                             --help-operations).
  -p, --progress             Display progress when saving video.
  -l, --layouts              Display a list of layouts.
  --video-formats            Display a list of video formats.
  --presets                  Display a list of presets.
  --help-operations          Display a list of operations.

Arguments:
  input                      Input file.
  input2                     Optional second input file to load a separate
                             stereo pair.

Examples

Extracting Left View From MPO File

Convert src.mpo to src-left.jpg.
Default output format for JPEG files is Mono.

stereo-conv -o src-left.jpg src.mpo

Extracting Right View From MPO File

Convert src.mpo to src-right.jpg. Default output format for JPEG files is Mono.
Determine the reverse order of the angles to extract the right angle: --output-revert 1.

stereo-conv --output-revert 1 -o src-right.jpg src.mpo

Сonversion of Two Separate Images to Anaglyph

Convert src-left.jpg and src-right.jpg to the anaglyph.jpg.
Specify the output format AnaglyphRC.

stereo-conv --output-layout AnaglyphRC -o anaglyph.jpg src-left.jpg src-right.jpg

Convertion of Side-by-Side Stereo Pair to MPO File

Convert src.jps with side-by-side stereo pair to the result.mpo file.
Specify the input format Horizontal. The output format is determined by the file extension.

stereo-conv --input-layout Horizontal -o result.mpo src.jps

Сonversion of Two Separate Images to MPO File with Automatic Horizontal and Vertical Alignment, and Rotation

Convert src-left.jpg and src-right.jpg to result.mpo, perform operation auto-align:hvr.

stereo-conv --operations auto-align:hvr -o result.mpo src-left.jpg src-right.jpg

Convertion From MPO File to an Interlaced Stereo Pair With a Frame Fize of 1920x1080:

Convert src.mpo to interlaced.jpg, specify output format RowInterlaced and size --size 1920*1080.

stereo-conv --output-layout RowInterlaced -o interlaced.jpg --size "1920*1080" src.mpo

Conversion a File Containing Two Video Streams to Anamorphic Side-By-Side Format

Convert source.avi to result.mp4 specify AnamorphHorizontal output format.
The input format is determined automatically by the presence of two video streams.

stereo-conv --output-layout AnamorphHorizontal -p -o result.mp4 src.avi

Extracting Left Angle from Anamorphic Side-By-Side Video File

Extract video stream with left view from the src.mp4 to the src-left.mp4.
Specify input format AnamorphHorizontal and display of progress -p.

stereo-conv --input-layout AnamorphHorizontal -p -o src-left.mp4 src.mp4

Examples of Group Operations

The Windows loops below use interactive cmd.exe; Linux examples use bash. Use new empty output folders and test on copies first. For scripts that stop on errors and refuse an existing output folder, see the batch guide.

Create MPO Files from All the Separate Images for the Left and Right Eyes

Windows cmd.exe (interactive prompt): enable delayed expansion so the loop uses the current filename. Create a new empty mpo-results folder first. For a .bat file, replace %f with %%f.

cmd /v:on
for %f in (*-left.jpg) do (set "F=%~nxf" & stereo-conv -o "mpo-results/!F:-left.jpg=.mpo!" "!F!" "!F:-left.jpg=-right.jpg!")

Linux:

for f in *-left.jpg; do stereo-conv -o "mpo-results/${f%-left.jpg}.mpo" "$f" "${f%-left.jpg}-right.jpg"; done

Extract Left Angles From the All MPO Files

Convert all files with the extension mpo into files with the same name, adding the ending -left.jpg, and save to the folder separate.
The input and output formats are determined automatically by extension.
You must first create the “separate” folder.

Windows:

for %f in (*.mpo) do stereo-conv -o "separate/%~nf-left.jpg" "%~f"

Linux:

for f in *.mpo; do stereo-conv -o "separate/${f%.mpo}-left.jpg" "$f"; done

Extract Right Angles from the All MPO Files

Convert all files with the extension mpo into files with the same name, adding the ending -right.jpg, and save to the folder separate.
The input and output formats are determined automatically by extension.
In order to extract the right angle, specify the reverse order of angles --output-revert 1.
You must first create the “separate” folder.

Windows:

for %f in (*.mpo) do stereo-conv --output-revert 1 -o "separate/%~nf-right.jpg" "%~f"

Linux:

for f in *.mpo; do stereo-conv --output-revert 1 -o "separate/${f%.mpo}-right.jpg" "$f"; done

Automatic Vertical Alignment of All MPO Files

Convert all files with the extension mpo into files with the same name in the folder result, and perform the operation auto-align:v.
You must first create the “result” folder.

Windows:

for %f in (*.mpo) do stereo-conv --operations auto-align:v -o "result/%~nxf" "%~f"

Linux:

for f in *.mpo; do stereo-conv --operations auto-align:v -o result/$f $f

Practical guides