gists/music_sync/convert.py
2018-10-11 16:45:33 +02:00

10 lines
341 B
Python

import subprocess as sp
import os
def ogg(fin, fout):
p1 = sp.Popen(["ffmpeg", "-loglevel", "error", "-i", fin, "-f", "flac", "-"], stdout=sp.PIPE)
p2 = sp.Popen(["oggenc", "-Q", "-q", "5", "-", "-o", fout], stdin=p1.stdout, stdout=sp.PIPE)
p1.stdout.close()
p2.communicate()
ret = p1.poll() or p2.poll()
return ret