Convert to MKV
Matroska Video. The API converts 30 formats to MKV. These are the options, by input format.
curl https://api.switchfile.io/v1/convert \
-H "Authorization: Bearer $SWITCHFILE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/input.3g2","to":"mkv","options":{"crf":23}}'const res = await fetch("https://api.switchfile.io/v1/convert", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SWITCHFILE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"url":"https://example.com/input.3g2","to":"mkv","options":{"crf":23}}),
});
console.log(await res.json());From 30 formats
video_codecenumdefault: not setVideo codec. "copy" keeps the video as it is and fails if it does not fit the format.
one of copy, x264, x265, vp9, av1
crfintegerdefault: not setConstant Rate Factor: lower values mean higher quality and larger files. 0 to 51 for H.264 and H.265, 0 to 63 for VP9 and AV1.
0 to 51
presetenumdefault: not setEncoding speed against file size. Slower presets make smaller files.
one of ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
tuneenumdefault: not setTune the encoder for the type of content (H.264 and H.265).
one of film, animation, grain, stillimage, fastdecode, zerolatency, psnr, ssim
profileenumdefault: not setCompatibility profile (H.264: baseline to high444, H.265: main or main10).
one of baseline, main, high, high10, high422, high444, main10
levelenumdefault: not setH.264 compatibility level.
one of 1, 1b, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2
widthintegerdefault: not setWidth of the video in pixels.
1 to 16384 px
heightintegerdefault: not setHeight of the video in pixels.
1 to 16384 px
fitenumdefault: max"max" fits the video inside width and height without enlarging it, "crop" fills and crops, "pad" adds bars, "scale" stretches to the exact size.
one of max, crop, pad, scale
fpsnumberdefault: not setFrame rate of the output.
0.1 to 240 fps
keyframe_intervalintegerdefault: not setLargest number of frames between two keyframes.
aspect_ratiostringdefault: not setDisplay aspect ratio, for example 16:9 or 4:3.
all_audio_streamsbooleandefault: trueKeep all audio tracks. Set to false to keep only the main audio track.
subtitles_modeenumdefault: copy"copy" keeps the subtitle tracks of the input, "none" leaves them out.
one of none, copy
audio_codecenumdefault: not setAudio codec. "copy" keeps the audio as it is, "none" removes it.
one of copy, none, aac, mp3, opus, vorbis, flac, pcm, alac
audio_bitrateintegerdefault: not setAudio bitrate in kbit/s. Without a value the encoder picks a quality-based rate.
audio_qscaleintegerdefault: not setQuality of variable bitrate MP3 from 0 (best) to 9. Ignored when audio_bitrate is set.
volumenumberdefault: not setChange the volume: 1.0 keeps it, 1.1 is 10% louder, 0.5 is half as loud. At most 10.
channelsintegerdefault: not setNumber of audio channels, for example 1 for mono or 2 for stereo.
sample_rateintegerdefault: not setSample rate in Hz, for example 44100 or 48000 (8000 to 192000).
trim_startstringdefault: not setStart of the part to keep, in seconds or HH:MM:SS.
trim_endstringdefault: not setEnd of the part to keep, in seconds or HH:MM:SS.