1

I was trying to make mp4/mp3 converter using ffmpeg, but ffmpeg is causing WinError2.

Only ffmpeg-python installed : causes WinError2, since ffmpeg.exe does not exist

Only ffmpeg installed : cannot import ffmpeg in py file (no module)

Both ffmpeg and ffmpeg-python installed : causes ffmpeg has no attribute input error

How can I fix this bug? Also I'm window user

import os
from pytube import YouTube
import ffmpeg # causes no module if only ffmpeg installed

vid = YouTube("link")

# order by sound quality
vids = vid.streams.filter(only_audio=True, file_extension="mp4").order_by("abr")

vids[-1].download(".\\files")

# causes ffmpeg has no attribute 'input' if both installed
vidAudio = ffmpeg.input(os.path.join(os.path.abspath(".\\files"), vidFullName))
audioStream = ffmpeg.output(vidAudio, os.path.join(os.path.abspath(".\\files"), vidName) + ".mp3")

# causes WinError2 if only ffmpeg-python installed
ffmpeg.run(audioStream)
eattato
  • 15
  • 1
  • 5
  • Make sure both FFmpeg CLI and ffmpeg-python are installed. Add the Python code to your post. Are you using Windows or Linux (or other)? – Rotem Mar 12 '22 at 13:36

0 Answers0