Overview
This node downloads audio from a specified YouTube video and converts it into an audio file in either MP3 or WAV format. It is useful for scenarios where users want to extract just the audio track from YouTube videos, such as for podcasts, music clips, voice notes, or offline listening.
Practical examples include:
- Extracting background music or speeches from YouTube videos.
- Creating audio samples or ringtones from video content.
- Archiving audio content from educational or entertainment videos.
The node supports downloading the highest or lowest quality audio stream and can optionally use a proxy server for the download process.
Properties
| Name | Meaning |
|---|---|
| Youtube Video ID or URL | The URL or direct video ID of the YouTube video from which to download audio. |
| Output Format | The desired output audio format: MP3 or WAV. |
| Quality | The quality of the audio stream to download: Highest Audio or Lowest Audio. |
| Use Proxy | Whether to route the download through a proxy server (true/false). |
| Proxy URL | The full URL of the proxy server to use (shown only if "Use Proxy" is true). |
| Proxy Type | The type of proxy: HTTP/HTTPS or SOCKS (shown only if "Use Proxy" is true). |
| Binary Property | The name of the binary property in the output item where the audio file data will be stored. |
Output
The node outputs items containing:
jsonobject with metadata fields:videoId: The YouTube video ID used for download.title: The sanitized title of the YouTube video.fileName: The filename of the converted audio file (e.g.,VideoTitle.mp3).fileSize: Size of the audio file in bytes.format: The audio format (mp3orwav).durationSeconds: Duration of the video/audio in seconds.
binaryobject containing the actual audio file data under the user-defined binary property name (default"data"). This binary data represents the downloaded and converted audio file ready for further processing or saving.
Dependencies
- Uses the
@distube/ytdl-corelibrary to fetch and download YouTube video audio streams. - Uses
fluent-ffmpegalong with a static ffmpeg binary (ffmpeg-static) to convert the downloaded audio stream into the selected output format. - Requires access to the local filesystem's temporary directory to store intermediate files during download and conversion.
- Optional proxy support configured via environment variables for HTTP, HTTPS, or SOCKS proxies.
Troubleshooting
Invalid YouTube URL or missing video ID:
Error thrown if the provided URL does not contain a valid YouTube video identifier or is malformed.
Resolution: Verify the URL or provide a direct video ID.Download errors:
Network issues, invalid proxy settings, or restrictions on the video may cause download failures.
Resolution: Check network connectivity, proxy configuration, and video availability.Conversion errors:
If ffmpeg fails during audio conversion, an error is thrown.
Resolution: Ensure ffmpeg is correctly installed (the node uses a bundled static version), and the input file is valid.Proxy misconfiguration:
If proxy is enabled but URL or type is incorrect, download may fail silently or throw errors.
Resolution: Double-check proxy URL format and select correct proxy type.Temporary file cleanup failure:
Errors deleting temp files are logged but do not stop execution.
Resolution: Usually safe to ignore; ensure the node has permission to write/delete temp files.
Links and References
- YouTube Video URLs — Understanding YouTube video links.
- ytdl-core GitHub repository — Library used for downloading YouTube video streams.
- FFmpeg Documentation — For details on audio conversion options.
- Fluent-ffmpeg GitHub repository — Node.js wrapper for FFmpeg.