Segment Removal
Remove unwanted segments from videos with precise time-based cutting
Remove specific time segments from your videos with frame-accurate precision. Cut out mistakes, pauses, or any unwanted content while maintaining smooth playback.
Basic Usage
Remove segments by specifying start and end times in seconds:
curl -X POST https://api.videocascade.com/v1/videos \
-H "Authorization: Bearer vca_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"fileUrl": "https://example.com/video.mp4",
"removeSegments": [
{
"startTime": 10.5,
"endTime": 25.3
}
]
}'const response = await fetch('https://api.videocascade.com/v1/videos', {
method: 'POST',
headers: {
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
fileUrl: 'https://example.com/video.mp4',
removeSegments: [
{
startTime: 10.5, // Start at 10.5 seconds
endTime: 25.3 // End at 25.3 seconds
}
],
}),
});
const data = await response.json();
console.log(`Video ID: ${data.videoId}`);import requests
response = requests.post(
'https://api.videocascade.com/v1/videos',
headers={
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
json={
'fileUrl': 'https://example.com/video.mp4',
'removeSegments': [
{
'startTime': 10.5,
'endTime': 25.3
}
],
}
)
data = response.json()
print(f"Video ID: {data['videoId']}")interface RemoveSegment {
startTime: number; // Seconds
endTime: number; // Seconds
}
interface VideoRequest {
fileUrl: string;
removeSegments: RemoveSegment[];
}
const request: VideoRequest = {
fileUrl: 'https://example.com/video.mp4',
removeSegments: [
{
startTime: 10.5,
endTime: 25.3
}
],
};
const response = await fetch('https://api.videocascade.com/v1/videos', {
method: 'POST',
headers: {
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify(request),
});
const data = await response.json();
console.log(`Video ID: ${data.videoId}`);Time Format
Times are specified in seconds with decimal precision:
| Format | Example | Description |
|---|---|---|
| Integer | 10 | Exactly 10 seconds |
| Decimal | 10.5 | 10 seconds and 500 milliseconds |
| Precise | 10.333 | Frame-accurate timing |
{
startTime: 0, // Beginning of video
endTime: 5 // 5 seconds
}
{
startTime: 10.5, // 10.5 seconds (10s 500ms)
endTime: 25.75 // 25.75 seconds (25s 750ms)
}
{
startTime: 60, // 1 minute
endTime: 90 // 1 minute 30 seconds
}Precision: Use decimal values for frame-accurate cuts. For 30fps video, each frame is ~0.033 seconds.
Multiple Segments
Remove multiple segments from a single video:
const response = await fetch('https://api.videocascade.com/v1/videos', {
method: 'POST',
headers: {
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
fileUrl: 'https://example.com/long-video.mp4',
removeSegments: [
{ startTime: 0, endTime: 10 }, // Remove first 10 seconds
{ startTime: 45, endTime: 60 }, // Remove 45-60 seconds
{ startTime: 120, endTime: 135 }, // Remove 2:00-2:15
{ startTime: 290, endTime: 300 } // Remove last 10 seconds
],
}),
});response = requests.post(
'https://api.videocascade.com/v1/videos',
headers={
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
json={
'fileUrl': 'https://example.com/long-video.mp4',
'removeSegments': [
{'startTime': 0, 'endTime': 10}, # Remove first 10 seconds
{'startTime': 45, 'endTime': 60}, # Remove 45-60 seconds
{'startTime': 120, 'endTime': 135}, # Remove 2:00-2:15
{'startTime': 290, 'endTime': 300} # Remove last 10 seconds
],
}
)How Multiple Segments Work
When multiple segments are removed:
- Segments are sorted by start time
- Each segment is removed sequentially
- Remaining segments are stitched together seamlessly
Example:
Original Video (60 seconds):
├────────────────────────────────────────────────────┤
0s 60s
Remove Segments:
├──[REMOVE]──┤ ├──[REMOVE]──┤
0s 10s 45s 60s
Final Video (35 seconds):
├───────────────────────────┤
10s-45s duration = 35 secondsDuration Impact
Segment removal reduces the total video duration:
// Original video: 5 minutes (300 seconds)
// Remove 3 segments totaling 45 seconds
{
fileUrl: 'https://example.com/video-300s.mp4',
removeSegments: [
{ startTime: 10, endTime: 20 }, // 10 seconds removed
{ startTime: 60, endTime: 75 }, // 15 seconds removed
{ startTime: 150, endTime: 170 } // 20 seconds removed
]
}
// Final video: 4 minutes 15 seconds (255 seconds)
// = 300s - (10s + 15s + 20s) = 255sDuration Calculation: Final duration = Original duration - Sum of removed segment durations
Global vs Per-File Segment Removal
There are two ways to remove segments:
Global Segment Removal
Applied to the final video (or combined video):
{
fileUrl: 'https://example.com/video.mp4',
removeSegments: [
{ startTime: 10, endTime: 20 }
]
}Per-File Segment Removal (Combining)
Applied to individual files before combining:
{
combine: true,
files: [
{
url: 'https://example.com/video1.mp4',
removeSegments: [
{ startTime: 0, endTime: 5 } // Remove from video1 only
]
},
{
url: 'https://example.com/video2.mp4',
removeSegments: [
{ startTime: 55, endTime: 60 } // Remove from video2 only
]
}
]
}Combining Both Methods
You can use both global and per-file segment removal:
const response = await fetch('https://api.videocascade.com/v1/videos', {
method: 'POST',
headers: {
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
combine: true,
files: [
{
url: 'https://example.com/video1.mp4',
removeSegments: [
{ startTime: 0, endTime: 2 } // Remove intro from video1
]
},
{
url: 'https://example.com/video2.mp4',
removeSegments: [
{ startTime: 58, endTime: 60 } // Remove outro from video2
]
}
],
removeSegments: [
{ startTime: 30, endTime: 35 } // Remove from final combined video
]
}),
});response = requests.post(
'https://api.videocascade.com/v1/videos',
headers={
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
json={
'combine': True,
'files': [
{
'url': 'https://example.com/video1.mp4',
'removeSegments': [
{'startTime': 0, 'endTime': 2}
]
},
{
'url': 'https://example.com/video2.mp4',
'removeSegments': [
{'startTime': 58, 'endTime': 60}
]
}
],
'removeSegments': [
{'startTime': 30, 'endTime': 35}
]
}
)Processing Order:
- Remove segments from video1 (0-2s removed)
- Remove segments from video2 (58-60s removed)
- Combine video1 and video2
- Remove segments from combined output (30-35s removed)
Validation Rules
Valid Segments
// ✅ Valid: endTime > startTime
{ startTime: 10, endTime: 20 }
// ✅ Valid: decimal precision
{ startTime: 10.5, endTime: 20.75 }
// ✅ Valid: can start at 0
{ startTime: 0, endTime: 5 }Invalid Segments
// ❌ Invalid: endTime must be greater than startTime
{ startTime: 20, endTime: 10 }
// ❌ Invalid: startTime and endTime cannot be equal
{ startTime: 15, endTime: 15 }
// ❌ Invalid: times must be non-negative
{ startTime: -5, endTime: 10 }Validation Error: If endTime <= startTime, the API will return a 400 error with message: "endTime must be greater than startTime"
Out-of-Bounds Segments
If a segment extends beyond video duration:
// Video duration: 60 seconds
// Segment extends beyond video
{ startTime: 50, endTime: 70 }
// Result: Segment is capped at video duration
// Actual removal: 50-60 seconds (10 seconds)Use Cases
Remove Intro/Outro
// Remove 10 second intro and 5 second outro from 60 second video
{
fileUrl: 'https://example.com/video-60s.mp4',
removeSegments: [
{ startTime: 0, endTime: 10 }, // Remove intro
{ startTime: 55, endTime: 60 } // Remove outro
]
}
// Final video: 45 seconds (10-55s of original)Remove Mistakes/Bloopers
// Remove sections where speaker made mistakes
{
fileUrl: 'https://example.com/presentation.mp4',
removeSegments: [
{ startTime: 23.5, endTime: 28.0 }, // Remove verbal mistake
{ startTime: 67.2, endTime: 72.8 }, // Remove awkward pause
{ startTime: 145, endTime: 150 } // Remove coughing fit
]
}Trim to Specific Length
// Keep only middle 30 seconds of 60 second video
{
fileUrl: 'https://example.com/video-60s.mp4',
removeSegments: [
{ startTime: 0, endTime: 15 }, // Remove first 15s
{ startTime: 45, endTime: 60 } // Remove last 15s
]
}
// Final video: 30 seconds (15-45s of original)Create Highlight Reel
// Extract specific moments from long video
{
fileUrl: 'https://example.com/long-video-600s.mp4',
removeSegments: [
{ startTime: 0, endTime: 45 }, // Skip intro
{ startTime: 75, endTime: 120 }, // Skip boring part
{ startTime: 180, endTime: 300 }, // Skip middle section
{ startTime: 450, endTime: 600 } // Skip ending
]
}
// Keeps: 45-75s, 120-180s, 300-450s
// Final video: 30s + 60s + 150s = 240 seconds (4 minutes)Combining with Other Features
Remove segments along with other processing:
const response = await fetch('https://api.videocascade.com/v1/videos', {
method: 'POST',
headers: {
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
fileUrl: 'https://example.com/video.mp4',
// Remove segments
removeSegments: [
{ startTime: 0, endTime: 5 },
{ startTime: 55, endTime: 60 }
],
// Audio processing
removeSilence: true,
normalizeAudio: true,
// Aspect ratio
aspectRatio: '16:9',
resizeMode: 'cover',
// Quality
compressionQuality: 95,
outputFormat: 'mp4'
}),
});response = requests.post(
'https://api.videocascade.com/v1/videos',
headers={
'Authorization': 'Bearer vca_your_api_key',
'Content-Type': 'application/json',
},
json={
'fileUrl': 'https://example.com/video.mp4',
# Remove segments
'removeSegments': [
{'startTime': 0, 'endTime': 5},
{'startTime': 55, 'endTime': 60}
],
# Audio processing
'removeSilence': True,
'normalizeAudio': True,
# Aspect ratio
'aspectRatio': '16:9',
'resizeMode': 'cover',
# Quality
'compressionQuality': 95,
'outputFormat': 'mp4'
}
)interface CompleteRequest {
fileUrl: string;
removeSegments: Array<{ startTime: number; endTime: number }>;
removeSilence: boolean;
normalizeAudio: boolean;
aspectRatio: string;
resizeMode: string;
compressionQuality: number;
outputFormat: string;
}
const request: CompleteRequest = {
fileUrl: 'https://example.com/video.mp4',
removeSegments: [
{ startTime: 0, endTime: 5 },
{ startTime: 55, endTime: 60 }
],
removeSilence: true,
normalizeAudio: true,
aspectRatio: '16:9',
resizeMode: 'cover',
compressionQuality: 95,
outputFormat: 'mp4'
};