Update app.py
Browse files
app.py
CHANGED
@@ -28,14 +28,14 @@ def clip(yt_url, start_timestamp, duration):
|
|
28 |
ydl.download([yt_url])
|
29 |
except Exception as e:
|
30 |
print(e)
|
31 |
-
ydl_opts["format"] = "bestvideo[height<=480][ext=mp4]+bestaudio[ext=m4a]/best[height<=480[ext=mp4]/best"
|
32 |
sleep(5)
|
33 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
34 |
ydl.download([yt_url])
|
35 |
-
clip_path =
|
36 |
print(f'ffmpeg -ss {start_timestamp} -t {duration} -i "{video_output_path}" "{clip_path}"')
|
37 |
subprocess.run(f'ffmpeg -ss {start_timestamp} -t {duration} -i "{video_output_path}" "{clip_path}"', shell=True)
|
38 |
-
|
39 |
|
40 |
|
41 |
url_link = gr.Textbox(label="YouTube URL")
|
|
|
28 |
ydl.download([yt_url])
|
29 |
except Exception as e:
|
30 |
print(e)
|
31 |
+
ydl_opts["format"] = "bestvideo[height<=480][ext=mp4]+bestaudio[ext=m4a]/best[height<=480][ext=mp4]/best"
|
32 |
sleep(5)
|
33 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
34 |
ydl.download([yt_url])
|
35 |
+
clip_path = f"{uuid4()}.mp3"
|
36 |
print(f'ffmpeg -ss {start_timestamp} -t {duration} -i "{video_output_path}" "{clip_path}"')
|
37 |
subprocess.run(f'ffmpeg -ss {start_timestamp} -t {duration} -i "{video_output_path}" "{clip_path}"', shell=True)
|
38 |
+
return clip_path
|
39 |
|
40 |
|
41 |
url_link = gr.Textbox(label="YouTube URL")
|