typefile
{
"boomerang": true,
"center_crop": false,
"end_seconds": 3,
"fps": 15,
"max_height": 1200,
"max_width": 1500,
"start_seconds": 0,
"video_path": "https://replicate.delivery/pbxt/NYHiAbQBlk3O1mjxllQsZdryStreg7f9PIRAGrY0uXCeT5n1/AI%20Video%20Upscale%20%286%29.mp4"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_ZpA**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run pipeline-examples/video-to-gif using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
boomerang: true,
center_crop: false,
end_seconds: 3,
fps: 15,
max_height: 1200,
max_width: 1500,
start_seconds: 0,
video_path: "https://replicate.delivery/pbxt/NYHiAbQBlk3O1mjxllQsZdryStreg7f9PIRAGrY0uXCeT5n1/AI%20Video%20Upscale%20%286%29.mp4"
};
const output = await replicate.run("pipeline-examples/video-to-gif", { input });
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_ZpA**********************************
This is your API token. Keep it to yourself.
import replicate
Run pipeline-examples/video-to-gif using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"pipeline-examples/video-to-gif",
input={
"boomerang": True,
"center_crop": False,
"end_seconds": 3,
"fps": 15,
"max_height": 1200,
"max_width": 1500,
"start_seconds": 0,
"video_path": "https://replicate.delivery/pbxt/NYHiAbQBlk3O1mjxllQsZdryStreg7f9PIRAGrY0uXCeT5n1/AI%20Video%20Upscale%20%286%29.mp4"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_ZpA**********************************
This is your API token. Keep it to yourself.
Run pipeline-examples/video-to-gif using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"input": {
"boomerang": true,
"center_crop": false,
"end_seconds": 3,
"fps": 15,
"max_height": 1200,
"max_width": 1500,
"start_seconds": 0,
"video_path": "https://replicate.delivery/pbxt/NYHiAbQBlk3O1mjxllQsZdryStreg7f9PIRAGrY0uXCeT5n1/AI%20Video%20Upscale%20%286%29.mp4"
}
}' \
https://api.replicate.com/v1/models/pipeline-examples/video-to-gif/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "3w5pw2r00drme0crq3h8k3hxhg",
"model": "pipeline-examples/video-to-gif",
"version": "hidden",
"input": {
"boomerang": true,
"center_crop": false,
"end_seconds": 3,
"fps": 15,
"max_height": 1200,
"max_width": 1500,
"start_seconds": 0,
"video_path": "https://replicate.delivery/pbxt/NYHiAbQBlk3O1mjxllQsZdryStreg7f9PIRAGrY0uXCeT5n1/AI%20Video%20Upscale%20%286%29.mp4"
},
"logs": "ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers\n built with gcc 13.2.1 (Alpine 13.2.1_git20240309) 20240309\n configuration: --pkg-config-flags=--static --extra-cflags=-fopenmp --extra-ldflags='-fopenmp -Wl,--allow-multiple-definition -Wl,-z,stack-size=2097152' --toolchain=hardened --disable-debug --disable-shared --disable-ffplay --enable-static --enable-gpl --enable-version3 --enable-fontconfig --enable-gray --enable-iconv --enable-lcms2 --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libdav1d --enable-libdavs2 --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libjxl --enable-libkvazaar --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librabbitmq --enable-librav1e --enable-librsvg --enable-librtmp --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxevd --enable-libxeve --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-openssl\n libavutil 59. 39.100 / 59. 39.100\n libavcodec 61. 19.101 / 61. 19.101\n libavformat 61. 7.100 / 61. 7.100\n libavdevice 61. 3.100 / 61. 3.100\n libavfilter 10. 4.100 / 10. 4.100\n libswscale 8. 3.100 / 8. 3.100\n libswresample 5. 3.100 / 5. 3.100\n libpostproc 58. 3.100 / 58. 3.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/cog-input-150228901.mp4':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2mp41\n encoder : Lavf62.0.102\n Duration: 00:00:05.00, start: 0.000000, bitrate: 3006 kb/s\n Stream #0:0[0x1](und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 1872x1080 [SAR 1:1 DAR 26:15], 3002 kb/s, 30.40 fps, 30 tbr, 15360 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n encoder : Lavc62.3.101 hevc_nvenc\nStream mapping:\n Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))\nPress [q] to stop, [?] for help\n[libx264 @ 0x75a664cf3400] using SAR=1/1\n[libx264 @ 0x75a664cf3400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512\n[libx264 @ 0x75a664cf3400] profile High, level 4.0, 4:2:0, 8-bit\n[libx264 @ 0x75a664cf3400] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00\nOutput #0, mp4, to '/tmp/preprocessed.mp4':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2mp41\n encoder : Lavf61.7.100\n Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 1872x1080 [SAR 1:1 DAR 26:15], q=2-31, 30 fps, 15360 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n encoder : Lavc61.19.101 libx264\n Side data:\n cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A\nframe= 0 fps=0.0 q=0.0 size= 0KiB time=N/A bitrate=N/A dup=0 drop=2 speed=N/A \rframe= 4 fps=4.0 q=29.0 size= 0KiB time=00:00:00.06 bitrate= 5.8kbits/s dup=0 drop=2 speed=0.0667x \rframe= 11 fps=7.3 q=29.0 size= 0KiB time=00:00:00.30 bitrate= 1.3kbits/s dup=0 drop=2 speed= 0.2x \rframe= 17 fps=8.5 q=29.0 size= 0KiB time=00:00:00.50 bitrate= 0.8kbits/s dup=0 drop=3 speed=0.25x \rframe= 26 fps= 10 q=29.0 size= 256KiB time=00:00:00.80 bitrate=2621.9kbits/s dup=0 drop=3 speed=0.32x \rframe= 33 fps= 11 q=29.0 size= 256KiB time=00:00:01.03 bitrate=2029.9kbits/s dup=0 drop=3 speed=0.344x \rframe= 41 fps= 12 q=29.0 size= 256KiB time=00:00:01.30 bitrate=1613.5kbits/s dup=0 drop=3 speed=0.371x \rframe= 49 fps= 12 q=29.0 size= 512KiB time=00:00:01.56 bitrate=2677.5kbits/s dup=0 drop=3 speed=0.391x \rframe= 60 fps= 13 q=29.0 size= 512KiB time=00:00:01.93 bitrate=2169.7kbits/s dup=0 drop=3 speed=0.429x \rframe= 69 fps= 14 q=29.0 size= 512KiB time=00:00:02.23 bitrate=1878.2kbits/s dup=0 drop=3 speed=0.446x \rframe= 81 fps= 15 q=29.0 size= 768KiB time=00:00:02.63 bitrate=2389.3kbits/s dup=0 drop=3 speed=0.479x \r[out#0/mp4 @ 0x75a664cf2700] video:841KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.227374%\nframe= 90 fps= 15 q=29.0 Lsize= 842KiB time=00:00:02.93 bitrate=2352.7kbits/s dup=0 drop=3 speed= 0.5x \n[libx264 @ 0x75a664cf3400] frame I:1 Avg QP:22.25 size:106032\n[libx264 @ 0x75a664cf3400] frame P:23 Avg QP:22.40 size: 25216\n[libx264 @ 0x75a664cf3400] frame B:66 Avg QP:25.55 size: 2636\n[libx264 @ 0x75a664cf3400] consecutive B-frames: 2.2% 0.0% 0.0% 97.8%\n[libx264 @ 0x75a664cf3400] mb I I16..4: 14.3% 74.2% 11.5%\n[libx264 @ 0x75a664cf3400] mb P I16..4: 1.8% 3.4% 0.2% P16..4: 52.3% 12.8% 4.6% 0.0% 0.0% skip:24.8%\n[libx264 @ 0x75a664cf3400] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 29.4% 0.3% 0.0% direct: 0.2% skip:70.0% L0:40.5% L1:57.9% BI: 1.6%\n[libx264 @ 0x75a664cf3400] 8x8 transform intra:67.6% inter:85.8%\n[libx264 @ 0x75a664cf3400] coded y,uvDC,uvAC intra: 59.4% 71.5% 29.7% inter: 6.7% 9.6% 0.2%\n[libx264 @ 0x75a664cf3400] i16 v,h,dc,p: 11% 18% 5% 67%\n[libx264 @ 0x75a664cf3400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 18% 12% 6% 11% 10% 11% 7% 10%\n[libx264 @ 0x75a664cf3400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 18% 5% 6% 16% 12% 13% 6% 7%\n[libx264 @ 0x75a664cf3400] i8c dc,h,v,p: 49% 26% 15% 10%\n[libx264 @ 0x75a664cf3400] Weighted P-Frames: Y:21.7% UV:0.0%\n[libx264 @ 0x75a664cf3400] ref P L0: 52.8% 24.7% 17.9% 4.1% 0.5%\n[libx264 @ 0x75a664cf3400] ref B L0: 95.2% 4.3% 0.5%\n[libx264 @ 0x75a664cf3400] ref B L1: 96.8% 3.2%\n[libx264 @ 0x75a664cf3400] kb/s:2293.36\nffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers\n built with gcc 13.2.1 (Alpine 13.2.1_git20240309) 20240309\n configuration: --pkg-config-flags=--static --extra-cflags=-fopenmp --extra-ldflags='-fopenmp -Wl,--allow-multiple-definition -Wl,-z,stack-size=2097152' --toolchain=hardened --disable-debug --disable-shared --disable-ffplay --enable-static --enable-gpl --enable-version3 --enable-fontconfig --enable-gray --enable-iconv --enable-lcms2 --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libdav1d --enable-libdavs2 --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libjxl --enable-libkvazaar --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librabbitmq --enable-librav1e --enable-librsvg --enable-librtmp --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxevd --enable-libxeve --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-openssl\n libavutil 59. 39.100 / 59. 39.100\n libavcodec 61. 19.101 / 61. 19.101\n libavformat 61. 7.100 / 61. 7.100\n libavdevice 61. 3.100 / 61. 3.100\n libavfilter 10. 4.100 / 10. 4.100\n libswscale 8. 3.100 / 8. 3.100\n libswresample 5. 3.100 / 5. 3.100\n libpostproc 58. 3.100 / 58. 3.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/greenscreen.mp4':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Lavf60.3.100\n Duration: 00:00:03.00, start: 0.000000, bitrate: 13007 kb/s\n Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1872x1080, 13002 kb/s, 30 fps, 30 tbr, 15360 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\nStream mapping:\n Stream #0:0 -> #0:0 (h264 (native) -> gif (native))\nPress [q] to stop, [?] for help\n[Parsed_palettegen_8 @ 0x7958a8b4b140] 255(+1) colors generated out of 1050495 colors; ratio=0.000243\nOutput #0, gif, to '/tmp/output.gif':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Lavf61.7.100\n Stream #0:0(und): Video: gif, pal8(pc, gbr/unknown/unknown, progressive), 1500x865, q=2-31, 200 kb/s, 15 fps, 100 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n encoder : Lavc61.19.101 gif\nframe= 2 fps=0.2 q=-0.0 size= 0KiB time=00:00:00.13 bitrate= 0.0kbits/s speed=0.0133x \rframe= 5 fps=0.5 q=-0.0 size= 2048KiB time=00:00:00.33 bitrate=50331.7kbits/s speed=0.0317x \rframe= 8 fps=0.7 q=-0.0 size= 4352KiB time=00:00:00.53 bitrate=66846.8kbits/s speed=0.0485x \rframe= 11 fps=1.0 q=-0.0 size= 6656KiB time=00:00:00.73 bitrate=74353.6kbits/s speed=0.0638x \rframe= 14 fps=1.2 q=-0.0 size= 8704KiB time=00:00:00.93 bitrate=76396.3kbits/s speed=0.0778x \rframe= 17 fps=1.4 q=-0.0 size= 11008KiB time=00:00:01.13 bitrate=79568.4kbits/s speed=0.0907x \rframe= 20 fps=1.5 q=-0.0 size= 13312KiB time=00:00:01.33 bitrate=81788.9kbits/s speed=0.103x \rframe= 23 fps=1.7 q=-0.0 size= 15360KiB time=00:00:01.53 bitrate=82062.5kbits/s speed=0.114x \rframe= 27 fps=1.9 q=-0.0 size= 18432KiB time=00:00:01.73 bitrate=87112.5kbits/s speed=0.124x \rframe= 30 fps=2.1 q=-0.0 size= 20736KiB time=00:00:02.00 bitrate=84934.7kbits/s speed=0.138x \rframe= 33 fps=2.2 q=-0.0 size= 22784KiB time=00:00:02.20 bitrate=84839.3kbits/s speed=0.147x \rframe= 36 fps=2.3 q=-0.0 size= 25088KiB time=00:00:02.40 bitrate=85633.7kbits/s speed=0.155x \rframe= 39 fps=2.4 q=-0.0 size= 27392KiB time=00:00:02.60 bitrate=86305.9kbits/s speed=0.162x \rframe= 42 fps=2.5 q=-0.0 size= 29696KiB time=00:00:02.80 bitrate=86882.0kbits/s speed=0.17x \rframe= 46 fps=2.7 q=-0.0 size= 32512KiB time=00:00:03.06 bitrate=86849.4kbits/s speed=0.18x \rframe= 50 fps=2.9 q=-0.0 size= 35584KiB time=00:00:03.33 bitrate=87451.2kbits/s speed=0.19x \rframe= 53 fps=2.9 q=-0.0 size= 37632KiB time=00:00:03.53 bitrate=87249.4kbits/s speed=0.196x \rframe= 57 fps=3.1 q=-0.0 size= 40704KiB time=00:00:03.80 bitrate=87749.3kbits/s speed=0.205x \rframe= 61 fps=3.2 q=-0.0 size= 43520KiB time=00:00:04.06 bitrate=87667.8kbits/s speed=0.214x \rframe= 65 fps=3.3 q=-0.0 size= 46592KiB time=00:00:04.33 bitrate=88080.4kbits/s speed=0.222x \rframe= 69 fps=3.4 q=-0.0 size= 49664KiB time=00:00:04.60 bitrate=88445.1kbits/s speed=0.23x \rframe= 73 fps=3.6 q=-0.0 size= 52480KiB time=00:00:04.86 bitrate=88338.9kbits/s speed=0.237x \rframe= 77 fps=3.7 q=-0.0 size= 55552KiB time=00:00:05.06 bitrate=89818.8kbits/s speed=0.241x \rframe= 80 fps=3.7 q=-0.0 size= 57856KiB time=00:00:05.33 bitrate=88866.8kbits/s speed=0.248x \rframe= 85 fps=3.9 q=-0.0 size= 61440KiB time=00:00:05.66 bitrate=88820.6kbits/s speed=0.257x \rframe= 89 fps=4.0 q=-0.0 size= 64512KiB time=00:00:05.93 bitrate=89070.1kbits/s speed=0.264x \r[out#0/gif @ 0x7958a8c1f580] video:66773KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.000029%\nframe= 90 fps=4.0 q=-0.0 Lsize= 66773KiB time=00:00:06.00 bitrate=91167.8kbits/s speed=0.265x",
"output": "https://replicate.delivery/xezq/3BZTZLgl3rbvMZ0JoRoOMRfVQKerTeDlMBV9Y8nfUZejYbfSF/output.gif",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-08-17T16:34:35.651Z",
"started_at": "2025-08-17T16:34:36.105182Z",
"completed_at": "2025-08-17T16:35:17.112649Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/3w5pw2r00drme0crq3h8k3hxhg/cancel",
"children": "https://api.replicate.com/v1/predictions/3w5pw2r00drme0crq3h8k3hxhg/children",
"get": "https://api.replicate.com/v1/predictions/3w5pw2r00drme0crq3h8k3hxhg",
"root": "https://api.replicate.com/v1/predictions/3w5pw2r00drme0crq3h8k3hxhg",
"stream": "https://stream.replicate.com/v1/files/bcwr-sle5t7jwv62r6oirbhluioynazhnyjhjoqzexww7e4rm3pxu6c4q",
"web": "https://replicate.com/p/3w5pw2r00drme0crq3h8k3hxhg"
},
"metrics": {
"predict_time": 41.007467069,
"total_time": 41.461649
}
}