|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: May 2007
Città: Milano
Messaggi: 7103
|
[Python]Conversione audio
Codice:
#! /usr/bin/env python import sys, os from subprocess import Popen # Mp3 ==> Wav file_in = raw_input("Mp3 file:") cmd1 = "mpg321 -q -w in.wav " + file_in retcode = Popen(cmd1, shell=True).wait() if retcode != 0: print 'Mp3 ==> Wav failed.' # Wav ==> Ogg # ==> opt = raw_input("1)Quality Mode" + "2)Bitrate mode\n") if opt == 1: quality = raw_input("Select quality \n\n 1)Low \n\n 3)Normal " + "\n\n 5)Higth\n") cmd2 = "oggenc -q " + quality + " in.wav" retcode = Popen(cmd2, shell=True).wait() if retcode != 0: print 'Wav ==> Ogg failed.' elif opt == 2: min_br = raw_input("Select minimum bitrate:") max_br = raw_input("Select maximum bitrate:") cmd2 = "oggenc -m " + min_br +" -M " + max_br + " in.wav" retcode = Popen(cmd2, shell=True).wait() if retcode != 0: print 'Wav ==> Ogg failed.' Tnks
__________________
Apple Watch Ultra + iPhone 15 Pro Max + Rog Ally + Legion Go |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: May 2007
Città: Milano
Messaggi: 7103
|
risolto:
Codice:
#! /usr/bin/env python # # Convert an mp3 file into ogg(by quality or bitrare) # (c) The_Ouroboros 2007 # import sys, os from subprocess import Popen # Mp3 ==> Wav file_in = raw_input("1]Mp3 file: ") cmd1 = "mpg321 -q -w in.wav " + file_in retcode = Popen(cmd1, shell=True).wait() if retcode != 0: print 'Mp3 ==> Wav failed.' # Wav ==> Ogg opt = raw_input("2]Select encoding mode \n\n "+ "1)Quality Mode\n" + "2)Bitrate mode\n") if opt == "1": quality = raw_input("2]Select quality \n\n 1)Low \n 3)Normal " + "\n 5)Higth\n") cmd2 = "oggenc -q " + quality + " in.wav" retcode = Popen(cmd2, shell=True).wait() if retcode != 0: print 'Wav ==> Ogg failed.' elif opt == "2": min_br = raw_input("*Select minimum bitrate:") max_br = raw_input("*Select maximum bitrate:") cmd2 = "oggenc -m " + min_br +" -M " + max_br + " in.wav" retcode = Popen(cmd2, shell=True).wait() if retcode != 0: print 'Wav ==> Ogg failed.' # Delete temp cmd3 = "rm in.wav" retcode = Popen(cmd3, shell=True).wait() if retcode != 0: print "rm temp wav failed."
__________________
Apple Watch Ultra + iPhone 15 Pro Max + Rog Ally + Legion Go |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 18:21.