エンコーディング構成ファイルの設定
このチュートリアルでは、以下の構成の設定方法を説明します。
1. ビデオエンコーディング構成を設定します。
2. オーディオエンコーディング構成を設定します。
3. 画面共有エンコーディング構成を設定します。
ビデオエンコーディング構成を設定
定義済みの構成ファイルを指定し、各構成ファイルが推奨解像度、フレームレート、ビットレートのセットに対応します。
// Specify video profile when startingawait trtc.startLocalVideo({option:{ profile:'480p' }});// Dynamically adjust video profile during the callawait trtc.updateLocalVideo({option:{ profile:'360p' }});
ビデオ Profile | 解像度(幅x高さ) | フレームレート (fps) | ビットレート(kbps) |
120p | 160 x 120 | 15 | 200 |
180p | 320 x 180 | 15 | 350 |
240p | 320 x 240 | 15 | 400 |
360p | 640 x 360 | 15 | 800 |
480p | 640 x 480 | 15 | 900 |
720p | 1280 x 720 | 15 | 1500 |
1080p | 1920 x 1080 | 15 | 2000 |
1440p | 2560 x 1440 | 30 | 4860 |
4K | 3840 x 2160 | 30 | 9000 |
カスタム解像度、フレームレート、ビットレートを指定します。
// Specify video profile when startingawait trtc.startLocalVideo({option:{ profile:{ width:640, height:480, frameRate:15, bitrate:900 /* kpbs */} }});// Dynamically adjust video profile during the callawait trtc.updateLocalVideo({option:{ profile:{ width:640, height:360, frameRate:15, bitrate:800 /* kpbs */} }});
説明:
1. デバイスやブラウザの制限により、ビデオ解像度が完全に一致しない場合があります。この場合、ブラウザは自動的に解像度を profile で指定された解像度に近づけるように調整します。
2. ネットワークや CPU の性能により、ビデオエンコーディングの解像度やフレームレートが予想より低くなる場合があります。
2.1 カメラの場合、デフォルトはフレームレート優先で、性能が不十分な時に解像度を適切に下げ、フレームレートのエンコーディングを優先的に保証します。
2.2 画面共有の場合、デフォルトは解像度優先で、性能が不十分な時にフレームレートを適切に下げ、解像度のエンコーディングを優先的に保証します。
trtc.startLocalVideo() と trtc.updateLocalVideo()の qosPreference パラメータでこの優先度を変更できます。QOS_PREFERENCE_SMOOTH と QOS_PREFERENCE_CLEARを参照してください。
オーディオエンコーディング構成の設定
// Default profileawait trtc.startLocalAudio({ option:{ profile:TRTC.TYPE.AUDIO_PROFILE_STANDARD }});// Note:SDK does not support dynamic adjustment of audio profile during the call.// You have to set audio profile in trtc.startLocalAudioawait trtc.updateLocalAudio({ option:{ profile:TRTC.TYPE.AUDIO_PROFILE_HIGH }}); // Does not works.
Audio Profile | サンプリングレート | チャンネル数 | ビットレート (kbps) |
TRTC.TYPE.AUDIO_PROFILE_STANDARD( Default) | 48000 | モノラル | 40 |
TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | モノラル | 128 |
TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | ステレオ | 64 |
TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | ステレオ | 192 |
画面共有エンコーディング構成の設定
// The default profile is '1080p'await trtc.startScreenShare({ option:{ profile:'1080p_2' }});// Note:SDK does not support dynamic adjustment of screen sharing profile during the call.// Specify custom profile when startingawait trtc.startLocalVideo({option:{ profile:{ width:1280, height:720, frameRate:15, bitrate:1500 /* kpbs */} }});
画面 Profile | 解像度(幅x高さ) | フレームレート (fps) | ビットレート(kbps) |
480p | 640 x 480 | 5 | 900 |
480p_2 | 640 x 480 | 30 | 1000 |
720p | 1280 x 720 | 5 | 1200 |
720p_2 | 1280 x 720 | 30 | 3000 |
1080p | 1920 x 1080 | 5 | 1600 |
1080p_2 | 1920 x 1080 | 30 | 4000 |