Rillke/opusenc.js

Is how can change encoder params?

Closed this issue · 1 comments

Hey

In c/c++ I can use code like below

opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC(packetLossPercent));
opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC( percent > 0 ? 1 : 0 ));
opus_encoder_ctl(enc, OPUS_SET_DTX(enable ? 1 : 0));

Is it possible to do same things in js?

Thank you

It is supposed to do the same as the opusenc tool from the opus-tools collection, not the Opus library. [Source: Second line of the README.md]

Run the tool --help to see possible options:

Usage: opusenc [options] input_file output_file.opus
Encode audio using Opus.
The input format can be Wave, AIFF, FLAC, Ogg/FLAC, or raw PCM.
input_file can be:
  filename.wav      file
  -                 stdin
output_file can be:
  filename.opus     compressed file
  -                 stdout
General options:
 -h, --help         Show this help
 -V, --version      Show version information
 --help-picture     Show help on attaching album art
 --quiet            Enable quiet mode
Encoding options:
 --bitrate n.nnn    Set target bitrate in kbit/sec (6-256/channel)
 --vbr              Use variable bitrate encoding (default)
 --cvbr             Use constrained variable bitrate encoding
 --hard-cbr         Use hard constant bitrate encoding
 --comp n           Set encoding complexity (0-10, default: 10 (slowest))
 --framesize n      Set maximum frame size in milliseconds
                      (2.5, 5, 10, 20, 40, 60, default: 20)
 --expect-loss      Set expected packet loss in percent (default: 0)
 --downmix-mono     Downmix to mono
 --downmix-stereo   Downmix to stereo (if >2 channels)
 --max-delay n      Set maximum container delay in milliseconds
                      (0-1000, default: 1000)
Metadata options:
 --title title      Set track title
 --artist artist    Set artist or author, may be used multiple times
 --album album      Set album or collection
 --genre genre      Set genre, may be used multiple times
 --date YYYY-MM-DD  Set date of track (YYYY, YYYY-MM, or YYYY-MM-DD)
 --comment tag=val  Add the given string as an extra comment
                      This may be used multiple times
 --picture file     Attach album art (see --help-picture)
                      This may be used multiple times
 --padding n        Reserve n extra bytes for metadata (default: 512)
 --discard-comments Don't keep metadata when transcoding
 --discard-pictures Don't keep pictures when transcoding
Input options:
 --raw              Interpret input as raw PCM data without headers
 --raw-bits n       Set bits/sample for raw input (default: 16)
 --raw-rate n       Set sampling rate for raw input (default: 48000)
 --raw-chan n       Set number of channels for raw input (default: 2)
 --raw-endianness n 1 for big endian, 0 for little (default: 0)
 --ignorelength     Ignore the data length in Wave headers
Diagnostic options:
 --serial n         Force use of a specific stream serial number
 --save-range file  Save check values for every frame to a file
 --set-ctl-int x=y  Pass the encoder control x with value y (advanced)
                      Preface with s: to direct the ctl to multistream s
                      This may be used multiple times