tencent cloud

User Generated Short Video SDK

Android

Download
フォーカスモード
フォントサイズ
最終更新日: 2026-05-11 17:46:58

Feature Overview

Use the frame extraction APIs to obtain original video frames and rendered frames during editing, typically for implementing covers and timeline preview strips.

Related API Classes

API Class
Description
TAVEditor
SDK operation entry class.
ITAVFrameProvider
Frame provider interface.
TAVGetFrameListener
Frame retrieval callback interface.
TAVSnapshotCallback
Render snapshot callback interface.
ITAVThumbProvider
Original video frame extraction interface.

Related Methods

Get Render Result at Specified Time

API Description:
/**
* Gets the render result at a specific time point
*
* @param positionUs time point (microseconds)
* @param longSideLength length of the longer side; the SDK calculates the shorter side based on it
* @param scene render scene:
* - TAVEditorConstants.SCENE_PLAY: playback scene
* - TAVEditorConstants.SCENE_GENERATE: export scene
* @param listener result callback interface
*/
void getFrameAtTime(
long positionUs,
int longSideLength,
@TAVEditorConstants.RenderScene int scene,
TAVGetFrameListener listener
);
Usage Example:
editor.getFrameAtTime(5_000_000, 1080, TAVEditorConstants.SCENE_PLAY, new TAVGetFrameListener() {
@Override
public void onFrameAvailable(Bitmap bitmap) {
// Process the retrieved frame image
}

@Override
public void onError(int errorCode) {
// Error handling
}
});

Get Render Result Provider

API Description:
/**
* Gets the render result provider
*
* @param longSideLength scaled according to the render ratio with the longer side aligned
* @param scene render scene
* - TAVEditorConstants.SCENE_PLAY: playback scene
* - TAVEditorConstants.SCENE_GENERATE: export scene
* @return ITAVFrameProvider frame provider instance
*/
ITAVFrameProvider getFrameProvider(int longSideLength, @TAVEditorConstants.RenderScene int scene);
Usage Example:
ITAVFrameProvider provider = editor.getFrameProvider(720, TAVEditorConstants.SCENE_GENERATE);

// Get the frame at the specified time point
provider.getFrameAtTime(3_000_000, new TAVGetFrameListener() {
@Override
public void onFrameAvailable(Bitmap bitmap) {
// Process the frame image
}
});

Read Render Snapshot at Current Time

API Description:
/**
* Reads the render snapshot at the current time point
*
* @param callback callback invoked when the snapshot is obtained successfully
*/
void readSnapshot(TAVSnapshotCallback callback);
Usage Example:
editor.readSnapshot(new TAVSnapshotCallback() {
@Override
public void onSnapshotReady(Bitmap snapshot) {
// Process the snapshot image
}
});

Get Original Video Frame Extraction Interface

API Description:
/**
* Gets the original video frame extraction interface
*
* @param forceUseSoftwareDecoding whether to force software decoding:
* - true: force software decoding
* - false: prefer hardware decoding
* @return ITAVThumbProvider thumbnail provider instance
*/
ITAVThumbProvider getThumbnailProvider(boolean forceUseSoftwareDecoding);
Usage Example:
ITAVThumbProvider provider = editor.getThumbnailProvider(false);

// Get the thumbnail of the specified asset at a specific time
provider.getThumbnailAtTime(
0, // clipIndex
2_000_000, // Time point (microseconds)
320, // Width
240, // Height
new TAVThumbnailListener() {
@Override
public void onThumbnail(Bitmap bitmap) {
// Process the thumbnail
}
}
);


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック