# Clip Videos
[View original](https://ittybit.com/guides/clip-videos)
## Clip the first 60 seconds
If you only provide a `duration` prop, the video will start at the beginning and end at the specified time.
```js
const task = await ittybit.tasks.create({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
duration: 60,
});
```
```python
task = ittybit.tasks.create(
kind='video',
url='https://ittyb.it/sample.mp4',
duration=60
)
```
```ruby
task = ittybit.tasks.create(
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
duration: 60
)
```
```php
$task = $ittybit->tasks->create([
'kind' => 'video',
'url' => 'https://ittyb.it/sample.mp4',
'duration' => 60,
]);
```
```go
task, err := ittybit.Tasks.Create(
context.Background(),
&ittybit.TaskCreateParams{
Kind: "video",
URL: "https://ittyb.it/sample.mp4",
Duration: 60,
},
)
```
```js
const task = await fetch('https://api.ittybit.com/tasks', {
method: 'POST',
headers: { 'Authorization': `Bearer ${ITTYBIT_API_KEY}` },
body: JSON.stringify({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
duration: 60,
})
})
```
*(See [SDKs](/sdks) for install and initialization steps.)*
***
## Clip a specific section
You can combine `duration` with the `start` prop to clip a specific section of the video. This can be useful if every video has an identical intro that you want to skip before starting your preview clip.
```js
const task = await ittybit.tasks.create({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: 12.34,
duration: 60,
});
```
```python
task = ittybit.tasks.create(
kind='video',
url='https://ittyb.it/sample.mp4',
start=12.34,
duration=60
)
```
```ruby
task = ittybit.tasks.create(
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: 12.34,
duration: 60
)
```
```php
$task = $ittybit->tasks->create([
'kind' => 'video',
'url' => 'https://ittyb.it/sample.mp4',
'start' => 12.34,
'duration' => 60,
]);
```
```go
task, err := ittybit.Tasks.Create(
context.Background(),
&ittybit.TaskCreateParams{
Kind: "video",
URL: "https://ittyb.it/sample.mp4",
Start: 12.34,
Duration: 60,
},
)
```
```js
const task = await fetch('https://api.ittybit.com/tasks', {
method: 'POST',
headers: { 'Authorization': `Bearer ${ITTYBIT_API_KEY}` },
body: JSON.stringify({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: 12.34,
duration: 60,
})
})
```
***
## Clip the last 60 seconds
If you provide only a `start` prop, then the video will start at the specified time and end at the end of the video.
So if you wanted to output the last 60 seconds of each video, then you could use the input file's `duration` prop to calculate the required `start` value.
```js
const startTime = input.duration - 60;
const task = await ittybit.tasks.create({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: startTime,
});
```
```python
startTime = input.duration - 60
task = ittybit.tasks.create(
kind='video',
url='https://ittyb.it/sample.mp4',
start=startTime,
)
```
```ruby
startTime = input.duration - 60
task = ittybit.tasks.create(
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: startTime,
)
```
```php
$startTime = $input->duration - 60;
$task = $ittybit->tasks->create([
'kind' => 'video',
'url' => 'https://ittyb.it/sample.mp4',
'start' => $startTime,
]);
```
```go
startTime := input.duration - 60
task, err := ittybit.Tasks.Create(
context.Background(),
&ittybit.TaskCreateParams{
Kind: "video",
URL: "https://ittyb.it/sample.mp4",
Start: startTime,
},
)
```
```js
const startTime = input.duration - 60;
const task = await fetch('https://api.ittybit.com/tasks', {
method: 'POST',
headers: { 'Authorization': `Bearer ${ITTYBIT_API_KEY}` },
body: JSON.stringify({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: startTime,
})
})
```
***
## Set specific start and end times
If you provide both a `start` and `end` prop, the video will start at the specified time and end at the specified time.
You might combine this with the output from [Intelligence](/docs/intelligence) features like [Speech](/docs/speech) or [Outline](/docs/outline) to create a clips based on natural breaks in the content.
```js
const task = await ittybit.tasks.create({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: 12.34,
end: 56.78,
});
```
```python
task = ittybit.tasks.create(
kind='video',
url='https://ittyb.it/sample.mp4',
start=12.34,
end=56.78,
)
```
```ruby
task = ittybit.tasks.create(
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: 12.34,
end: 56.78,
)
```
```php
$task = $ittybit->tasks->create([
'kind' => 'video',
'url' => 'https://ittyb.it/sample.mp4',
'start' => 12.34,
'end' => 56.78,
]);
```
```go
task, err := ittybit.Tasks.Create(
context.Background(),
&ittybit.TaskCreateParams{
Kind: "video",
URL: "https://ittyb.it/sample.mp4",
Start: 12.34,
End: 56.78,
},
)
```
```js
const task = await fetch('https://api.ittybit.com/tasks', {
method: 'POST',
headers: { 'Authorization': `Bearer ${ITTYBIT_API_KEY}` },
body: JSON.stringify({
kind: 'video',
url: 'https://ittyb.it/sample.mp4',
start: 12.34,
end: 56.78,
})
})
```
In the example above, it'd be a good idea to use the `filename`, `folder`, and `ref` props to make the clips easily accessible.
```js
const chapters = [
{
index: 0,
start: 12.34,
end: 56.78,
text: 'Mr Miyamoto introduces his newest game',
},
// ... other chapters
]
const tasks = chapters.map(chapter => ittybit.tasks.create({
kind: 'video',
file_id: input.id,
start: chapter.start,
end: chapter.end,
filename: `clip-${chapter.index}.mp4`,
folder: input.folder,
ref: chapter.ref,
metadata: {
index: chapter.index,
description: chapter.text,
},
}));
```