---
title: "VideoDelete"
language: "en"
type: "Symbol"
summary: "VideoDelete[video, t] deletes the first t seconds of video. VideoDelete[video, -t] deletes the last t seconds of video. VideoDelete[video, {t1, t2}] deletes from time t1 to time t2, returning the remaining video as a single Video object. VideoDelete[video, {{t11, t12}, ...}] deletes multiple time intervals."
keywords: 
- video trimmer
- video cutter
- cut video
- video editor
- crop video
- video delete
- cut by frame
- cut by keyframe
canonical_url: "https://reference.wolfram.com/language/ref/VideoDelete.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Video Editing"
    link: "https://reference.wolfram.com/language/guide/VideoEditing.en.md"
  - 
    title: "Video Computation: Update History"
    link: "https://reference.wolfram.com/language/guide/VideoComputation-UpdateHistory.en.md"
related_functions: 
  - 
    title: "VideoTrim"
    link: "https://reference.wolfram.com/language/ref/VideoTrim.en.md"
  - 
    title: "VideoJoin"
    link: "https://reference.wolfram.com/language/ref/VideoJoin.en.md"
  - 
    title: "VideoSplit"
    link: "https://reference.wolfram.com/language/ref/VideoSplit.en.md"
  - 
    title: "VideoIntervals"
    link: "https://reference.wolfram.com/language/ref/VideoIntervals.en.md"
  - 
    title: "VideoCombine"
    link: "https://reference.wolfram.com/language/ref/VideoCombine.en.md"
  - 
    title: "AudioDelete"
    link: "https://reference.wolfram.com/language/ref/AudioDelete.en.md"
  - 
    title: "Delete"
    link: "https://reference.wolfram.com/language/ref/Delete.en.md"
---
[EXPERIMENTAL]

# VideoDelete

VideoDelete[video, t] deletes the first t seconds of video.

VideoDelete[video, -t] deletes the last t seconds of video.

VideoDelete[video, {t1, t2}] deletes from time t1 to time t2, returning the remaining video as a single Video object.

VideoDelete[video, {{t11, t12}, …}] deletes multiple time intervals.

## Details and Options

* ``VideoDelete`` can be used to remove parts of a video.

[image]

* The time ``t`` can be any of the following:

|                        |                                              |
| ---------------------- | -------------------------------------------- |
| t                      | time given in seconds                        |
| Quantity[t, "unit"]    | time given in "unit" compatible with seconds |
| Quantity[t, "Samples"] | time given as number of samples              |

* The following options can be specified:

|                        |                          |                                                             |
| ---------------------- | ------------------------ | ----------------------------------------------------------- |
| AudioEncoding          | Automatic                | audio encoding to use                                       |
| CompressionLevel       | Automatic                | compression level to use                                    |
| GeneratedAssetFormat   | Automatic                | the file format of the result                               |
| GeneratedAssetLocation | \$GeneratedAssetLocation | location of the generated asset                             |
| OverwriteTarget        | Automatic                | whether to overwrite an existing file                       |
| SubtitleEncoding       | Automatic                | subtitle encoding to use                                    |
| VideoEncoding          | Automatic                | video encoding to use                                       |
| VideoTransparency      | False                    | whether the output video should have a transparency channel |

---

## Examples (13)

### Basic Examples (1)

Delete black frames of a video:

```wl
In[1]:= v = Video["ExampleData/Caminandes.mp4"];

In[2]:= Duration[v]

Out[2]= Quantity[MixedMagnitude[{1, 30.023}], MixedUnit[{"Minutes", "Seconds"}]]

In[3]:= int = VideoIntervals[v, Max[#Image] < .2&]

Out[3]= {{0., 2.41667}, {63.6667, 65.2917}, {76.0833, 76.3333}, {81.0833, 82.875}, {86.25, 88.0417}, {90., 90.0417}}

In[4]:= VideoDelete[v, int]

Out[4]= \!\(\*VideoBox["![Embedded Video Player](video://content-xj1ud)"]\)

In[5]:= Duration[%]

Out[5]= Quantity[MixedMagnitude[{1, 22.662}], MixedUnit[{"Minutes", "Seconds"}]]
```

### Scope (5)

Remove the first 10 seconds of a video:

```wl
In[1]:=
v = Video["ExampleData/bullfinch.mkv"];
Duration[v]

Out[1]= Quantity[15.022, "Seconds"]

In[2]:= VideoDelete[v, 10]

Out[2]= \!\(\*VideoBox["![Embedded Video Player](video://content-w3l2d)"]\)

In[3]:= Duration[%]

Out[3]= Quantity[5.061, "Seconds"]
```

---

Remove the last 10 seconds of a video:

```wl
In[1]:= VideoDelete[Video["ExampleData/bullfinch.mkv"], -10]

Out[1]= \!\(\*VideoBox["![Embedded Video Player](video://content-hjyry)"]\)

In[2]:= Duration[%]

Out[2]= Quantity[5.063, "Seconds"]
```

---

Remove from second 5 to second 10:

```wl
In[1]:= VideoDelete[Video["ExampleData/bullfinch.mkv"], {5, 10}]

Out[1]= [image]

In[2]:= Duration[%]

Out[2]= Quantity[10.03, "Seconds"]
```

---

Remove specific number of frames from the beginning of a video:

```wl
In[1]:= VideoDelete[Video["ExampleData/bullfinch.mkv"], Quantity[100, "Frames"]]

Out[1]= \!\(\*VideoBox["![Embedded Video Player](video://content-1zt24)"]\)

In[2]:= Duration[%]

Out[2]= Quantity[11.145, "Seconds"]
```

---

Remove multiple sections of a video:

```wl
In[1]:= VideoDelete[Video["ExampleData/bullfinch.mkv"], {{1, 5}, {6, -1}}]

Out[1]= \!\(\*VideoBox["![Embedded Video Player](video://content-ncp54)"]\)

In[2]:= Duration[%]

Out[2]= Quantity[3.093, "Seconds"]
```

### Options (2)

#### AudioEncoding (1)

Specify an audio encoding to use:

```wl
In[1]:=
v = Video["ExampleData/bullfinch.mkv"];
Information[v, "AudioTracks"][[All, "AudioEncoding"]]

Out[1]= Dataset[Association[1 -> "VORBIS", 2 -> "VORBIS", 3 -> "VORBIS"]]
```

Specify the audio encoding:

```wl
In[2]:= VideoDelete[v, 10, AudioEncoding -> "MP3"]

Out[2]= \!\(\*VideoBox["![Embedded Video Player](video://content-uwqyu)"]\)

In[3]:= Information[%, "AudioTracks"][[All, "AudioEncoding"]]

Out[3]= Dataset[Association[1 -> "MP3FLOAT", 2 -> "MP3FLOAT", 3 -> "MP3FLOAT"]]
```

#### CompressionLevel (1)

Specify a compression level to use:

```wl
In[1]:=
v = Video["ExampleData/bullfinch.mkv"];
FileSize[FindFile@Information[v, "ResourcePath"]]

Out[1]= Quantity[2.391515, "Megabytes"]

In[2]:=
out = VideoDelete[v, Duration[v] / 2, CompressionLevel -> 0.1];
FileSize[Information[out, "ResourcePath"]]

Out[2]= Quantity[5.116518, "Megabytes"]
```

### Applications (1)

Delete sections of a video containing only background noise:

```wl
In[1]:= vid = Video["ExampleData/bullfinch.mkv"];

In[2]:= bg = EstimatedBackground[AudioLoudness[Audio@vid]]

Out[2]=
TemporalData[TimeSeries, {CompressedData["«1628»"], {{0., 14.4, 0.1}}, 1, {"Continuous", 1}, 
  {"Discrete", 1}, 1, {MetaInformation -> None, MissingDataMethod -> None, 
   ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, ValueDimensions -> 1}}, False, 
 14.3]

In[3]:= intervals = AudioIntervals[Audio@vid, #LoudnessEBU - Mean[bg] < 6&]

Out[3]= {{0., 2.52036}, {3.4263, 4.12318}, {5.12203, 6.65516}, {7.56109, 7.8863}, {8.30443, 9.28005}, {10.186, 14.4387}}

In[4]:= VideoDelete[vid, intervals]

Out[4]= \!\(\*VideoBox["![Embedded Video Player](video://content-096kz)"]\)
```

### Properties & Relations (3)

If the requested time is beyond the duration of the video, only the available data is returned:

```wl
In[1]:=
v = Video["ExampleData/bullfinch.mkv"];
dur = Duration[v]

Out[1]= Quantity[15.022, "Seconds"]

In[2]:= VideoDelete[v, {5, 2dur}]//Duration

Out[2]= Quantity[5.04, "Seconds"]
```

---

Properties of the original video object are typically preserved:

```wl
In[1]:=
v = Video["ExampleData/bullfinch.mkv"];
Information[v, "VideoTracks"]

Out[1]=
Dataset[Association[1 -> Association["OriginalRasterSize" -> {640, 360}, 
    "VideoEncoding" -> "LIBVPX-VP9", "BitDepth" -> 8, "ColorSpace" -> "RGB", 
    "FrameRate" -> Quantity[30, "Frames"/"Seconds"]]]]

In[2]:= Information[VideoDelete[v, 10], "VideoTracks"]

Out[2]=
Dataset[Association[1 -> Association["OriginalRasterSize" -> {640, 360}, "VideoEncoding" -> "H264", 
    "BitDepth" -> 8, "ColorSpace" -> "RGB", "FrameRate" -> Quantity[30, "Frames"/"Seconds"]]]]
```

---

Remove a section of a video using ``VideoDelete`` :

```wl
In[1]:=
v = Video["ExampleData/bullfinch.mkv"];
dur = Duration[v]

Out[1]= Quantity[15.022, "Seconds"]

In[2]:=
delete = VideoDelete[v, Quantity[10, "Seconds"]];
Duration[delete]

Out[2]= Quantity[5.061, "Seconds"]
```

Remove a complementary section of a video using ``VideoTrim`` :

```wl
In[3]:=
trim = VideoTrim[v, dur - Quantity[10, "Seconds"]];
Duration[trim]

Out[3]= Quantity[5.022, "Seconds"]
```

### Possible Issues (1)

All video data cannot be removed:

```wl
In[1]:=
v = Video["ExampleData/bullfinch.mkv"];
VideoDelete[v, Duration[v]]//Head
```

VideoDelete::tmspecev: Time specification 15.022s corresponds to an empty video track. At least one video track must be nonempty.

```wl
Out[1]= VideoDelete
```

## See Also

* [`VideoTrim`](https://reference.wolfram.com/language/ref/VideoTrim.en.md)
* [`VideoJoin`](https://reference.wolfram.com/language/ref/VideoJoin.en.md)
* [`VideoSplit`](https://reference.wolfram.com/language/ref/VideoSplit.en.md)
* [`VideoIntervals`](https://reference.wolfram.com/language/ref/VideoIntervals.en.md)
* [`VideoCombine`](https://reference.wolfram.com/language/ref/VideoCombine.en.md)
* [`AudioDelete`](https://reference.wolfram.com/language/ref/AudioDelete.en.md)
* [`Delete`](https://reference.wolfram.com/language/ref/Delete.en.md)

## Related Guides

* [Video Editing](https://reference.wolfram.com/language/guide/VideoEditing.en.md)
* [Video Computation: Update History](https://reference.wolfram.com/language/guide/VideoComputation-UpdateHistory.en.md)

## History

* [Introduced in 2020 (12.2)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn122.en.md) \| [Updated in 2021 (12.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn123.en.md)