tencent cloud

User Generated Short Video SDK

動態と公告
Release Notes
The “startPlay” API of the UGSV SDK Renamed
製品紹介
Overview
Features
Use Cases
Concepts
購入ガイド
Pricing Overview
Refund Policy
License ガイド
Adding and Renewing a License
Configuring and Viewing a License
SDKのダウンロード
SDK Download
Release Notes (App)
UI 統合ソリューションを含む
UGSV Demo App
Source Code Description (iOS)
Source Code Description (Android)
UI 統合ソリューションを含まない
SDK Integration
Capturing and Shoot
Preview, Clipping, and Splicing
Upload and Playback
Tencent Effect SDK
Advanced Features and Special Effects
API ドキュメント
Editing
Shooting
テクニカルサポート
Error Codes
Feature FAQs
よくある質問
Upload
Android Compilation
Android
iOS
License
UGSV ポリシー
プライバシーポリシー
データ処理とセキュリティ契約

Android

PDF
フォーカスモード
フォントサイズ
最終更新日: 2025-04-01 17:14:09
The TXVideoJoiner can merge multiple videos either by sequentially concatenating them or by combining their frames in a split-screen layout.

1. Basic Video Concatenation

To simply concatenate multiple video files sequentially, refer to the following code:
mTXVideoJoiner = new TXVideoJoiner(mContext);

// Set the video source list. A return value < 0 indicates invalid or unsupported formats in the input files.
if (mTXVideoJoiner.setVideoPathList(videoSourceList) < 0) {
return;
}

// Set a listener to track concatenation progress and completion.
mTXVideoJoiner.setVideoJoinerListener(new TXVideoJoinerListener() {
@Override
public void onJoinProgress(float progress) {}

@Override
public void onJoinComplete(TXJoinerResult result) {}
});

// Start concatenation. Specify the output resolution and path.
// Note: If all input videos share the same format and resolution, concatenation is fast.
// Otherwise, re-encoding is required, which slows the process.
mTXVideoJoiner.joinVideo(TXVideoEditConstants.VIDEO_COMPRESSED_540P, mOutputPath);

2. Preview Before Concatenation

To preview the concatenated videos before merging, use the following code:
mTXVideoJoiner = new TXVideoJoiner(mContext);

// Set the video source list.
if (mTXVideoJoiner.setVideoPathList(videoSourceList) < 0) {
return;
}

// Set a listener for preview progress and completion.
mTXVideoJoiner.setTXVideoPreviewListener(new TXVideoPreviewListener() {
@Override
public void onPreviewProgress(int time) {}

@Override
public void onPreviewFinished() {}
});

// Prepare the preview view.
TXVideoEditConstants.TXPreviewParam param = new TXVideoEditConstants.TXPreviewParam();
param.videoView = mVideoView;
param.renderMode = TXVideoEditConstants.PREVIEW_RENDER_MODE_FILL_EDGE;
mTXVideoJoiner.initWithPreview(param);

// Start preview.
mTXVideoJoiner.startPlay();
Control playback with:
startPlay: Start preview
pausePlay: Pause preview
resumePlay: Resume preview

3. Split-Screen Video Merging

TXVideoJoiner also supports merging multiple videos into a split-screen layout. Example code:
mTXVideoJoiner = new TXVideoJoiner(mContext);

// Set the video source list.
if (mTXVideoJoiner.setVideoPathList(videoSourceList) < 0) {
return;
}

// Set a listener for split-screen merging progress and completion.
mTXVideoJoiner.setVideoJoinerListener(new TXVideoJoinerListener() {
@Override
public void onJoinProgress(float progress) {}

@Override
public void onJoinComplete(TXJoinerResult result) {}
});

// Configure split-screen layout parameters.
SplitScreenParam splitScreenParam = new SplitScreenParam();
splitScreenParam.canvasWidth = 720; // Canvas width during split-screen joining
splitScreenParam.canvasHeight = 1280; // Canvas height
splitScreenParam.durationControlMode = DurationControlMode.ALIGNS_TO_LONGEST; // Duration matches the longest video

// Define positions and sizes for each video on the canvas.
TXAbsoluteRect rect1 = new TXAbsoluteRect();
TXAbsoluteRect rect2 = new TXAbsoluteRect();
splitScreenParam.rects.add(rect1);
splitScreenParam.rects.add(rect2);
mTXVideoJoiner.setSplitScreenList(splitScreenParam);

// Set audio mixing weights for each video (e.g., video1: 100% volume, video2: 0%).
List<Float> volumes = new LinkedList<>();
volumes.add(1.0f);
volumes.add(0.0f);
mTXVideoJoiner.setVideoVolumes(volumes);

// Start split-screen merging.
// If input videos differ in format or resolution, re-encoding is required, which may slow the process.
mTXVideoJoiner.splitJoinVideo(TXVideoEditConstants.VIDEO_COMPRESSED_540P, mOutputPath);
When configuring split-screen layout parameters via setSplitScreenList and audio mixing ratios via setVideoVolumes, these settings apply to ​both the final video output (generated by splitJoinVideo) ​andthe live preview during editing.



ヘルプとサポート

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

フィードバック