CRI Sofdec2  Last Updated: 2022-11-21 16:25 p
Console Version Sofdec.Prime Encoder

This is a console tool for creating Sofdec2 data using the Sofdec.Prime video codec.

You can output a batch file for this tool by performing the Batch Encoding procedure from a project that specifies Sofdec.Prime as the video codec in the GUI version of the encoding tool.

Executable File Name

  • sofdec2enc.exe

Input and Output Files

Basic Usage

To run the Sofdec2 encoder, open a Command Prompt and enter the command in the following format on the command line.

[Format] sofdec2enc [-subcommand=param1[,param2,...]]
[Inputs] subcommand : A subcommand
param# : Subcommand parameters


[Example] Create a Sofdec2 file named "sample.usm" using a video file named "smpvid.avi" and an audio file named "smpaud.wav" as inputs.

> sofdec2enc -in=sample.avi -out=sample.usm


[Notes] Subcommands
Subcommands are command options that specify to the program what processing to perform.
For example, subcommands are used to specify the input file, output file, and operating methods to the program.


Subcommands List

  • File Subcommands
    Subcommand Name Details
    in Input video file specification
    out Output file specification
    video## Video file specification
    alpha## Alpha file specification
    audio## Audio file specification
    mca##_** Surround sound movie audio file specification
    subtitle## Subtitle information file specification
    cuepoint Cuepoint information file specification

  • Video Editing Subcommands
    Subcommand Name Details
    crop Crop
    scale Resize

  • Encoding Settings Subcommands
    Subcommand Name Details
    bitrate Bit rate specification
    br_range Bit rate range specification when using a variable bit rate
    framerate Frame rate specification
    hcfilter High compression filter application
    gop_i Number of I pictures
    gop_p Number of P pictures
    gop_b Number of B pictures
    gop_closed Closed GOP
    detectsc Scene change detection
    ms_fullpel_still Full-pel motion search specification for still images
    qmf_range Adaptive quantization matrix range specification
    alpha_quality Alpha channel quality adjustment

  • Audio Encoding Settings Subcommands
    Subcommand Name Details
    hca Encode audio materials using the HCA codec
    hca_quality Audio quality setting when using the HCA codec

  • Other
    Subcommand Name Details
    cleanup Delete intermediate files
    work_dir Working directory specification
    debug Debug information output
    outputsc [Experimental] Scene change position list file output


Subcommand Specifications

File Subcommands

in: Input Video File Specification
[Format] -in=filename
[Input] filename: The input video file.
[Function] Specifies the input video file.


This subcommand is required to specify the input video file.
You can use this subcommand instead of the "video" subcommand.

[Example] Specify "sample.avi" as the input video file.

> sofdec2enc -in=sample.avi -out=sample.usm



out: Output File Specification
[Format] -out=filename
[Input] out: The output file (usm file).
[Function] Specifies the output file name.

This subcommand is required to specify the output file name.
Specify "usm" as the file extension.

[Example] Specify "sample.usm" as the output file name.

> sofdec2enc -in=sample.avi -out=sample.usm



video: Video File Specification
[Format] -video##=filename
[Input] filename: The video file.
## : Video track number (##=00)
[Function] Specifies the input video file.


(1) Video File
For details on video files, refer to Video Material Files.

(2) Video Track Number
You must specify 00 for the track number.
Other track numbers are not supported.

[Example] Assign the AVI file "smpvid.avi" to track 00.

> sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm



alpha: Alpha File Specification
[Format] -alpha##=filename
[Input] filename: The alpha file.
## : Alpha track number (##=00)
[Function] Specifies the input alpha file.


When creating an alpha movie, specify an AVI file that includes the alpha channel you want to encode.

(1) Alpha Track Number
You must specify 00 for the track number.

[Example] Assign the alpha channel of the AVI file "smpvid.avi" to track 00.

> sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm
-alpha00=smpvid.avi



audio: Audio File Specification
[Format] -audio##=filename
[Input] filename: The audio file.
## : Audio track number (Range: 00 to 31)
[Function] Specifies the input audio file(s).


(1) Audio File
For details on audio files, refer to Audio Material Files.

(2) Audio Track Number
(a) The track number specified here will be the audio track number in the Sofdec2 file.
(b) If you will only use one audio file, use track 00.
(c) You can specify up to 32 audio files.

[Example] Assign English audio to track 01 and Japanese audio to track 02, and assign music files to track 00.

> sofdec2enc -video00=smpvid.avi -out=sample.usm
-audio00=music.wav -audio01=voice_en.wav -audio02=voice_ja.wav



mca: Surround Sound Movie Audio File Specification
[Format] -mca##_**=filename
[Input] filename: The audio file.
## : Audio track number (Range: 00 to 31)
: Audio channel number (Range: 00 to 05)
[Function] Specifies the audio files for surround sound movies.


(1) Audio File
(a) To create data for a surround sound movie, you must have material files that correspond to each speaker position.
(b) Surround sound movie material files must be monaural data.

(2) Audio Track Number
(a) The track number specified here will be the audio track number in the Sofdec2 file.
(b) If you will only use one audio track, use track 00.
(c) You can specify up to 32 audio files.

(3) Channel Number
(a) You cannot omit the channel specifications for surround sound movie data. You must specify a material file for all channels.
(b) The following table shows the channel number and speaker position for each surround sound movie audio file.

Channel Number Speaker Position
00 LEFT
01 RIGHT
02 LEFT Surround
03 RIGHT Surround
04 CENTER
05 LFE


[Example] Assign a surround sound movie audio file to track 00.

> sofdec2enc -video00=smpvid.avi -out=sample.usm
-mca00_00=fl.wav -mca00_01=fr.wav -mca00_02=sl.wav -mca00_03=sr.wav
-mca00_04=c.wav -mca00_05=lfe.wav



subtitle: Subtitle Information File Specification
[Format] -subtitle##=filename
[Input] filename: Subtitle Information File
## : Subtitle channel number (Range: 00 to 15)
[Function] Specifies the subtitle information file.


(1) Subtitle Information File
For details on subtitle information files, refer to Subtitle Information Files.

(2) Subtitle Channel Number
(a) The channel number specified here is the subtitle channel number for the Sofdec2 data.
(b) If you will only use one subtitle information file, use channel 00.
(c) You can specify up to 16 subtitle information files.

[Example] Assign an English subtitle information file and a Japanese subtitle information file to channels 00 and 01, respectively.

> sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm
-subtitle00=subttl_en.txt -subtitle01=subttl_ja.txt



cuepoint: Cuepoint Information File Specification
[Format] -cuepoint=filename
filename: Cuepoint Information File
[Function] Specifies the cuepoint information file.


For details on cuepoint information files, refer to Cuepoint Information Files.

[Example]

> sofdec2enc -in=sample.avi -out=sample.usm -cuepoint=sample_cuepoint.txt



Video Editing Subcommands

crop: Crop
[Format] -crop=crx,cry,crw,crh
[Inputs] crx: The X coordinate of the cropped image in relation to the source image.
cry: The Y coordinate of the cropped image in relation to the source image.
crw: The width of the cropped image.
crh: The height of the cropped image.
[Function] Crops a portion of the video material.


You can specify a cropped image within the area of the source image.
By default, no cropping is performed.

[Example] Crop the video material at coordinates (0,0) to a size of 640x480.

> sofdec2enc -in=sample.avi -out=sample.usm -crop=0,0,640,480



scale: Resize
[Format] -scale=scw,sch
[Inputs] scw: The width of the resized image.
sch: The height of the resized image.
[Function] Resizes the source image through pixel value averaging.


By default, no resizing is performed.
The resized resolution must be between 1x1 to 4088x2400,
and a multiple of 8.

[Example] Resize to 640x480.

> sofdec2enc -in=sample.avi -out=sample.usm -scale=640,480



Encoding Settings Subcommands

bitrate: Bit Rate Specification
[Format] -bitrate=rate
[Input] rate: The bit rate (in bps).
[Function] Specifies the bit rate of the output file.


If this subcommand is omitted, a high quality file will be output without retrying.

  • Default Value: 3000000 bps

[Example] Set the bit rate to 6 Mbps.

> sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm
-bitrate=6000000



br_range: Bit Rate Range Specification When Using a Variable Bit Rate
[Format] -br_range=min,max
[Inputs] min: The minimum bit rate (in bps).
max: The maximum bit rate (in bps).
[Function] Specifies the maximum and minimum values for the bit rate range when using a variable bit rate.


  • Default Value: min=0bps, max=3000000bps

[Example] Encode with a minimum bit rate of 0 bps and a maximum bit rate of 3000000 bps.

> sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm
-br_range=0,3000000



framerate: Frame Rate Specification
[Format] -framerate=decfr
-framerate=fr_num,fr_den
[Inputs] decfr: Specify the frame rate in decimal format.
fr_num: Specify the frame rate as a fraction. Numerator
fr_den: Specify the frame rate as a fraction. Denominator
[Function] Specifies the frame rate of the movie. [fps]


  • There are two methods of specifying the frame rate: We will use 29.97 fps as an example.
    • Decimal expression: -framerate=29.97
    • Fractional expression: -framerate=30000/1001
  • You can specify a frame rate up to 60 FPS.
  • If this subcommand is omitted, the frame rate of the video material is used.
  • If you will also specify audio, you must prepare the audio materials so that they match the new frame rate (e.g., by changing the sampling frequency to match up with the video).
  • Note that the frame rate setting does not insert frames
    or cull frames.
    The frame rate information specified here will be embedded in the header of the movie data,
    and is used for frame retrieval timing adjustment and other processing during runtime playback.
    For example, if you encode 60 FPS source video material at 30 FPS, the data size will not change.
    To create an actual 30 FPS movie, you must prepare the source material at 30 FPS.

    [Example] Set the frame rate to 29.97 FPS.
    > sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm
    -framerate=29.97


hcfilter: High Compression Filter Application
[Format] -hcfilter=fltype
[Input] fltype: The high compression filter application method.
ON: Always ON
OFF: Always OFF
AUTO: Automatically sets to ON when the filter can be applied. (Default)
[Function] Applies a high compression filter when encoding video.


A high compression filter is particularly effective when encoding at a low bit rate.


gop_i: Number of I Pictures
[Format] -gop_i=count
[Input] count: The number of I pictures in the GOP.
[Function] Specifies the number of I pictures in the GOP.


You can improve movie quality by adjusting the GOP length and the number of I, P, and B pictures in the GOP.

  • Increase the number of I pictures to reduce decoding load.
    However, note that the amount of data for I pictures is greater than that of other picture types.
  • Default Value: 1


gop_p: Number of P Pictures
[Format] -gop_p=count
[Input] count: The number of P pictures in the GOP.
[Function] Specifies the number of P pictures in the GOP.


You can improve movie quality by adjusting the GOP length and the number of I, P, and B pictures in the GOP.

  • P pictures are larger than B pictures, but not as large as I pictures in size.
  • Default Value: 4


gop_b: Number of B Pictures
[Format] -gop_b=count
[Input] count: The number of B pictures in the GOP.
[Function] Specifies the number of B pictures to place between the I pictures and P pictures in the GOP.


You can improve movie quality by adjusting the GOP length and the number of I, P, and B pictures in the GOP.

  • You can increase the number of B pictures to allocate a larger amount of information with the same bit rate, which can increase the compression ratio of the movie.
    However, this will increase the decoding load.
  • Default Value: 2


gop_closed: Closed GOP
[Format] -gop_closed=sw
[Input] sw: Closed GOP switch.
ON: Set as a closed GOP. (Default)
OFF: Do not set as a closed GOP.
[Function] Enables closed GOP.


When set as a closed GOP, the GOP sequence will be independent from other GOPs, which makes editing more simple.


detectsc: Scene Change Detection
[Format] -detectsc=sw
[Input] sw: Scene change detection switch.
ON: (Default)
OFF:
[Function] Enables scene change detection.


You can use scene change detection to automatically insert I pictures.
By inserting an I picture at the beginning of a new scene, you can improve the image quality immediately after a scene change.


ms_fullpel_still: Full-pel Motion Search Specification for Still Images
[Format] -ms_fullpel_still=sw
[Input] sw: Movement search full-pel specification for still images switch.
ON:
OFF: (Default)
[Function] Specifies whether to use full-pels for still image movement searching.


When this option is enabled, half-pel is used for movement searching in video, and full-pel is used for movement searching in still images.
This can reduce distortion in dark scenes, but also makes it impossible to render tiny movements.


qmf_range: Adaptive Quantization Matrix Range Specification
[Format] -qmf_range=range_low, range_high
[Inputs] range_low: Specifies the lower limit value of the range in decimal format (Default: 0.0)
range_high: Specifies the upper limit value of the range in decimal format (Default: 5.0)
[Function] Adjusts the quantization matrix applied when encoding and adjusts the compression ratio.


When this option is used, the applied quantization matrix is adjusted
to enable better compression.

For example, if you set the upper limit value of this range to a value lower than the default value of 5.0,
a high-compression matrix is applied.
Try lowering the upper limit value (4.0, 3.0, 2.0, etc.) to adjust the image quality and compression ratio.

[Example] Change the upper limit value of the applied quantization matrix range to 4.0.

> sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm
-qmf_range=0.0,4.0



alpha_quality: Alpha Channel Quality Adjustment
[Format] -alpha_quality=ratio
[Input] ratio: The bit rate ratio of the alpha portion to the RGB portion. (Default: 100)
[Function] Adjusts the compression ratio of the alpha portion of an alpha movie.


When encoding an alpha movie, you can specify the bit rate ratio of the alpha portion to the RGB portion
to adjust the compression ratio. The value specified for this option can be
between 100 and 0[%].
If 100 is specified, the same bit rate specified for the RGB portion is applied, or if 50 is specified,
half of the bit rate specified for the RGB portion is applied to the alpha portion for encoding.

[Example] Assign half of the specified bit rate to the alpha portion for encoding.

> sofdec2enc -video00=smpvid.avi -audio00=smpaud.wav -out=sample.usm
-alpha00=smpvid.avi -alpha_quality=50



Audio Encoding Settings Subcommands

hca: Encode audio materials using the HCA codec.
[Format] -hca=sw
[Input] sw: Switch that designates whether to perform HCA encoding.
ON: Encode.
OFF: Do not encode. (Default)
[Function] Specifies whether to encode audio using HCA encoding.


If the HCA option is set to OFF, the ADX codec is used for encoding. For details on codecs, refer to Codec Selection.

hca_quality: Audio Quality Settings When Using the HCA Codec
[Format] -hca_quality=count
[Input] count: The encoding quality setting. You can specify any of the following five values:
5 = Highest quality
4 = High quality (Default)
3 = Medium quality
2 = Low quality (high compression)
1 = Lowest quality (maximum compression)
[Function] Specifies whether to encode audio using HCA encoding.


The general compression ratios for each encoding quality setting value are shown in the following table.

Quality Setting When Monaural When Stereo or Better
5 1/4 1/4
4 1/6 1/6
3 1/8 1/8
2 1/10 1/12
1 1/12 1/16



Other Subcommands

cleanup: Delete intermediate files.
[Format] -cleanup=sw
[Input] sw: Switch that designates whether to delete intermediate files.
ON: Delete. (Default)
OFF: Do not delete.
[Function] Specifies whether to delete intermediate files generated during the encoding process.


When set to OFF, the Sofdec2 video file (.sfv) and Sofdec2 audio file (.sfa) will remain in the same folder as the material files.
The default value for this option is ON (delete intermediate files).


work_dir: Working Directory Specification
[Format] -work_dir=dirname
[Input] dirname: working directory
[Function] Specifies the working directory for intermediate files generated during encoding.


If no working directory is specified, intermediate files will be created in the same location as the input files.


debug: Debug Information Output
[Format] -debug=sw
[Input] sw: Switch for debug information output.
ON: Display debug information.
OFF: Do not display debug information. (Default)
[Function] Sets to display debug information.


The default setting is OFF. (No debug information)


outputsc: Scene Change Position List File Output
[Format] -outputsc=filename
[Input] filename: Output file name of the scene change position list file.
[Function] Outputs a list of frame numbers during which a scene change occurred.


The encoding materials are analyzed during encoding and a list file containing the frame numbers when a scene change occurs is output.
This can be used to determine approximately where in a video that editing was performed, if the video material has been edited.

This function has been added as an experimental function. The specifications for this function may change without prior notice.