Spaces:
Sleeping
Sleeping
Upload infertest.py
Browse files18 unmodified lines192021222324455 unmodified lines48048148248348448548648748848949049149249318 unmodified linesimport tempfileimport osimport werkzeugapp = Flask(__name__)now_dir = os.getcwd()455 unmodified linesoutput_path = "output/result/combine.mp3"#command = f'ffmpeg -y -i "{inst_path}" -i "{vocal_path}" -filter_complex [0:a]volume={inst_volume}[i];[1:a]volume={vocal_volume}[v];[i][v]amix=inputs=2:duration=longest[a] -map [a] -b:a 320k -c:a libmp3lame "{output_path}"'#command=f'ffmpeg -y -i "{inst_path}" -i "{vocal_path}" -filter_complex "amix=inputs=2:duration=longest" -b:a 320k -c:a libmp3lame "{output_path}"'command = ['ffmpeg', '-y','-i', inst_path,'-i', vocal_path,'-filter_complex', 'amix=inputs=2:duration=longest','-b:a', '320k','-c:a', 'libmp3lame',output_path]#result = subprocess.run(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)18 unmodified lines192021222324252627282930313233343536455 unmodified lines49249349449549649749849950050150250350450550618 unmodified linesimport tempfileimport osimport werkzeugfrom pydub import AudioSegment# Load the audio filesvocal = AudioSegment.from_file("vocal_path.wav")instrumental = AudioSegment.from_file("inst_path.wav")# Overlay the vocal track on top of the instrumental trackcombined = vocal.overlay(instrumental)# Export the resultcombined.export("output/result/combine.mp3", format="mp3")app = Flask(__name__)now_dir = os.getcwd()455 unmodified linesoutput_path = "output/result/combine.mp3"#command = f'ffmpeg -y -i "{inst_path}" -i "{vocal_path}" -filter_complex [0:a]volume={inst_volume}[i];[1:a]volume={vocal_volume}[v];[i][v]amix=inputs=2:duration=longest[a] -map [a] -b:a 320k -c:a libmp3lame "{output_path}"'#command=f'ffmpeg -y -i "{inst_path}" -i "{vocal_path}" -filter_complex "amix=inputs=2:duration=longest" -b:a 320k -c:a libmp3lame "{output_path}"'# Load the audio filesvocal = AudioSegment.from_file(vocal_path.wav)instrumental = AudioSegment.from_file(inst_path.wav)# Overlay the vocal track on top of the instrumental trackcombined = vocal.overlay(instrumental)# Export the resultcombined.export("output/result/combine.mp3", format="mp3")]#result = subprocess.run(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
infertest.py+21-8