PythonのモジュールでOggを再生したくていろいろ探してみたら、
https://qiita.com/cocuh/items/94a98cb312af7694ffd6
この記事があったのでこれを参考にやってみたところ、
python setup.py build_ext -i
このコマンドを実行したところ、以下のエラーが出てきました。
running build_ext cythoning vorbistest.pyx to vorbistest.c C:\Users\cabba\AppData\Local\Programs\Python\Python37\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\cabba\playogg\vorbistest.pyx tree = Parsing.p_module(s, pxd, full_module_name) Error compiling Cython file: ------------------------------------------------------------ ... cimport vorbistest as h ^ ------------------------------------------------------------ vorbistest.pyx:1:8: 'vorbistest.pxd' not found Error compiling Cython file: ------------------------------------------------------------ ... cdef int endian = 0 # 0 for little endian, 1 for big endian cdef int bitStream cdef char array[BUFFER_SIZE] # arrayという名のbuffer cdef FILE *f = fopen(name, "rb") cdef h.vorbis_info *pinfo ^ ------------------------------------------------------------ vorbistest.pyx:15:9: 'vorbis_info' is not a type identifier Error compiling Cython file: ------------------------------------------------------------ ... cdef char array[BUFFER_SIZE] # arrayという名のbuffer cdef FILE *f = fopen(name, "rb") cdef h.vorbis_info *pinfo cdef OggVorbis_File oggFile ^ ------------------------------------------------------------ vorbistest.pyx:17:9: 'OggVorbis_File' is not a type identifier Error compiling Cython file: ------------------------------------------------------------ ... cdef FILE *f = fopen(name, "rb") cdef h.vorbis_info *pinfo cdef OggVorbis_File oggFile h.ov_open(f, &oggFile, NULL, 0) ^ ------------------------------------------------------------ vorbistest.pyx:19:5: cimported module has no attribute 'ov_open' Error compiling Cython file: ------------------------------------------------------------ ... cdef h.vorbis_info *pinfo cdef OggVorbis_File oggFile h.ov_open(f, &oggFile, NULL, 0) pinfo = h.ov_info(&oggFile, -1) ^ ------------------------------------------------------------ vorbistest.pyx:20:13: cimported module has no attribute 'ov_info' Error compiling Cython file: ------------------------------------------------------------ ... import io buf = io.BytesIO() cdef long load_length load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) ^ ------------------------------------------------------------ vorbistest.pyx:36:19: cimported module has no attribute 'ov_read' Error compiling Cython file: ------------------------------------------------------------ ... cdef long load_length load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) while load_length>0: buf.write(array[:load_length]) load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) ^ ------------------------------------------------------------ vorbistest.pyx:39:23: cimported module has no attribute 'ov_read' Error compiling Cython file: ------------------------------------------------------------ ... load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) while load_length>0: buf.write(array[:load_length]) load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) pass h.ov_clear(&oggFile) ^ ------------------------------------------------------------ vorbistest.pyx:41:5: cimported module has no attribute 'ov_clear' building 'vorbistest' extension creating build creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\cabba\AppData\Local\Programs\Python\Python37\include -IC:\Users\cabba\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcvorbistest.c /Fobuild\temp.win-amd64-3.7\Release\vorbistest.obj vorbistest.c vorbistest.c(1): fatal error C1189: #error: Do not use this file, it is the result of a failed Cython compilation. error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2
setup.py
、 test.py
、 vorbis.pxd
、 vorbistest.pyx
が全てカレントディレクトリに入っています。
環境は、
- Windows10 64bit
- Python 3.7.4
- Visual C++ 2015
です。
何か他にインストールするものなどありますでしょうか?
ちなみに、ffplayなどを使って再生しようとも思いましたが、
- ffplayの出力がPythonの画面に流れてくる
- 出力をPythonの画面に流さないために
cmd /c start ffplay …
で別画面でffplayを実行すると、Pythonのsubprocess.Popen.kill()
ができない
等の理由で断念しました。
あと、最終的な目標はネットワーク上にあるOggファイルのストリーム再生です。
Oggファイルが上記条件を満たして再生できれば、Pythonモジュールを使った再生にはこだわりません。
他の方法もありましたら、よろしくおねがいします。
あなたの回答
tips
プレビュー