Skip to content

Commit

Permalink
Implement high motion presets (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
biglittlebigben authored Oct 16, 2023
1 parent a02c801 commit 8dce942
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/livekit/go-rtmp v0.0.0-20230829211117-1c4f5a5c81ed
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
github.com/livekit/mediatransportutil v0.0.0-20230906055425-e81fd5f6fb3f
github.com/livekit/protocol v1.7.2
github.com/livekit/protocol v1.7.3-0.20231002023823-525419ade0bf
github.com/livekit/psrpc v0.3.3
github.com/livekit/server-sdk-go v1.0.17-0.20230928233454-b49bf45b164b
github.com/pion/dtls/v2 v2.2.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
github.com/livekit/mediatransportutil v0.0.0-20230906055425-e81fd5f6fb3f h1:b4ri7hQESRSzJWzXXcmANG2hJ4HTj5LM01Ekm8lnQmg=
github.com/livekit/mediatransportutil v0.0.0-20230906055425-e81fd5f6fb3f/go.mod h1:+WIOYwiBMive5T81V8B2wdAc2zQNRjNQiJIcPxMTILY=
github.com/livekit/protocol v1.7.2 h1:TPk8rIv5ZZSx1IU5jaGA2W+RdoDlE8dp4CFHE0MKoGo=
github.com/livekit/protocol v1.7.2/go.mod h1:zbh0QPUcLGOeZeIO/VeigwWWbudz4Lv+Px94FnVfQH0=
github.com/livekit/protocol v1.7.3-0.20231002023823-525419ade0bf h1:xP2dEUn8T/UGXqF5CBD0s34mJaQ454LlAsq70SPJkj8=
github.com/livekit/protocol v1.7.3-0.20231002023823-525419ade0bf/go.mod h1:zbh0QPUcLGOeZeIO/VeigwWWbudz4Lv+Px94FnVfQH0=
github.com/livekit/psrpc v0.3.3 h1:+lltbuN39IdaynXhLLxRShgYqYsRMWeeXKzv60oqyWo=
github.com/livekit/psrpc v0.3.3/go.mod h1:n6JntEg+zT6Ji8InoyTpV7wusPNwGqqtxmHlkNhDN0U=
github.com/livekit/server-sdk-go v1.0.17-0.20230928233454-b49bf45b164b h1:4rm2CAPOfLG7r7texpyhf0HEE5xvAkFfg+UrcxV4x3U=
Expand Down
56 changes: 56 additions & 0 deletions pkg/params/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,62 @@ func getOptionsForVideoPreset(preset livekit.IngressVideoEncodingPreset) (*livek
Bitrate: 3_500_000,
}, 1),
}, nil
case livekit.IngressVideoEncodingPreset_H264_720P_30FPS_3_LAYERS_HIGH_MOTION:
return &livekit.IngressVideoEncodingOptions{
VideoCodec: livekit.VideoCodec_H264_BASELINE,
FrameRate: 30,
Layers: computeVideoLayers(&livekit.VideoLayer{
Quality: livekit.VideoQuality_HIGH,
Width: 1280,
Height: 720,
Bitrate: 2_500_000,
}, 3),
}, nil
case livekit.IngressVideoEncodingPreset_H264_1080P_30FPS_3_LAYERS_HIGH_MOTION:
return &livekit.IngressVideoEncodingOptions{
VideoCodec: livekit.VideoCodec_H264_BASELINE,
FrameRate: 30,
Layers: computeVideoLayers(&livekit.VideoLayer{
Quality: livekit.VideoQuality_HIGH,
Width: 1920,
Height: 1080,
Bitrate: 4_500_000,
}, 3),
}, nil
case livekit.IngressVideoEncodingPreset_H264_540P_25FPS_2_LAYERS_HIGH_MOTION:
return &livekit.IngressVideoEncodingOptions{
VideoCodec: livekit.VideoCodec_H264_BASELINE,
FrameRate: 25,
Layers: computeVideoLayers(&livekit.VideoLayer{
Quality: livekit.VideoQuality_HIGH,
Width: 960,
Height: 540,
Bitrate: 1_300_000,
}, 2),
}, nil
case livekit.IngressVideoEncodingPreset_H264_720P_30FPS_1_LAYER_HIGH_MOTION:
return &livekit.IngressVideoEncodingOptions{
VideoCodec: livekit.VideoCodec_H264_BASELINE,
FrameRate: 30,
Layers: computeVideoLayers(&livekit.VideoLayer{
Quality: livekit.VideoQuality_HIGH,
Width: 1280,
Height: 720,
Bitrate: 2_500_000,
}, 1),
}, nil
case livekit.IngressVideoEncodingPreset_H264_1080P_30FPS_1_LAYER_HIGH_MOTION:
return &livekit.IngressVideoEncodingOptions{
VideoCodec: livekit.VideoCodec_H264_BASELINE,
FrameRate: 30,
Layers: computeVideoLayers(&livekit.VideoLayer{
Quality: livekit.VideoQuality_HIGH,
Width: 1920,
Height: 1080,
Bitrate: 4_500_000,
}, 1),
}, nil

default:
return nil, errors.ErrInvalidVideoPreset
}
Expand Down

0 comments on commit 8dce942

Please sign in to comment.