uzi007 commited on
Commit
468fae8
1 Parent(s): 1b5005d

Fixed FFMPEG & OpenAI Issues

Browse files
Files changed (3) hide show
  1. helperfunctions.py +3 -3
  2. media_download.py +9 -6
  3. requirements.txt +1 -1
helperfunctions.py CHANGED
@@ -43,7 +43,7 @@ def extract_audio(video_path):
43
  audio_codec = "libmp3lame" if extension.lower() in (".mp4", ".webm") else "mp3"
44
 
45
  # Extracting Audio using FFMPEG Command
46
- command = ["ffmpeg", "-i", video_path, "-vn", "-acodec",
47
  audio_codec, audio_path, '-loglevel', 'quiet']
48
  subprocess.run(command, check=True)
49
 
@@ -70,7 +70,7 @@ def burn_subtitles(video_file_path, subtitle_file_path):
70
  output_file_path = video_filename + subtitle_extension.replace('.', '_') + video_extension
71
 
72
  # Burning the Subtitles onto Video using FFMPEG Command
73
- command = ['ffmpeg', '-i', video_file_path,
74
  '-vf', f'subtitles={subtitle_file_path}',
75
  output_file_path, '-loglevel', 'quiet']
76
  subprocess.run(command, check=True)
@@ -135,7 +135,7 @@ def convert_audio(input_file, audio_format, audio_quality):
135
 
136
  # Running the command using Subprocess
137
  command = [
138
- 'ffmpeg', '-i', input_file,
139
  '-b:a', audio_quality[:-3], output_file,
140
  '-loglevel', 'quiet'
141
  ]
 
43
  audio_codec = "libmp3lame" if extension.lower() in (".mp4", ".webm") else "mp3"
44
 
45
  # Extracting Audio using FFMPEG Command
46
+ command = ["ffmpeg", "-y", "-i", video_path, "-vn", "-acodec",
47
  audio_codec, audio_path, '-loglevel', 'quiet']
48
  subprocess.run(command, check=True)
49
 
 
70
  output_file_path = video_filename + subtitle_extension.replace('.', '_') + video_extension
71
 
72
  # Burning the Subtitles onto Video using FFMPEG Command
73
+ command = ['ffmpeg', '-y', '-i', video_file_path,
74
  '-vf', f'subtitles={subtitle_file_path}',
75
  output_file_path, '-loglevel', 'quiet']
76
  subprocess.run(command, check=True)
 
135
 
136
  # Running the command using Subprocess
137
  command = [
138
+ 'ffmpeg', '-y', '-i', input_file,
139
  '-b:a', audio_quality[:-3], output_file,
140
  '-loglevel', 'quiet'
141
  ]
media_download.py CHANGED
@@ -111,14 +111,17 @@ class YoutubeDownloader(MediaDownloader):
111
  def __format_number(num):
112
  '''
113
  Returns the formatted number
114
- E.g: Given input 123456789, it returns 123,456,789
115
  '''
116
- # Setting the Locale
117
- locale.setlocale(locale.LC_ALL, '')
 
118
 
119
- # Formatting the Number with Commas
120
- num = locale.format_string("%d", num, grouping=True)
121
- return num
 
 
122
 
123
  @staticmethod
124
  def __get_quality_int(media_quality):
 
111
  def __format_number(num):
112
  '''
113
  Returns the formatted number
114
+ E.g: Given input 15783920, it returns 15,783,920
115
  '''
116
+ if type(num) is int:
117
+ # Setting the Locale
118
+ locale.setlocale(locale.LC_ALL, '')
119
 
120
+ # Formatting the Number with Commas
121
+ num = locale.format_string("%d", num, grouping=True)
122
+ return num
123
+ else:
124
+ return '-'
125
 
126
  @staticmethod
127
  def __get_quality_int(media_quality):
requirements.txt CHANGED
@@ -76,7 +76,7 @@ nvidia-cusparse-cu11==11.7.4.91
76
  nvidia-nccl-cu11==2.14.3
77
  nvidia-nvtx-cu11==11.7.91
78
  onnxruntime==1.16.2
79
- openai==1.2.4
80
  openai-whisper==20231106
81
  packaging==23.2
82
  pandas==2.1.3
 
76
  nvidia-nccl-cu11==2.14.3
77
  nvidia-nvtx-cu11==11.7.91
78
  onnxruntime==1.16.2
79
+ openai==0.28.0
80
  openai-whisper==20231106
81
  packaging==23.2
82
  pandas==2.1.3