FFmpeg is compiled without opus support
Describe the bug
I uploaded my music to Funkwhale in opus format. This used to work fine for playback in Firefox, but now it seems unable to decode opus and requests mp3 instead (message Cannot play media. No decoders for requested formats: audio/opus in browser console). But this Funkwhale image is unable to convert from opus to mp3.
Logs
funkwhale_1 | 2020-10-19 10:50:56,626 django.request ERROR Internal Server Error: /api/v1/listen/e4953718-7301-4b09-8596-fa94c46a1f00/
funkwhale_1 | Traceback (most recent call last):
funkwhale_1 | File "/usr/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
funkwhale_1 | response = get_response(request)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
funkwhale_1 | response = self.process_exception_by_middleware(e, request)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
funkwhale_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
funkwhale_1 | File "/usr/lib/python3.7/contextlib.py", line 74, in inner
funkwhale_1 | return func(*args, **kwds)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
funkwhale_1 | return view_func(*args, **kwargs)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/rest_framework/viewsets.py", line 114, in view
funkwhale_1 | return self.dispatch(request, *args, **kwargs)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
funkwhale_1 | response = self.handle_exception(exc)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
funkwhale_1 | self.raise_uncaught_exception(exc)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
funkwhale_1 | raise exc
funkwhale_1 | File "/usr/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
funkwhale_1 | response = handler(request, *args, **kwargs)
funkwhale_1 | File "/app/api/funkwhale_api/music/views.py", line 638, in retrieve
funkwhale_1 | return handle_stream(track, request, **config)
funkwhale_1 | File "/app/api/funkwhale_api/music/views.py", line 666, in handle_stream
funkwhale_1 | wsgi_request=request._request,
funkwhale_1 | File "/app/api/funkwhale_api/music/views.py", line 536, in inner
funkwhale_1 | response = f(*args, **kwargs)
funkwhale_1 | File "/app/api/funkwhale_api/music/views.py", line 591, in handle_serve
funkwhale_1 | transcoded_version = f.get_transcoded_version(format, max_bitrate=max_bitrate)
funkwhale_1 | File "/app/api/funkwhale_api/music/models.py", line 927, in get_transcoded_version
funkwhale_1 | return self.create_transcoded_version(mimetype, format, bitrate=max_bitrate)
funkwhale_1 | File "/usr/lib/python3.7/contextlib.py", line 74, in inner
funkwhale_1 | return func(*args, **kwds)
funkwhale_1 | File "/app/api/funkwhale_api/music/models.py", line 942, in create_transcoded_version
funkwhale_1 | audio=self.get_audio_segment(),
funkwhale_1 | File "/app/api/funkwhale_api/music/models.py", line 859, in get_audio_segment
funkwhale_1 | audio = pydub.AudioSegment.from_file(input, format=input_format)
funkwhale_1 | File "/usr/lib/python3.7/site-packages/pydub/audio_segment.py", line 725, in from_file
funkwhale_1 | p.returncode, p_err.decode(errors='ignore') ))
funkwhale_1 | pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1
funkwhale_1 |
funkwhale_1 | Output from ffmpeg/avlib:
funkwhale_1 |
funkwhale_1 | ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers
funkwhale_1 | built with gcc 8.3.0 (Alpine 8.3.0)
funkwhale_1 | configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
funkwhale_1 | libavutil 56. 22.100 / 56. 22.100
funkwhale_1 | libavcodec 58. 35.100 / 58. 35.100
funkwhale_1 | libavformat 58. 20.100 / 58. 20.100
funkwhale_1 | libavdevice 58. 5.100 / 58. 5.100
funkwhale_1 | libavfilter 7. 40.101 / 7. 40.101
funkwhale_1 | libavresample 4. 0. 0 / 4. 0. 0
funkwhale_1 | libswscale 5. 3.100 / 5. 3.100
funkwhale_1 | libswresample 3. 3.100 / 3. 3.100
funkwhale_1 | libpostproc 55. 3.100 / 55. 3.100
funkwhale_1 | Unknown input format: 'opus'
I think this issue should be solved simply by compiling FFmpeg with --enable-opus, but let me know if you need any more info.
Fixing this may be harder than expected. We're using Alpine's packaged ffmpeg, we don't compile it ourselves (https://github.com/michaelmob/docker-funkwhale/blob/master/Dockerfile#L30).
The proper way to fix this, I think, would be to ask the ffmpeg package maintainers to include opus support in their build
I would also appreciate opus support :)