ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url}
Option | Description |
-re | Reads input at native frame rate, generally only used for reading local files |
Option | Description |
-c:v | Video Encoding, recommended to use libx264 |
-b:v | Video bitrate, for example, 1500k means 1500kbps |
-r | Video Frame Rate |
-profile:v | Video profile, specifying baseline will not encode B frames, TUIRoomKit backend does not support B frames |
-g | GOP frame interval |
-c:a | Audio Encoding, recommended to use libfdk_aac |
-ac | Number of channels, fill in 2 or 1 |
-b:a | Audio Bitrate |
-f | Specify format, fixed fill in flv , send to TUIRoomKit using FLV container |
ffmpeg -loglevel debug -re -i sample.flv -c:v libx264 -preset ultrafast -profile:v baseline -g 30 -sc_threshold 0 -b:v 1500k -c:a libfdk_aac -ac 2 -b:a 128k -f flv 'rtmp://rtmp.rtc.qq.com/push/yourRoomId?userid=yourUserId&sdkappid=xxxxxxxxx&usersig=xxxxxxxxxx'
Parameter | Meaning |
-i sample.flv | The media file that needs to be streamed to TUIRoomKit. You can replace sample.flv with the local or online media file you need to stream. |
yourRoomId | The Room ID you need to stream to. You need to replace yourRoomId with your actual RoomId. |
userId | The UserID you need to stream with. You need to change the value after "=" to the actual userId. |
sdkappid | Your sdkappid, which you have previously obtained in Activate Service. You need to change the value after "=" to the actual sdkAppID. |
usersig | Your usersig, which you have obtained when logging into TUIRoomKit. You need to change the value after "=" to the actual userSig. |
Parameter Name | Required | Type | Description |
Action | Yes | String | |
Version | Yes | String | |
Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-bangkok, ap-jakarta, ap-mumbai, ap-singapore. |
SdkAppId | Yes | Integer | |
RoomId | Yes | String | |
RoomIdType | Yes | Integer | In TUIRoomKit, just fill in 0. |
UserId | Yes | String | UserId of the Pull stream Relay Robot, used to enter the room and initiate the Pull stream Relay Task. |
UserSig | Yes | String | UserSig corresponding to the Pull stream Relay Robot UserId, i.e., UserId and UserSig are equivalent to the Robot's Login password for entering the room. For the specific Calculation method, please refer to the TUIRoomKit UserSig Scheme. |
SourceUrl | No | Array of String | Source URL. This field is required for historical reasons. If it is a video stream, please keep the resolution unchanged. Example value: https://a.b/test.mp4. |
VideoEncodeParams | No | Video Codec Parameters. Optional, if not filled, Keep original stream Parameters. | |
AudioEncodeParams | No | Audio Codec Parameters. Optional, if not filled, Keep original stream Parameters. | |
SourceUrl.N | No | Array of String | (This field is obsolete, please use the StreamUrl field) Source stream URL, supports one address. Example value: https://a.b/test.mp4. |
SeekSecond | No | Integer | Start playing the video from a specific timestamp. |
Parameter Name | Type | Description |
TaskId | String | The Task ID of the Pull stream Relay. The Task ID is a unique identifier for a Pull stream Relay lifecycle process, and it loses its meaning when the task ends. The Task ID needs to be saved by the business as a parameter for the next operation on this task. |
RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
POST / HTTP/1.1Host: trtc.tencentcloudapi.comContent-Type: application/jsonX-TC-Action: StartStreamIngest<Common request parameters>{"SdkAppId": 1234567890,"RoomId": "room123","UserId": "robot123","UserSig": "xxxxxxxxxxxxxxx","PrivateMapKey": "xxxxxxxxxxxxxxx","RoomIdType": 1,"StreamUrl": "https://a.b/test.mp4"}
{"Response":{"Error":{"Code":"xxxxx","Message":"xxxxxxxxxx",},"RequestId":"b99c5411-9f69-4725-a0e1-e5b5df451fc2"}}
Error code | Description |
FailedOperation.NotRtmpFunction | RTMP not activated |
FailedOperation.RestrictedConcurrency | Single User Concurrency Overload, please contact us to increase the number of concurrent paths to a reasonable value. |
FailedOperation.TaskExist | Task Already Exists |
InternalError.HttpParseFailed | HTTP Request parse failed. |
InternalError.InternalError | Internal error, please try again. |
InvalidParameter.BodyParamsError | Failed to Parse Body Parameters. |
InvalidParameter.RoomId | RoomId parameter error. |
InvalidParameter.SdkAppId | SdkAppId parameter error. |
InvalidParameter.StrRoomId | StrRoomId parameter error. |
InvalidParameter.TaskId | TaskId parameter error. |
InvalidParameter.UserSig | UserSig is expired or incorrect. |
MissingParameter.RoomId | The `RoomId` parameter is missing. |
MissingParameter.SdkAppId | The `SdkAppId` parameter is missing. |
MissingParameter.TaskId | The `TaskId` parameter is missing. |
ResourceInsufficient.RequestRejection | Insufficient resources. |
Was this page helpful?