videoCodecOptions
info
Added in Scrcpy 2.0
- Type:
CodecOptions | string | undefined - Default value:
undefined
Configures video encoding parameters for the selected video codec.
This option allows fine-tuning of video encoding parameters. It accepts either a structured object of codec options or a string with key-value pairs in the format "key1=value1,key2=value2".
For detailed information about codec options, refer to the Android MediaFormat documentation.
Codec Options Classes
For structured configuration, Scrcpy provides codec options classes that implement the ScrcpyOptionValue interface. These classes offer type-safe methods for setting codec parameters.
- ScrcpyCodecOptions: Base class for configuring codec options
- ScrcpyVideoCodecOptions: Extended class with video-specific methods
Related options
videoCodec: Specifies the video codec to usevideoBitRate: Controls the video bitratecodecOptions(deprecated): Previous option for configuring codec options (replaced by this option)
Examples
Using video codec options class instance for type-safe configuration:
import { ScrcpyOptions2_0, ScrcpyVideoCodecOptions } from "@yume-chan/scrcpy";
// Using ScrcpyVideoCodecOptions class instance
const videoCodecOptions = new ScrcpyVideoCodecOptions()
.setProfile(AndroidAvcProfile.Main) // Set encoder profile to Main
.setLevel(AndroidAvcLevel.Level31); // Set encoder level to 3.1
const options1 = new ScrcpyOptions2_0({
videoCodecOptions: videoCodecOptions,
});
Using string format for simple configuration:
import { ScrcpyOptions2_0 } from "@yume-chan/scrcpy";
// Using string format
const options2 = new ScrcpyOptions2_0({
videoCodecOptions: "profile=1,level=1024", // Simple string format (Main profile, Level 3.1)
});