Convert to MP2
MPEG Layer II Audio. The API converts 58 formats to MP2. 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":"mp2","options":{"audio_bitrate":192}}'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":"mp2","options":{"audio_bitrate":192}}),
});
console.log(await res.json());From 58 formats
audio_codecenumdefault: not setAudio codec. "copy" keeps the audio as it is.
one of copy, mp2
audio_bitrateintegerdefault: not setAudio bitrate in kbit/s. Without a value the encoder picks a quality-based rate.
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.