Skip to content

Eyoatam/deno_gif

Repository files navigation

Gif.ts

convert your videos to .gif, .mp3, .mp4, .webm and .avi

Installation

deno install  --allow-read --allow-write --allow-run -f -n gif https://deno.land/x/deno_gif@1.5/cli.ts

This module Requires ffmpeg:

brew install ffmpeg

Options

name description
width controls the width of the video
height controls the height of the video

Methods

name description
gif converts videos of any format to gifs
mp4 converts videos of any format to mp4
mp3 converts videos of any format to mp3
avi converts videos of any format to avi
webm converts videos of any format to webm

Example

Example of converting video to gif with options

import { gif } from "https://deno.land/x/deno_gif@<version>/mod.ts";

const options = {
  width: 480,
  height: 380,
};

gif(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
  options,
);

and without options

import { gif } from "https://deno.land/x/deno_gif@<version>/mod.ts";

gif(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
);

or using the cli

gif -i https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4 -o output

Example of converting video to mp3

import { mp3 } from "https://deno.land/x/deno_gif@<version>/mod.ts";

mp3(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
);

or using the cli

gif --mp3 -i https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4 -o output

Example of converting video to mp4 with options

import { mp4 } from "https://deno.land/x/deno_gif@<version>/mod.ts";

const options = {
  width: 480,
  height: 350,
};

mp4(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
  options,
);

and with out options

import { mp4 } from "https://deno.land/x/deno_gif@<version>/mod.ts";

mp4(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
);

or using the cli

gif --mp4 -i https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4 -o output

Example of converting video to avi with options

import { avi } from "https://deno.land/x/deno_gif@<version>/mod.ts";

const options = {
  width: 480,
  height: 350,
};

avi(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
  options,
);

and with out options

import { avi } from "https://deno.land/x/deno_gif@<version>/mod.ts";

avi(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
);

or using the cli

gif --avi -i https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4 -o output

Example of converting video to webm with options

import { webm } from "https://deno.land/x/deno_gif@<version>/mod.ts";

const options = {
  width: 480,
  height: 350,
};

webm(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
  options,
);

and with out options

import { webm } from "https://deno.land/x/deno_gif@<version>/mod.ts";

webm(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
);

or using the cli

gif --webm -i https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4 -o output

Example of converting video to mov with options

import { mov } from "https://deno.land/x/deno_gif@<version>/mod.ts";

const options = {
  width: 480,
  height: 350,
};

mov(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
  options,
);

and with out options

import { mov } from "https://deno.land/x/deno_gif@<version>/mod.ts";

mov(
  "https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4",
  "output",
);

or using the cli

gif --mov -i https://github.com/Eyoatam/Gif.ts/tree/master/example/testdata/video.mp4 -o output

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b feat/new-feature
  3. Commit your changes: git commit -am 'feat(newFeature): add new features'
  4. Push to the branch: git push origin feat/new-feature
  5. Submit a pull request

Give your pr a descriptive title

Examples of good title:

  • fix(cli): fix cli video to gif converter
  • feat(utils): add more utils

For further information you can read the Contribiting guidelines

Show Your Support

Give a 🌟 if you like this project!

License

MIT