-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OPUS support problems #252
Comments
Thank you for your analysis! I'd be grateful for a pull request, which we can merge once the new version of libsndfile has been released. I believe the reading issue would be addressed once we added the appropriate code to |
Hi, @bastibe, thanks for you answer!
If I got it right, you are planning to work on the code update. Where can I follow the progress just to stay in tune? |
Actually, I was asking you whether you would like to try to implement it! |
Oh, ok, I got it! |
No progress that I know of. But I know libsndfile is working on MP3 support. Once that is released, I will prepare a new release of soundfile with OPUS support and MP3 support. Until then, pull requests are welcome. |
Any ETA? It has been a month... |
That's entirely up to https://github.com/libsndfile/libsndfile. |
libsndfile has supported MP3 and OPUS, any plan to python-soundfile? |
According to the documentation, libsndfile will support MP3 in 1.1.0, but that has not yet been released. As soon as it is, I'll update soundfile to support it as well. Opus should be available in 1.0.29. |
can we read opus now? |
Now that libsndfile has added support for MP3, I am working on a new release. You can check my progress at #325 |
Should we add to |
In general, Opus support should already be working. Ogg containers with Opus contents should already work. But you're right, I think we don't have the file extension registered yet. I think |
I've also just run into an issue reading opus files. It seems that reading the last block fails, but the first blocks work fine. Here's an audio file where reading works fine until you hit the last block: Here's a short audio file that is short enough that also the first block fails. |
@tcwalther please forward this issue to https://github.com/libsndfile/libsndfile. |
Hello guys, people said about reading opus but i am in doubt if it can write ogg based on opus codec, is it possible? |
This works fine for me: import soundfile as sf
samples, sr = sf.read('./test_24khz.wav')
# note that Opus only supports sample rates of 8000, 12000, 16000, 24000, and 48000.
sf.write('example.opus', data, sr, format='OGG', subtype='OPUS')
samples, sr = sf.read('example.opus') However, there doesn't appear to be a way to control the Opus bitrate used. This is similar to the issue of being able to choose mp3 bitrate (#390 ), and I have opened an issue asking about how to do it in libsndfile here: |
Hi, I've been using
pysoundfile
for a long time for reading/writing Vorbis.ogg
files, it's working great, but it definitely lacks Opus support.As I've discovered,
libsndfile
has already added support foropus
, check out approved PR here: libsndfile/libsndfile#406 . It's not in an official release yet, but you can build a working version from source easily enough followingCMake
guide in readme.Building libsndfile
I've managed to successfully build the library running these commands(some of them are redundant):
Linking is added for
ctypes
to help find the new version oflibsoundfile
All native
libsndfile
examples are working fine from the command line: it reads/writes/etc.opus
files without any errors/exceptions.Changing source code to support Opus
Next is the interesting part. I've examined
pysoundfile
source code and it looks like just adding of anOPUS
key to subtypes dictionary is enough to support.opus
format.Write
And yes, it's working perfectly for
write
function. I've checked the generated audio by several different programs. It's just fine.Read
Problems are starting with
read
function.Calling
raises
RuntimeError: Supported file format but file is malformed.
It looks like alibsndfile
bug, but as I mentioned above, cleanlibsndfile
script reads.opus
files without any exceptions.I've solved this problem by installing
pysoundfile
from source with the following changes:to get_format_from_file;
_error_check
in seek and _cdata_ioNow,
read
is also working, but the commenting of_error_check
doesn't seem the proper way to fix this bug.Do you know how to fix this error? Or maybe what exactly can be the problem?
In any case, thank you for the great work!
The text was updated successfully, but these errors were encountered: