aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornathansmith117 <thenathansmithsmith@gmail.com>2024-03-18 02:18:40 +0000
committernathansmith117 <thenathansmithsmith@gmail.com>2024-03-18 02:18:40 +0000
commit0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c (patch)
tree9a465cca480e2fe8bb5ca347d1211454c2a761f2 /src
parent2c7aa35fbe8fd54f8019658d50ee573309d52571 (diff)
downloadyouload-0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c.tar.gz
youload-0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c.tar.bz2
youload-0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c.zip
Using ffmpeg instead of moviepy
Diffstat (limited to 'src')
-rw-r--r--src/model/youload_playlist.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/model/youload_playlist.py b/src/model/youload_playlist.py
index 51f8758..1856c64 100644
--- a/src/model/youload_playlist.py
+++ b/src/model/youload_playlist.py
@@ -1,5 +1,5 @@
from pytube import Playlist
-from moviepy.editor import VideoFileClip
+import ffmpeg
import os
def make_alpha_numeric(string: str) -> str:
@@ -52,13 +52,11 @@ class YouLoadPlayList:
elif self.download_type == "mp3":
file_path = video.streams.first().download(output_path=self.folder_name, filename_prefix=filename_prefix)
- # Get video from mp4.
- video_audio = VideoFileClip(file_path)
-
- # Get mp3.
+ # To mp3.
file_path_mp3 = file_path[:-4] + ".mp3"
- video_audio.audio.write_audiofile(file_path_mp3)
+ ffmpeg.input(file_path).output(file_path_mp3).run()
+ # Remove mp4 file.
os.remove(file_path)
else:
video.streams.get_by_resolution(self.download_type).download(output_path=self.folder_name, filename_prefix=filename_prefix)