On this page
DocsGuides
Fade in and out
Fade the picture from and to black or white and the sound from and to silence.
fade fades the picture and the sound in at the start and out at the end of an output.
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-faded.mp4",
"trim": {
"start": 90,
"duration": 30
},
"fade": {
"in": 1,
"out": 1
}
}'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-faded.mp4",
"trim": {
"start": 90,
"duration": 30
},
"fade": {
"in": 1,
"out": 1
}
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
ffmpeg \
-ss 90 -t 30 -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,fade=t=in:st=0:d=1:c=black,fade=t=out:st=29:d=1:c=black" \
-c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p \
-map "0:a:0?" \
-af afade=t=in:st=0:d=1,afade=t=out:st=29:d=1 \
-c:a aac -b:a 128k -movflags +faststart \
talk-faded.mp4Copy failed. The text is selected; copy it with your keyboard.
talk-faded.mp4: a 30 second clip that fades in over its first second and out over its last.
fade.out needs the output's length, so set trim.duration or trim.end with it.
To white, picture only#
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-white.mp4",
"trim": {
"start": 0,
"duration": 20
},
"fade": {
"in": 2,
"out": 2,
"color": "white"
},
"audio": false
}'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-white.mp4",
"trim": {
"start": 0,
"duration": 20
},
"fade": {
"in": 2,
"out": 2,
"color": "white"
},
"audio": false
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
ffmpeg \
-t 20 -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,fade=t=in:st=0:d=2:c=white,fade=t=out:st=18:d=2:c=white" \
-c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p -an \
-movflags +faststart \
talk-white.mp4Copy failed. The text is selected; copy it with your keyboard.
Audio outputs fade their sound, and GIFs their picture.