Nodes/MediaForge/🎧 Extract Audio
ComfyUI Node

🎧 Extract Audio

Pull the audio out of a video (or save an in-memory AUDIO dict) as a real file

By leon80148Β·Created 4 months agoΒ·Updated 2 months agoΒ· 0
🎧 Extract Audio
  • audio
  • audio_file_path
β—„audio_sourceinput/sample.mp4β–Ί
β—„formatcopyβ–Ί
β—„filename_prefixMediaForge/audioβ–Ί

MF_ExtractAudio pulls the audio track out of a video and writes it as a standalone audio file - or takes an in-memory AUDIO dict and materializes it to disk. It's the first of MediaForge's standalone (file-level) Audio nodes, distinct from the Compose audio chain, which only manipulates audio during a video encode and never writes a standalone file. If you need an MP3 for a podcast feed from an MP4, or you want to save what MF_LoadVideoFrames decoded so you can work on it elsewhere, this is the node.

The default is the smart part: format=copy is a stream copy - no re-encode, no quality loss, near-instant. It maps the source codec to the right container automatically (AAC β†’ .m4a, MP3 β†’ .mp3, Opus/Vorbis β†’ .ogg, FLAC β†’ .flac, PCM β†’ .wav). Switch to a transcode format (mp3, aac (m4a), wav (pcm_s16le), flac) when you need a specific output codec and the source isn't already it.

How it works

Path mode: FFmpeg demuxes the source and either stream-copies the audio stream (copy) or re-encodes to the requested format. Audio-dict mode: when you wire an audio pin, it writes the dict to a temp WAV and transcodes from there. Two details worth knowing: with an audio dict input, format=copy has no literal meaning (a dict has no source codec), so it's treated as wav with a printed notice. And a source with no audio stream raises - the pack would rather tell you than hand you an empty file.

The inputs that matter

  • audio_source - the video or audio file. Hidden when the audio pin is wired.
  • format - copy / mp3 / aac (m4a) / wav (pcm_s16le) / flac. copy for lossless speed, mp3 if the destination demands it.
  • filename_prefix - output name base; the extension is auto-chosen per format.

Output: audio_file_path (STRING).

Install

Part of MediaForge:

cd ComfyUI/custom_nodes
git clone https://github.com/leon80148/comfyui_MediaForge.git
# restart ComfyUI

Or ComfyUI Manager β†’ "MediaForge".

Common issues

The format=copy raise is the one that confuses people: if the source codec isn't in the mapping list, it raises and suggests a transcode format instead - that's the node being honest, not broken. And don't expect a transcoded output to be faster than the source; MP3 from AAC re-encodes, so quality follows the weakest link. One more: this node writes under output/<prefix>_NNNNN.ext with an auto-counter, so repeated runs accumulate files rather than overwriting - clean up if you're iterating a lot.

CategoryMediaForge/Audio

Inputs (4)

NameTypeDefaultDescription
audio_sourceSTRINGinput/sample.mp4β€”
formatCOMBOcopy5 options: copy, mp3, aac (m4a), wav (pcm_s16le), flac
filename_prefixSTRINGMediaForge/audioβ€”
audiooptAUDIOβ€”

Outputs (1)

NameTypeDescription
audio_file_pathSTRINGβ€”