12 lines
395 B
Python
12 lines
395 B
Python
import subprocess as sp
|
|
import tempfile
|
|
|
|
def ogg(inf):
|
|
_, temppath = tempfile.mkstemp()
|
|
p1 = sp.Popen(["ffmpeg", "-loglevel", "warning", "-i", inf, "-f", "flac", "-"], stdout=sp.PIPE)
|
|
p2 = sp.Popen(["oggenc", "-Q", "-", "-o", temppath], stdin=p1.stdout, stdout=sp.PIPE)
|
|
p1.stdout.close()
|
|
_, err = p2.communicate()
|
|
if err:
|
|
raise Exception(err)
|
|
return temppath
|