On this page
DocsGuides
Speed
Speed up or slow down a video or its sound; the sound keeps its pitch.
speed changes how fast a video plays, picture and sound, from 0.25 to 4 times. An audio output
takes it too. The sound keeps its pitch.
The request#
curl "$VIDEXO_API_URL/v1/transcode" \
-H "Authorization: Bearer $VIDEXO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "https://example.com/talk.mp4",
"filename": "talk-2x.mp4",
"speed": 2
}'Copy failed. The text is selected; copy it with your keyboard.
const response = await fetch(`${process.env.VIDEXO_API_URL}/v1/transcode`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VIDEXO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": "https://example.com/talk.mp4",
"filename": "talk-2x.mp4",
"speed": 2
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
ffmpeg \
-i https://example.com/talk.mp4 \
-map 0:v:0 \
-vf "scale='min(trunc(iw/2)*2,min(7680,min(trunc(7680*iw/ih/2)*2,trunc(sqrt(33554432*iw/ih)/2)*2)))':-2,setpts=PTS/2" \
-c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p \
-map "0:a:0?" \
-af atempo=2 \
-c:a aac -b:a 128k -movflags +faststart \
talk-2x.mp4Copy failed. The text is selected; copy it with your keyboard.
talk-2x.mp4: picture and sound at twice the speed, the sound at its own pitch.
Sound mixed in with audio.mix stays at its own speed, and a stream copy ("codec": "copy") cannot
change speed. For a picture without sound, set "audio": false.
Slow motion#
curl "$VIDEXO_API_URL/v1/transcode" \
-H "Authorization: Bearer $VIDEXO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "https://example.com/talk.mp4",
"filename": "talk-slow.mp4",
"trim": {
"start": 42,
"duration": 5
},
"speed": 0.5
}'Copy failed. The text is selected; copy it with your keyboard.
const response = await fetch(`${process.env.VIDEXO_API_URL}/v1/transcode`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VIDEXO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": "https://example.com/talk.mp4",
"filename": "talk-slow.mp4",
"trim": {
"start": 42,
"duration": 5
},
"speed": 0.5
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
ffmpeg \
-ss 42 -t 5 -i https://example.com/talk.mp4 \
-map 0:v:0 \
-vf "scale='min(trunc(iw/2)*2,min(7680,min(trunc(7680*iw/ih/2)*2,trunc(sqrt(33554432*iw/ih)/2)*2)))':-2,setpts=PTS/0.5" \
-c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p \
-map "0:a:0?" \
-af atempo=0.5 \
-c:a aac -b:a 128k -movflags +faststart \
talk-slow.mp4Copy failed. The text is selected; copy it with your keyboard.
GIFs take speed too, for a time-lapse preview.