# yt-converter

> A youtube video converter for mp3 and mp4 using node-ytdl and ffmpeg

Latest version **2.4.2** (published 2025-04-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install yt-converter
pnpm add yt-converter
yarn add yt-converter
bun add yt-converter
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.2 |
| Published | 2025-04-09 |
| First published | 2021-12-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 89.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | RogelioLB |
| Maintainers | rogeliolb |
| Keywords | youtube, ytdl, ffmpeg, download, converter |

## Links

- npm: https://www.npmjs.com/package/yt-converter
- Repository: https://github.com/RogelioLB/node-yt-converter
- Homepage: https://github.com/RogelioLB/node-yt-converter#readme
- Issues: https://github.com/RogelioLB/node-yt-converter/issues
- npm.io page: https://npm.io/package/yt-converter

## Dependencies (4)

- [dotenv](https://npm.io/package/dotenv.md) ^16.4.7
- [ffmetadata](https://npm.io/package/ffmetadata.md) ^1.7.0
- [ffmpeg-static](https://npm.io/package/ffmpeg-static.md) ^4.4.0
- [@distube/ytdl-core](https://npm.io/package/@distube/ytdl-core.md) ^4.16.8

## Recent versions

- 2.4.2 (latest) — 2025-04-09
- 2.4.1 — 2025-04-08
- 2.4.0 — 2025-04-08
- 2.3.1 — 2025-01-26
- 2.3.0 — 2025-01-26
- 2.2.8 — 2025-01-26
- 2.2.7 — 2025-01-25
- 2.2.6 — 2025-01-25
- 2.2.5 — 2025-01-25
- 2.2.4 — 2025-01-25
- 2.2.3 — 2025-01-25
- 2.2.2 — 2025-01-25
- 2.2.1 — 2025-01-25
- 2.2.0 — 2025-01-25
- 2.1.1 — 2024-06-25
- … 31 more at https://npm.io/package/yt-converter/versions

## README

# Node YoutubeDL - Easy to use downloader for YouTube videos

> [!IMPORTANT]
> Version 2.0 Released. New way to use it.

## Installation 
```bash
npm install yt-converter
```

## Usage

There's two ways to use this library, convert audio or video. For this the package exports two functions named Audio, and Video, each one is for convert audio and video respectively.

### Converting Youtube Video to MP3 file

```ts
import { Video, Audio } from '../dist/src/index';

const link = 'https://www.youtube.com/watch?v=QI5idh3Uwh4&list=RDQI5idh3Uwh4&start_radio=1';

async function test(url:string) {
  const data = await Audio({
    url,
    onDownloading: (d) => console.log(d),
  });

  console.log(data.message);
}

test(link);
```

### Converting Youtube Video to MP4 file

```ts
import { Video, Audio } from '../dist/src/index';

const link = 'https://www.youtube.com/watch?v=QI5idh3Uwh4&list=RDQI5idh3Uwh4&start_radio=1';

async function test(url:string) {
  const data = await Video({
    url,
    onDownloading: (d) => console.log(d),
  });

  console.log(data.message);
}

test(link);
```
### Function params

Both fuctions need an options object.

* *url*: Expect to be a string representing the url link of the youtube video. 
* *directory (optional)*: Path relative where you want the file converted.
* *itag*: This represents a number of a specific format. [For more information](https://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
* *onDownloading (optional)* : Function will be executed while the file is downloading.
* *ffmpegPath (optional)*: Specify the path to the ffmpeg binary. By default uses the path provided by the package. But if you want use on a VM or Hosting maybe you should use a custom path.

Once the functions Video and Audio are executed, returns a promise wich resolve a data object.

* *message*
* *error*
* *videoInfo*


## Stream audio 
You can also

---
_Source: https://npm.io/package/yt-converter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
