Package Information
Available Nodes
Documentation
YouTube to MP3 - n8n Community Node
Convert YouTube videos and media URLs to MP3 files directly in your n8n workflows!
n8n is a workflow automation platform that lets you connect apps and services together.
What Can You Do With This Node?
- ๐ต Download YouTube audio - Extract audio from any YouTube video as MP3
- ๐ Convert media URLs - Turn any audio/video URL into MP3 format
- โ๏ธ Choose quality - Select from 128k, 192k, 256k, or 320k bitrate
- โ๏ธ Trim audio - Cut from the start or end of the audio
- ๐ Get video info - Automatically extracts title, description, and metadata
- ๏ฟฝ Use in workflows - Save to cloud storage, send via email, or process further
Installation
In n8n Desktop or Cloud
- Go to Settings โ Community Nodes
- Click Install a community node
- Enter
n8n-nodes-youtube-to-mp3 - Click Install
- The node will appear in your node panel after installation
In Self-Hosted n8n
Open your terminal and run:
npm install n8n-nodes-youtube-to-mp3
Then restart n8n. The node will appear in your node panel.
๐ Need help? Check the official installation guide
How to Use
Once installed, you'll find the YouTube to MP3 node in your node panel under the Transform category.
Node Settings
1. Media / YouTube URL (Required)
Paste the URL of the video or audio you want to convert:
- โ
YouTube videos:
https://www.youtube.com/watch?v=... - โ
YouTube Shorts:
https://youtube.com/shorts/... - โ
Direct media URLs:
https://example.com/audio.mp3
2. Bitrate (Optional)
Choose the audio quality for your MP3:
- 128k - Good quality, smaller file size (recommended for voice)
- 192k - Better quality, medium file size
- 256k - High quality, larger file size
- 320k - Highest quality, largest file size (recommended for music)
3. Start Time (Optional)
Start extracting from a specific point:
- Format:
HH:MM:SS(e.g.,00:02:30for 2 minutes 30 seconds) - Or just seconds:
150(2.5 minutes) - Leave empty to start from the beginning
4. End Trim (Optional)
Remove seconds from the end of the audio:
- Example:
10removes the last 10 seconds - Note: Only works with YouTube URLs (needs to know total duration)
Workflow Examples
Example 1: Download YouTube Video as MP3
Use Case: Save YouTube music videos to your Google Drive
Add YouTube to MP3 node
- URL:
https://www.youtube.com/watch?v=dQw4w9WgXcQ - Bitrate:
192k
- URL:
Add Google Drive node
- Operation: Upload a File
- File Name: Use expression
{{ $json.fileName }} - Binary Data: โ
(set to
data)
Result: MP3 file saved to your Google Drive with the video's title as filename
Example 2: Create Audio Clips from Long Videos
Use Case: Extract a specific section from a podcast or interview
Add YouTube to MP3 node
- URL: Your YouTube video URL
- Bitrate:
128k - Start Time:
00:15:30(start at 15 minutes 30 seconds) - End Trim:
60(remove last 60 seconds)
Add Dropbox node to save the clip
Result: Just the section you want, trimmed and ready to use
Example 3: Batch Convert Multiple Videos
Use Case: Convert a list of YouTube URLs to MP3
- Add Webhook or Manual Trigger with video URLs
- Add YouTube to MP3 node (processes each URL)
- Add Cloud Storage node to save all files
Result: Multiple MP3 files created from your list
Example 4: Email Audio Files
Use Case: Convert and email an audio file
- Add YouTube to MP3 node
- Add Gmail or Send Email node
- Attach the binary file from the previous node
Result: MP3 file sent via email
What Can You Do Next?
After converting to MP3, you can:
- ๐พ Save to cloud - Google Drive, Dropbox, OneDrive, AWS S3
- ๐ง Send via email - Gmail, Outlook, SendGrid
- ๐ฌ Share on messaging apps - Slack, Discord, Telegram
- ๐ Upload to server - FTP, HTTP Request, WebDAV
- ๐ต Process further - Use other audio processing nodes
What You Get Back
The node outputs an MP3 file as binary data that you can use in the next nodes of your workflow.
Binary Output
- File name: Automatically named after the video title (for YouTube) or a generated name
- Format: MP3 audio file
- Quality: Based on your selected bitrate
JSON Data (YouTube only)
The node also provides useful information about the video:
- title - Video title (used for the filename)
- description - Full video description
- duration - How long the original video was
- channel - Who uploaded the video
- thumbnail - Video thumbnail URL
- mp3Duration - Final MP3 length in seconds
- originalUrl - The YouTube URL you provided
Using the Output
In the next node, access the MP3 file by:
- Selecting Binary Data in file upload nodes
- Referencing
dataas the binary property name - Using
{{ $json.fileName }}for the filename in expressions
Tips & Best Practices
Choosing the Right Bitrate
- 128k - Perfect for podcasts, audiobooks, or voice recordings
- 192k - Good balance for most music
- 256k or 320k - For high-fidelity music or professional use
When to Use Start Time & End Trim
- Extract highlights from long videos
- Remove intros/outros automatically
- Create audio samples from specific sections
- Remember: End Trim only works with YouTube URLs
Processing Speed
- Longer videos take more time to process
- Higher bitrates produce larger files but take similar time
- The node uses temporary storage, so ensure adequate disk space
Working with Playlists
- This node processes one video at a time
- For playlists, extract individual URLs first using another method
- Consider using a loop or Split In Batches node for multiple videos
Frequently Asked Questions
Can I download entire playlists?
Not directly. This node processes one video at a time. You'd need to extract playlist URLs first using another method, then loop through them.
Does this work with other video sites besides YouTube?
It's optimized for YouTube, but it can work with direct media URLs (MP3, WAV, etc.). Other video sites may not work reliably.
Is there a file size limit?
There's no hard limit in the node, but your n8n instance may have limits. Very long videos (2+ hours) at high bitrate will create large files.
Can I convert to formats other than MP3?
Currently, this node only outputs MP3. For other formats, you'd need a different tool or custom node.
Will this work on n8n Cloud?
Yes, but be aware of execution timeouts and storage limits on your n8n Cloud plan.
How is the filename determined?
For YouTube videos, it uses the video title (with special characters removed). For direct URLs, it generates a name based on the URL or timestamp.
Troubleshooting
โ "Cannot download video" or "yt-dlp failed"
Possible causes:
- Invalid YouTube URL - double-check the link
- Video is private or deleted
- Video is age-restricted or region-blocked
- Network connection issues
Solutions:
- Test the URL in your browser first
- Try a different video
- Check if you need VPN for region-restricted content
โ "FFmpeg error" or "Conversion failed"
Possible causes:
- Not enough disk space
- Invalid media URL format
- Source file is corrupted
Solutions:
- Free up disk space on your server/computer
- Verify the URL works in a browser
- Try a different source URL
โ "End Trim requires known total duration"
Why this happens:
- You're using End Trim with a direct URL (not YouTube)
- Direct URLs don't provide duration information
Solution:
- Only use End Trim with YouTube URLs
- For direct URLs, calculate and use Start Time instead
โ ๏ธ Node is Taking Too Long
This is normal if:
- The video is very long (>1 hour)
- You're using high bitrate (320k)
- Your server has limited resources
Tips:
- Be patient with long videos
- Use lower bitrates for faster processing
- Consider breaking long videos into segments
Need Help?
Get Support
- ๐ฌ n8n Community Forum - Ask questions and share workflows
- ๐ Report Issues - Found a bug? Let us know
- ๐ n8n Documentation - Learn more about n8n
Useful Resources
- n8n Community Nodes - How community nodes work
- n8n Workflow Templates - Get inspired by other workflows
- YouTube URL Formats - Understanding YouTube URLs
This is a community-created node and is not officially maintained by n8n. It's built by the community, for the community.
Contributing
Want to improve this node? Contributions are welcome!
- Submit bug reports or feature requests on GitHub
- Fork the repository and submit pull requests
- Share your feedback in the n8n community
โญ Found this useful? Star the project on GitHub!
๐ก Have ideas? Share your workflow examples in the n8n community forum!
An n8n community node that converts a media URL to MP3 using ffmpeg.
Scaffold only โ YouTube URLs are not supported out-of-the-box.
Direct HTTP/HTTPS media links (.wav,.mp4,.flac, โฆ) work immediately.
Search the code forTODO: PLUG APPROVED YOUTUBE DOWNLOADER HEREto wire up your own downloader.
Node Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
Media / YouTube URL (youtubeUrl) |
string | โ | URL of the media file to convert |
Bitrate (bitrate) |
options | 192k |
128k ยท 192k ยท 256k ยท 320k |
Start Time (startTime) |
string | (empty) | Optional start offset (HH:MM:SS or seconds) |
Duration (duration) |
string | (empty) | Optional duration to extract (HH:MM:SS or seconds) |
File Name (fileName) |
string | audio.mp3 |
Name of the output file |
Output Binary Property (outputBinaryPropertyName) |
string | data |
Binary property key for the MP3 |
Continue on Fail (continueOnFail) |
boolean | false |
Return error JSON instead of throwing |
Prerequisites
- Node.js โฅ 18
- n8n installed globally or in a Docker container
- ffmpeg โ bundled automatically via
ffmpeg-static
Development Setup
# 1. Clone the repo
git clone https://github.com/ptmcode/n8n-youtube-download-mp3.git
cd n8n-youtube-download-mp3
# 2. Install dependencies
npm install
# 3. Build (compiles TypeScript โ dist/ and copies SVG icons)
npm run build
# 4. Watch mode (TypeScript only โ re-run gulp manually for SVG changes)
npm run dev
Link into n8n (local development)
# Inside this project directory
npm link
# Inside your n8n installation directory (global or local)
cd /path/to/n8n # or: cd $(npm root -g)/n8n
npm link n8n-nodes-youtube-to-mp3
# Restart n8n so it picks up the new node
n8n start
# โ or if running with Docker, mount the package into the container
After restarting, you should see "YouTube to MP3" in the n8n node panel under the Transform category.
Project Structure
n8n-youtube-download-mp3/
โโโ nodes/
โ โโโ YouTubeToMp3/
โ โโโ YouTubeToMp3.node.ts # Node implementation
โ โโโ YouTubeToMp3.svg # Icon
โ โโโ index.ts # Barrel export
โโโ dist/ # Compiled output (git-ignored)
โโโ gulpfile.js # Copies SVG into dist/
โโโ tsconfig.json
โโโ package.json
โโโ .eslintrc.json
โโโ .prettierrc
โโโ README.md
How It Works
- The node receives an input item with a
youtubeUrlparameter. getSourceStreamFromUrl()fetches the URL as a readable stream.- Direct HTTP/HTTPS links are streamed via
undici. - YouTube URLs throw a descriptive error (placeholder).
- Direct HTTP/HTTPS links are streamed via
- The stream is piped through fluent-ffmpeg โ libmp3lame at the chosen bitrate.
- The resulting MP3 is written to a temp file, read into a buffer, and attached as n8n binary data.
- Temp files are cleaned up automatically.
Adding YouTube Support
Search the codebase for:
TODO: PLUG APPROVED YOUTUBE DOWNLOADER HERE
Replace the placeholder in getSourceStreamFromUrl() with your approved library that returns a Readable stream for a given YouTube URL.
License
MIT