tencent cloud

All product documents
User Generated Short Video SDK
Last updated: 2025-04-01 17:14:09
Android
Last updated: 2025-04-01 17:14:09

Special Effect Filter

You can add multiple special effect filters for your videos. Currently, 11 filters are supported, all of which allow you to set the start and end time for display in the video. If multiple filters are set at the same point in time, the SDK will display the last set one.
Set the special effect filter:
/**
* Set the start time of the special effect filter
* @param type Special effect filter type
* @param startTime Start time of special effect filter in ms
*/
public void startEffect(int type, long startTime);
/**
* Set the end time of the special effect filter
* @param type Special effect filter type
* @param endTime End time of special effect filter in ms
*/
public void stopEffect(int type, long endTime);
Parameter description: @param type: special effect filter type, which is defined in the TXVideoEditConstants constant:
public static final int TXEffectType_SOUL_OUT = 0; // Soul out
public static final int TXEffectType_SPLIT_SCREEN = 1; // Screen split
public static final int TXEffectType_DARK_DRAEM = 2; // Dark dream
public static final int TXEffectType_ROCK_LIGHT = 3; // Dynamic light-wave
public static final int TXEffectType_WIN_SHADDOW = 4; // Window blinds
public static final int TXEffectType_GHOST_SHADDOW = 5; // Ghost shadow
public static final int TXEffectType_PHANTOM_SHADDOW = 6; // Phantom
public static final int TXEffectType_GHOST = 7; // Ghost
public static final int TXEffectType_LIGHTNING = 8; // Lightening
public static final int TXEffectType_MIRROR = 9; // Mirror
public static final int TXEffectType_ILLUSION = 10; // Illusion
Delete the last set special effect filter:
public void deleteLastEffect();
Delete all set special effect filters:
public void deleteAllEffect();
Below is a complete sample: Use the first special effect filter between the first and second seconds, use the second special effect filter between the third and fourth seconds, and delete the special effect filter set between the third and fourth seconds:
// Use the first special effect filter between the first and second seconds
mTXVideoEditer.startEffect(TXVideoEditConstants.TXEffectType_SOUL_OUT, 1000);
mTXVideoEditer.stopEffect(TXVideoEditConstants.TXEffectType_SOUL_OUT, 2000);
// Use the second special effect filter between the third and fourth seconds
mTXVideoEditer.startEffect(TXVideoEditConstants.TXEffectType_SPLIT_SCREEN, 3000);
mTXVideoEditer.stopEffect(TXVideoEditConstants.TXEffectType_SPLIT_SCREEN, 4000);
// Delete the special effect filter set between the third and fourth seconds
mTXVideoEditer.deleteLastEffect();

Slow/Fast Motions

You can change the playback speed of multiple video segments by setting slow/fast playback as follows:
public void setSpeedList(List speedList);

// The `TXSpeed` parameters are as follows:
public final static class TXSpeed {
public int speedLevel; // Speed change level
public long startTime; // Start time
public long endTime; // End time
}

// Currently, multiple speed change levels are supported, which are defined in the `TXVideoEditConstants` constant:
public static final int SPEED_LEVEL_SLOWEST = 0; // Ultra-slow 0.25x of the source video's speed
public static final int SPEED_LEVEL_SLOW = 1; // Slow 0.5x of the source video's speed
public static final int SPEED_LEVEL_NORMAL = 2; // Normal 1x of the source video's speed
public static final int SPEED_LEVEL_FAST = 3; // Fast 1.5x of the source video's speed
public static final int SPEED_LEVEL_FASTEST = 4; // Ultra-fast 2x of the source video's
Below is a complete sample:
List<TXVideoEditConstants.TXSpeed> list = new ArrayList<>();
TXVideoEditConstants.TXSpeed speed1 = new TXVideoEditConstants.TXSpeed();
speed1.startTime = 0;
speed1.endTime = 1000;
speed1.speedLevel = TXVideoEditConstants.SPEED_LEVEL_SLOW; // Slow
list.add(speed1);

TXVideoEditConstants.TXSpeed speed2 = new TXVideoEditConstants.TXSpeed();
speed2.startTime = 1000;
speed2.endTime = 2000;
speed2.speedLevel = TXVideoEditConstants.SPEED_LEVEL_SLOWEST; // Ultra-slow
list.add(speed2);

TXVideoEditConstants.TXSpeed speed3 = new TXVideoEditConstants.TXSpeed();
speed3.startTime = 2000;
speed3.endTime = 3000;
speed3.speedLevel = TXVideoEditConstants.SPEED_LEVEL_SLOW; // Slow
list.add(speed3);

mTXVideoEditer.setSpeedList(list);

Reverse Playback

You can reverse video playback. Specifically, you can call setReverse(true)/setReverse(false) to start/stop reverse playback.
Demo:
mTXVideoEditer.setReverse(true);

Video Segment Loop

You can loop a video segment, but the audio will not be looped. Currently, Android supports loop of only one video segment thrice. You can call setRepeatPlay(null) to cancel the video segment loop set previously.
Set the video segment for loop as follows:
public void setRepeatPlay(List repeatList);

// The `TXRepeat` parameters are as follows:
public final static class TXRepeat {
public long startTime; // Loop start time in ms
public long endTime; // Loop end time in ms
public int repeatTimes; // Number of repeats
}
Demo:
long currentPts = mVideoProgressController.getCurrentTimeMs();

List repeatList = new ArrayList<>();
TXVideoEditConstants.TXRepeat repeat = new TXVideoEditConstants.TXRepeat();
repeat.startTime = currentPts;
repeat.endTime = currentPts + DEAULT_DURATION_MS;
repeat.repeatTimes = 3; // Currently, a video segment can be repeated only for thrice.
repeatList.add(repeat); // Currently, only one video segment can be looped.
mTXVideoEditer.setRepeatPlay(repeatList);
Note:
To ensure smooth reverse playback, it is recommended to ​preprocess the video upon import by calling the processVideo method.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon