Python ffmpeg akzeptiert den Pfad nicht, warum?
Posted: 16 Feb 2025, 09:51
Jedes Mal, wenn ich den Code starte und den richtigen Pfad festlegt, gibt ich diesen Fehler. Ich habe versucht, den FFMPEG -Pfad, deinstallieren und installierte die Bibliothek zurück, aber kein Glück. Ich habe auch versucht, unterschiedliche Möglichkeiten zu verwenden, um den Pfad wie direkt zu setzen, ohne ihn auf eine Variable zu speichern. Dies macht mich verrückt. Bitte helfen Sie mir mit einer Lösung. < /P>
Code: Select all
Code
< /code>
from pytube import *
import ffmpeg
global str
userurl = (input("Enter a youtube video URL : "))
q = str(input("Which quality you want ? 360p,480p,720p,1080p,4K,Flh :")).lower()
yt = YouTube(userurl)
print ("Title of the video : ",yt.title)
def hd1080p():
print("Downloading a HD 1080p video...")
v = yt.streams.filter(mime_type="video/mp4", res="1080p", adaptive = True).first().download(filename = "HD1080P.mp4")
print("Video downloaded")
yt.streams.filter(mime_type="audio")
a = yt.streams.get_audio_only()
print("Downloading audio")
a.download(filename = "audio.mp4")
print("audio downloaded")
input_video = ffmpeg.input("HD1080P.mp4")
added_audio = ffmpeg.input("audio.mp4").audio.filter('adelay', "1500|1500")
merged_audio = ffmpeg.filter([input_video.audio, added_audio], 'amix')
(
ffmpeg
.concat(input_video, merged_audio, v=1, a=1)
.output("mix_delayed_audio.mp4")
.run(overwrite_output=True)
)
if q == "1080" or q == "1080p":
hd1080p()
elif q == "720" or q == "720p":
hd720p()
elif q == "480" or q == "480p":
l480p()
elif q == "360" or q == "360p":
l360p()
elif q == "4" or q == "4k":
hd4k()
else:
print("invalid choice")
< /code>
THE ERROR
< /code>
Traceback (most recent call last):
File "c:\Users\messa\Desktop\upcoming project\videodownloader.py", line 65, in
hd1080p()
File "c:\Users\messa\Desktop\upcoming project\videodownloader.py", line 26, in hd1080p
ffmpeg
File "E:\Users\messa\AppData\Local\Programs\Python\Python39\lib\site-packages\ffmpeg\_run.py", line 313, in run
process = run_async(
File "E:\Users\messa\AppData\Local\Programs\Python\Python39\lib\site-packages\ffmpeg\_run.py", line 284, in run_async
return subprocess.Popen(
File "E:\Users\messa\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "E:\Users\messa\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1416, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified