Abstract: Users often need to analyze the content of live video. For example, the content of a certain frame in the live broadcast needs to be used as the cover image or the live broadcast content needs to be authenticated to check the legitimacy of the content. Therefore, live video provides the real-time screenshot function to meet users’ screenshot requirements. You can use either of the following methods to configure the screenshot function: Create the screenshot function on the console. For details, see Configuring the Screenshot function on the console.
Usage scenarios
Users often need to analyze the content of live video. For example, the content of a certain frame in the live broadcast needs to be used as the cover image or the live broadcast content needs to be authenticated to check the legitimacy of the content. Therefore, live video provides the real-time screenshot function to meet users’ screenshot requirements.
Screenshot Function Description
Screenshot Function Configuration
You can configure the screenshot function of live video in either of the following ways:
Using the console: For details, see the Console Configuration Screenshot.
Through API/SDK: THE API/SDK provides interfaces for adding, deleting, querying, and updating the Screenshot configuration. For details, see Adding A Screenshot Configuration, deleting a Screenshot Configuration, querying a Screenshot Configuration, and updating a Screenshot Configuration. Sample code for adding a screenshot configuration using the Java SDK is provided below.
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou"."<AccessKeyId>"."<AccessKeySecret>");
IAcsClient client = new DefaultAcsClient(profile);
AddLiveAppSnapshotConfigRequest addLiveAppSnapshotConfigRequest = new AddLiveAppSnapshotConfigRequest();
addLiveAppSnapshotConfigRequest.setDomainName("<DomainName>");
addLiveAppSnapshotConfigRequest.setAppName("<AppName>");
addLiveAppSnapshotConfigRequest.setTimeInterval(5);
addLiveAppSnapshotConfigRequest.setOssEndpoint("<Endpoint>");
addLiveAppSnapshotConfigRequest.setOssBucket("<BucketName>");
addLiveAppSnapshotConfigRequest.setOverwriteOssObject("{AppName}/{StreamName}.jpg");
try {
AddLiveAppSnapshotConfigResponse addLiveAppSnapshotConfigResponse = client.getAcsResponse(addLiveAppSnapshotConfigRequest);
System.out.println(addLiveAppSnapshotConfigResponse.getRequestId());
// todo something.
} catch (ServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}Copy the code
Viewing a Screenshot File
After the screenshot configuration is complete, the new push flow can generate the screenshot. You can view the screenshot using the following methods:
1. The OSS console provides the screenshot management function. For details, see Screenshot Management. 2. The API/SDK provides the interface for querying screenshot information. For details, see Querying Screenshot Information. 3. When you know the address for recording the screenshot, you can directly view the generated result in the corresponding directory of the media Bucket, as shown in the following figure.
Q&A
Live screenshots are set for the granularity of the stream’s AppName. Users can set screenshots rules for all StreamNames under an AppName. In addition, the AppName supports the wildcard asterisk (*), which indicates that the screenshot rule takes effect for all push streams under the live broadcast domain name. When the screenshot rule takes effect, the AppName of the push stream must match the configured AppName.
Similar to the live recording function, the screenshot function also needs to save the screenshot result in the media Bucket. Therefore, the OSS service must be enabled for the screenshot function, and the input media Bucket must be set in the media Bucket. For details, see adding, deleting, and modifying media buckets.
When you configure the snapshot function, ObjectName can be defined as overwrite and non-overwrite. Overwrite means that each newly generated snapshot overwrites the previously generated snapshot file based on the snapshot frequency. Therefore, only one snapshot file is obtained. In this case, each newly generated snapshot does not overwrite the previously generated snapshot file. Each snapshot file is distinguished by {Sequence}. {Sequence} passes 1,2… N.
The Endpoint of OSS is the OSS access address excluding the Bucket name. For details, see OSS Endpoint Settings, and do not add http:// or https:// protocol headers. When using API/SDK to configure screenshots, either OverwriteOssObject or SequenceOssObject must be configured. The default value is not set for now.
0.1 yuan to start the live broadcast journey
In the annual procurement season, in order to enable more users to experience and enjoy the convenience of live video cloud service, the video product launched a 0.1 yuan experience package. The configuration list is as follows:
Click here for more details
To read more articles, please scan the following QR code: