lanbogao commited on
Commit
eb6bfe7
1 Parent(s): b1e39f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -76,18 +76,15 @@ def download_audio(video_url, quality: str = '128', speed: float = None):
76
  'format': 'bestaudio/best',
77
  'outtmpl': '%(title)s.%(ext)s',
78
  'quiet': True,
79
- 'postprocessors': [{
80
- 'key': 'FFmpegExtractAudio',
81
- 'preferredcodec': 'mp3', #'opus',
82
- 'preferredquality': quality,
83
- }]
84
  }
85
 
86
  if speed:
87
- ydl_opts['postprocessors'].append({
88
- 'key': 'FFmpegFilter',
89
- 'filter_complex': f"atempo={speed}"
90
- })
 
 
91
 
92
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
93
  ydl.download([video_url])
 
76
  'format': 'bestaudio/best',
77
  'outtmpl': '%(title)s.%(ext)s',
78
  'quiet': True,
 
 
 
 
 
79
  }
80
 
81
  if speed:
82
+ ydl_opts["postprocessors"] = [{
83
+ "key": "FFmpegExtractAudio",
84
+ "preferredcodec": "mp3",
85
+ "preferredquality": quality,
86
+ "addopts": f"-filter:a \"atempo={speed}\"",
87
+ }]
88
 
89
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
90
  ydl.download([video_url])