Spaces:
Sleeping
Sleeping
| import os | |
| import subprocess | |
| def convert_to_audio(input_file, output_file): | |
| ffmpeg_command = [ | |
| "ffmpeg", | |
| "-i", input_file, | |
| "-vn", | |
| "-acodec", "libmp3lame", | |
| "-ab", "96k", | |
| "-ar", "44100", | |
| "-y", | |
| output_file | |
| ] | |
| try: | |
| subprocess.run(ffmpeg_command, check=True) | |
| except subprocess.CalledProcessError as e: | |
| print("Error: failed to convert audio") | |