diff options
author | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-03-18 02:18:40 +0000 |
---|---|---|
committer | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-03-18 02:18:40 +0000 |
commit | 0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c (patch) | |
tree | 9a465cca480e2fe8bb5ca347d1211454c2a761f2 | |
parent | 2c7aa35fbe8fd54f8019658d50ee573309d52571 (diff) | |
download | youload-0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c.tar.gz youload-0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c.tar.bz2 youload-0f3f4cb1dd7670b84b85a5bb03a58e5d55b6794c.zip |
Using ffmpeg instead of moviepy
-rw-r--r-- | buildozer.spec | 4 | ||||
-rw-r--r-- | requirements.txt | 2 | ||||
-rw-r--r-- | src/model/youload_playlist.py | 10 |
3 files changed, 7 insertions, 9 deletions
diff --git a/buildozer.spec b/buildozer.spec index 8d85df8..47bcd34 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -13,7 +13,7 @@ package.domain = nate.youload source.dir = src # (list) Source files to include (let empty to include all the files) -source.include_exts = py,png,jpg,kv,atlas,pymovie +source.include_exts = py,png,jpg,kv,atlas # (list) List of inclusions using pattern matching #source.include_patterns = assets/*,images/*.png @@ -37,7 +37,7 @@ version = 1.2 # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy -requirements = python3,kivy,pytube +requirements = python3,kivy,ffmpeg-python # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/requirements.txt b/requirements.txt index c286d2f..8769e6d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ kivy pytube -moviepy +ffmpeg-python 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) |