tencent cloud

User Generated Short Video SDK

iOS

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

Feature Overview

Through the frame extraction interface, you can retrieve original video frames and rendered frames during editing, typically used for implementing cover images and timeline preview strips.

Related Interface Classes

Interface Class Name
Description
TAVEditor
SDK operation entry class.
ITAVFrameProvider
Frame provider interface.

Core Methods

Get Main Track Thumbnails by Index (Asynchronous)

/// Get thumbnails by main track index - Asynchronous
/// - Parameters:
/// - clipIndex: Asset file index
/// - count: Number of thumbnails
/// - size: Thumbnail width and height
/// - thumbCompletion: Callback returning the corresponding thumbnail array
/// - return: Generator object, can be passed to cancelGenerate: to cancel generation
- (id)getClipThumbnail:(int)clipIndex count:(int)count size:(CGSize)size completion:(void (^)(NSArray *images))thumbCompletion;

/// Get thumbnail at the specified pts by main track index - Asynchronous
/// - Parameters:
/// - clipIndex: Asset file index
/// - pts: Timestamp
/// - size: Thumbnail width and height
/// - thumbCompletion: Callback returning the corresponding thumbnail
/// - return: Generator object, can be passed to cancelGenerate: to cancel generation
- (id)getClipThumbnail:(int)clipIndex pts:(CMTime)pts size:(CGSize)size completion:(void (^)(UIImage *image))thumbCompletion;

/// Get thumbnail at the specified pts by main track index - Synchronous
/// - Parameters:
/// - clipIndex: Asset file index
/// - pts: Timestamp
/// - size: Thumbnail width and height
/// @return Current frame thumbnail
- (UIImage *)getClipThumbnail:(int)clipIndex pts:(CMTime)pts size:(CGSize)size;

Get Main Track Rendered Frames

/// Get rendered frame at the specified pts on the main track - Asynchronous
/// @param pts Timestamp
/// @param length Length of the longest side. The SDK internally calculates the short side based on the long side
/// @param completion Callback
/// - return: Generator object, can be passed to cancelGenerate: to cancel generation
- (id)getClipFrameAtTime:(CMTime)pts longSide:(CGFloat)length completion:(void (^)(UIImage *image))completion;
- (id)getClipFrameWithTimes:(NSArray <NSValue *>*)times longSide:(CGFloat)length completion:(void (^)(NSDictionary <NSValue *, UIImage *> *images))completion;

/// Get rendered frame at the specified pts on the main track - Synchronous
/// @param pts Timestamp
/// @param length Length of the longest side. The SDK internally calculates the short side based on the long side
- (UIImage *)getClipFrameAtTime:(CMTime)pts longSide:(CGFloat)length;
- (NSDictionary <NSValue *, UIImage *> *)getClipFrameWithTimes:(NSArray <NSValue *>*)times longSide:(CGFloat)length;

Get Thumbnail by Asset Path

/// Get thumbnail
/// - Parameters:
/// - videoPath: Video asset path
/// - count: Number of thumbnails
/// - size: Thumbnail width and height
/// - timeRange: Time range for frame extraction from the video. Defaults to the entire video duration
/// - thumbCompletion: Callback returning the corresponding thumbnail array
/// - return: Generator object, can be passed to cancelGenerate: to cancel generation
- (id)getThumbnail:(NSString *)videoPath
count:(int)count
size:(CGSize)size
timeRange:(CMTimeRange)timeRange
completion:(void (^)(NSArray<UIImage *> *images, NSError *error))thumbCompletion;

/// Get thumbnail at the specified pts - Asynchronous
/// - Parameters:
/// - videoPath: Video asset path
/// - pts: Timestamp
/// - size: Thumbnail width and height
/// - thumbCompletion: Callback returning the corresponding thumbnail array
/// - return: Generator object, can be passed to cancelGenerate: to cancel generation
- (id)getThumbnail:(NSString *)videoPath
pts:(CMTime)pts
size:(CGSize)size
completion:(void (^)(UIImage *image, NSError *error))thumbCompletion;

/// Get thumbnail at the specified pts - Synchronous
/// - Parameters:
/// - videoPath: Video asset path
/// - pts: Timestamp
/// - size: Thumbnail width and height
- (UIImage *)getThumbnail:(NSString *)videoPath
pts:(CMTime)pts
size:(CGSize)size;

Cancel Async Thumbnail Generation

/// Cancel thumbnail generation
/// - Parameter generator: Generator object
- (void)cancelGenerate:(id)generator;


ヘルプとサポート

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

フィードバック