BinaryBrain / Beetstream

Beets.io plugin that expose SubSonic API endpoints, allowing you to stream your music everywhere.
MIT License
35 stars 5 forks source link

Transcode the stream if ffmpeg-python is available #9

Closed bct closed 1 year ago

bct commented 1 year ago

If the ffmpeg module (https://github.com/kkroening/ffmpeg-python) is available, transcode the output of /rest/stream to respect maxBitRate.

If ffmpeg is not available, it will fall back sending the raw file.

I also changed the code for sending the raw file to use flask.send_file - this is supposed to be more efficient.

I've tested this manually, with & without ffmpeg. I'm not sure this is the most effective way to transcode, but it's been working for me.

BinaryBrain commented 1 year ago

Awesome idea and thanks for the PR! I found a bug when transcoding MP3 files containing cover art. I also added an option never_transcode: False that you can turn to True to deactivate transcoding (I use it on a Rpi and 30s to encode a mp3 file is a bit much for me). I added this in #10 .