ytdl-org/youtube-dl · error · PostProcessingError

error running

Error message

error running 

What it means

Raised by FFmpegExtractAudioPP.run when run_ffmpeg raises any exception that is NOT AudioConversionError — a catch-all 'error running ffmpeg/avconv'. It fires when the failure happens outside the normal FFmpegPostProcessorError channel: OSError spawning the binary, KeyboardInterrupt-adjacent errors, or unexpected per-option exceptions.

Source

Thrown at youtube_dl/postprocessor/ffmpeg.py:337

        new_path = prefix + sep + extension

        information['filepath'] = new_path
        information['ext'] = extension

        # If we download foo.mp3 and convert it to... foo.mp3, then don't delete foo.mp3, silly.
        if (new_path == path
                or (self._nopostoverwrites and os.path.exists(encodeFilename(new_path)))):
            self._downloader.to_screen('[ffmpeg] Post-process file %s exists, skipping' % new_path)
            return [], information

        try:
            self._downloader.to_screen('[ffmpeg] Destination: ' + new_path)
            self.run_ffmpeg(path, new_path, acodec, more_opts)
        except AudioConversionError as e:
            raise PostProcessingError(
                'audio conversion failed: ' + e.msg)
        except Exception:
            raise PostProcessingError('error running ' + self.basename)

        # Try to update the date time for extracted audio file.
        if information.get('filetime') is not None:
            self.try_utime(
                new_path, time.time(), information['filetime'],
                errnote='Cannot update utime of audio file')

        return [path], information


class FFmpegVideoConvertorPP(FFmpegPostProcessor):
    def __init__(self, downloader=None, preferedformat=None):
        super(FFmpegVideoConvertorPP, self).__init__(downloader)
        self._preferedformat = preferedformat

    def run(self, information):
        path = information['filepath']
        if information['ext'] == self._preferedformat:

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Re-run with -v to see the underlying traceback before the generic message
  2. Free disk space and confirm write permissions on the output directory
  3. Make sure nothing else deletes or moves the file between download and post-processing
  4. Reinstall/repair ffmpeg if the binary itself fails to execute ('ffmpeg -version')
Defensive patterns

Strategy: fallback

Validate before calling

import shutil, os

def environment_ready_for_extract(path):
    exe = shutil.which('ffmpeg') or shutil.which('avconv')
    return bool(exe) and os.access(os.path.dirname(path) or '.', os.W_OK)

Try / catch

try:
    ydl.download([url])
except PostProcessingError as e:
    if str(e).startswith('error running'):
        # generic wrapper: keep the downloaded file, log and continue the batch
        log.warning('ffmpeg crashed for %s; keeping original file', url)

Prevention

When it happens

Trigger: The ffmpeg executable disappeared or lost execute permission between version check and run; I/O errors reading the source file (deleted mid-run, disk full); unexpected exceptions inside run_ffmpeg option handling.

Common situations: Disk full during conversion; file moved/deleted by the --exec hook or another process mid-download; environment changed (container restarted) between init and post-processing.

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/d35d5621397baa2e. Report an issue: GitHub.