koozic icon indicating copy to clipboard operation
koozic copied to clipboard

Docker continaer on Raspberry Pi has a bad ffmpeg binary

Open apastuszak opened this issue 5 years ago • 27 comments

I used docker compose to build a koozic docker image and container and got it fire up and I could log in. But koozic will not play any music.

When I went into the console for the container and tried to run ffmpeg, I get the following error.

root@a59536472f3d:/# ffmpeg bash: /usr/local/bin/ffmpeg: cannot execute binary file: Exec format error

This seems to be indicative of an x86/x64 binary in an arm container.

Is it possible to completely disable any kind of transcoding and just have koozic play the file as-is?

apastuszak avatar Jul 03 '19 13:07 apastuszak

Hello,

In the playlist configuration, you can set the Audio Mode to 'No transcoding'.

https://doc.koozic.net/music/playlists/playlists.html#fields

-------- Message d'origine -------- On 3 juil. 2019 à 16:55, apastuszak a écrit :

I used docker compose to build a koozic docker image and container and got it fire up and I could log in. But koozic will not play any music.

When I went into the console for the container and tried to run ffmpeg, I get the following error.

root@a59536472f3d:/# ffmpeg bash: /usr/local/bin/ffmpeg: cannot execute binary file: Exec format error

This seems to be indicative of an x86/x64 binary in an arm container.

Is it possible to completely disable any kind of transcoding and just have koozic play the file as-is?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

DocMarty84 avatar Jul 03 '19 14:07 DocMarty84

Ok, changed the Audio API to Web Audio API and turned on No Transcoding. Music still won't play.

apastuszak avatar Jul 03 '19 14:07 apastuszak

Activate only No Transcoding. Did you try to refresh the page ?

-------- Message d'origine -------- On 3 juil. 2019 à 17:21, apastuszak a écrit :

Ok, changed the Audio API to Web Audio API and turned on No Transcoding. Music still won't play.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

DocMarty84 avatar Jul 03 '19 14:07 DocMarty84

I did that and stopped and started the container. Is there some kind of logging I can enable?

apastuszak avatar Jul 03 '19 14:07 apastuszak

Stop the container:

docker-compose stop

Start without the daemon mode:

docker-compose up

You'll get the log on the standard output -------- Original Message -------- On Jul 3, 2019, 5:37 PM, apastuszak wrote:

I did that and stopped and started the container. Is there some kind of logging I can enable?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

DocMarty84 avatar Jul 03 '19 14:07 DocMarty84

There is nothing useful in the standard output. Here is what I am seeing now:

If I add anything to the playlist I have set not to transcode, it seems to play fine. If I just browse my library and click on a track to play, the HTML5 player "loads" the file, but it never plays.

And nothing will play using any iOS subsonic client I tried. Is there any way to tell koozic to never transcode any files that are played, regardless of how they're played, system-wide?

apastuszak avatar Jul 04 '19 17:07 apastuszak

The behavior you describe does seem coherent. Transcoding is the default behavior unless specified differently for a given playlist. But that means it only applies to the playlist when played in the web browser.

When you play a track directly, it is not added to the playlist, therefore it doesn't follow the playlist configuration. Same goes for the Subsonic app.

2 solutions I need to check:

  • include a ffmpeg binary for ARM in the Docker installation. But the RPi might be overloaded by transcoding since it doesn't have much CPU power.

  • add an option to never transcode, whatever the configuration.

At the moment there might be a workaround, assuming your files are in the MP3 format. Indeed, Koozic does not transcode a file if:

  1. The file has the same format than the output format

  2. The requested bitrate is larger than the file bitrate.

Therefore, you could:

  • go in Configuration > Transcoders

  • move the MP3 transcoder to the top of the list to give it the priority over the Opus transcoder

That should solve the issue when you play a track directly, i.e not from a playlist.

Regarding Subsonic, make sure your application requests the highest possible bitrate. By the way, I suggest the app Soudwaves for iOS: https://itunes.apple.com/app/soundwaves/id736139596?mt=8

Hope it helps.

PS: I'll have a look at the mentioned solutions at the beginning of August since I won't have computer access in July.

Sorry for the bad formatting, replying from email...

DocMarty84 avatar Jul 05 '19 07:07 DocMarty84

I would prefer if it never transcoded. I have a mix of MP3 and M4A files and I would prefer they be sent "as-is." But you're not writing this for me, you're writing it for you.

And don't apologize for anything. You wrote something and gave it away for free. In my book, you win always.

apastuszak avatar Jul 05 '19 15:07 apastuszak

Thanks for the support 😉

Indeed I wrote it for me, but it's better if it can be useful to others. I'll have a look to make the "No Transcoding" a possible default option. I just need to think of a clear way to make it available for end users, since I want to keep the interface as simple as possible.

I'll work on it at the beginning of August and keep you posted.

DocMarty84 avatar Jul 06 '19 15:07 DocMarty84

Thank you!

On Sat, Jul 6, 2019 at 11:33 AM DocMarty84 [email protected] wrote:

Thanks for the support 😉

Indeed I wrote it for me, but it's better if it can be useful to others. I'll have a look to make the "No Transcoding" a possible default option. I just need to think of a clear way to make it available for end users, since I want to keep the interface as simple as possible.

I'll work on it at the beginning of August and keep you posted.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DocMarty84/koozic/issues/27?email_source=notifications&email_token=AAZ6KXVT4LWYJ6P6DDMZF6DP6C3NXA5CNFSM4H5GDK5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZK3U2Q#issuecomment-508934762, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ6KXRUOCQHKTDTF56NTWLP6C3NXANCNFSM4H5GDK5A .

apastuszak avatar Jul 06 '19 15:07 apastuszak

Hi! A "no transcoding" option would be great as I am facing this exact same issue on my ARM device. If you end up implementing this option, please do keep us posted :) By the way, I still can't play tracks directly even after changing the "Configuration > Transcoders" option as you suggested, but I do when playing from a playlist after setting "No Transcoding" as the Audio Mode. Just FYI.

peguerosdc avatar Jul 16 '19 23:07 peguerosdc

@peguerosdc Are you also using Docker?

DocMarty84 avatar Jul 17 '19 11:07 DocMarty84

@DocMarty64 yes

peguerosdc avatar Jul 17 '19 16:07 peguerosdc

Considering the processing power of a Pi, I think it would be best to simply have an option to disable transcoding completely.

Andy

On Wed, Jul 17, 2019 at 12:50 PM peguerosdc [email protected] wrote:

@DocMarty64 yes

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DocMarty84/koozic/issues/27?email_source=notifications&email_token=AAZ6KXSDIOUVJT7FGQ7K2CLP75EW5A5CNFSM4H5GDK5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2FAYOI#issuecomment-512363577, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ6KXWZDMJ5T4DFE2ZXGRTP75EW5ANCNFSM4H5GDK5A .

apastuszak avatar Jul 17 '19 17:07 apastuszak

Yes, that's what I'm planning to do.

DocMarty84 avatar Jul 17 '19 17:07 DocMarty84

Hello,

At the moment, the ffmpeg binary is shipped with KooZic. This is for historical reasons, but now it doesn't make sense anymore: we could use the binary provided in the repositories. However, something confuses me: if one uses Docker on a RPi with Ubuntu 18.04 as a guest system, would ffmpeg provided by apt work on such a configuration?

DocMarty84 avatar Aug 01 '19 12:08 DocMarty84

It is implemented in https://github.com/DocMarty84/oomusic/commit/21e40e6c80bedc42c82d4b6b8496ee0542d48edb ('Disable Transcoding')

Capture du 2019-08-01 15-50-36

When the option is activated, transcoding is completely deactivated for both web application of Subsonic API.

Please note that in the final release (target: v2.2.0), this option will displayed only debug mode since it is an advanced configuration. To display it, you'll have to add ?debug in the url: http://<my_host>/web?debug (see the url in the screenshot)

DocMarty84 avatar Aug 01 '19 13:08 DocMarty84

Excellent. I will try it out later today.

On Thu, Aug 1, 2019 at 9:54 AM DocMarty84 [email protected] wrote:

It is implemented in a102f83 https://github.com/DocMarty84/koozic/commit/a102f83324f7c750a3e9c2046e5dfcd0b00e6c94 ('Disable Transcoding')

[image: Capture du 2019-08-01 15-50-36] https://user-images.githubusercontent.com/386952/62298964-57937b80-b474-11e9-98c0-686317054146.png

When the option is activated, transcoding is completely deactivated for both web application of Subsonic API.

Please note that in the final release (target: v2.2.0), this option will displayed only debug mode since it is an advanced configuration. To display it, you'll have to add ?debug in the url: http://<my_host>/web?debug (see the url in the screenshot)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DocMarty84/koozic/issues/27?email_source=notifications&email_token=AAZ6KXUEPXDQBPFGHKSHZ3TQCLTJTA5CNFSM4H5GDK5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3KVQIA#issuecomment-517298208, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ6KXUBKZD5GNOTLKQOYPDQCLTJTANCNFSM4H5GDK5A .

apastuszak avatar Aug 01 '19 14:08 apastuszak

Please note it is not released yet. I expect to release a new beta with this feature by the end of the week.

DocMarty84 avatar Aug 01 '19 14:08 DocMarty84

In that case, I will just wait patiently.

On Thu, Aug 1, 2019 at 10:53 AM DocMarty84 [email protected] wrote:

Please note it is not released yet. I expect to release a new beta with this feature by the end of the week.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DocMarty84/koozic/issues/27?email_source=notifications&email_token=AAZ6KXXJ4JZAQA2ZD4IZXE3QCL2HLA5CNFSM4H5GDK5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3K3OOQ#issuecomment-517322554, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ6KXSEKEUERCBCIZSTW6LQCL2HLANCNFSM4H5GDK5A .

apastuszak avatar Aug 01 '19 14:08 apastuszak

v2.2.0-beta.4 has been released: https://github.com/DocMarty84/koozic/releases/tag/v2.2.0-beta.4

As mentioned earlier, the option appears only in debug mode:

Capture du 2019-08-01 22-43-10

DocMarty84 avatar Aug 01 '19 20:08 DocMarty84

Trying to build this on Raspbian and I am getting this after I run docker-compose build

+ apt-get install -y --no-install-recommends -qq adduser build-essential ffmpeg libtag1-dev lsb-base mediainfo python3-babel python3-chardet python3-dateutil python3-decorator python3-dev python3-docutils python3-feedparser python3-gevent python3-html2text python3-jinja2 python3-libsass python3-lxml python3-mako python3-mock python3-passlib python3-pil python3-pip python3-psutil python3-psycopg2 python3-pydot python3-pyldap python3-pyparsing python3-pypdf2 python3-qrcode python3-reportlab python3-requests python3-setuptools python3-suds python3-tz python3-vatnumber python3-vobject python3-werkzeug python3-wheel python3-xlsxwriter python3-yaml wget E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.3_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/o/openssl/openssl_1.1.1-1ubuntu2.1~18.04.3_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/g/glib2.0/libglib2.0-0_2.56.4-0ubuntu0.18.04.3_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/t/tzdata/tzdata_2019a-0ubuntu0.18.04_all.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/libd/libdrm/libdrm-common_2.4.95-1~18.04.1_all.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/libd/libdrm/libdrm2_2.4.95-1~18.04.1_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/l/linux/linux-libc-dev_4.15.0-54.58_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/w/wavpack/libwavpack1_5.1.0-2ubuntu1.3_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/universe/z/zeromq3/libzmq5_4.2.5-1ubuntu0.1_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/m/mesa/libglapi-mesa_18.2.8-0ubuntu0~18.04.2_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/libd/libdrm/libdrm-amdgpu1_2.4.95-1~18.04.1_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/libd/libdrm/libdrm-etnaviv1_2.4.95-1~18.04.1_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/libd/libdrm/libdrm-freedreno1_2.4.95-1~18.04.1_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/libd/libdrm/libdrm-nouveau2_2.4.95-1~18.04.1_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/libd/libdrm/libdrm-radeon1_2.4.95-1~18.04.1_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/m/mesa/libgl1-mesa-dri_18.2.8-0ubuntu0~18.04.2_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/m/mesa/libglx-mesa0_18.2.8-0ubuntu0~18.04.2_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/o/openldap/libldap-common_2.4.45+dfsg-1ubuntu1.2_all.deb 404 Not Found [IP: 91.189.88.150 80] E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/o/openldap/libldap-2.4-2_2.4.45+dfsg-1ubuntu1.2_armhf.deb 404 Not Found [IP: 91.189.88.150 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? ERROR: Service 'app' failed to build: The command '/bin/sh -c set -x; apt-get install -y --no-install-recommends -qq adduser build-essential ffmpeg libtag1-dev lsb-base mediainfo python3-babel python3-chardet python3-dateutil python3-decorator python3-dev python3-docutils python3-feedparser python3-gevent python3-html2text python3-jinja2 python3-libsass python3-lxml python3-mako python3-mock python3-passlib python3-pil python3-pip python3-psutil python3-psycopg2 python3-pydot python3-pyldap python3-pyparsing python3-pypdf2 python3-qrcode python3-reportlab python3-requests python3-setuptools python3-suds python3-tz python3-vatnumber python3-vobject python3-werkzeug python3-wheel python3-xlsxwriter python3-yaml wget && apt-get clean -qq' returned a non-zero code: 100

apastuszak avatar Aug 03 '19 04:08 apastuszak

Fixed the issue by removing ffmpeg from line 22 of the Dockerfile

apastuszak avatar Aug 03 '19 05:08 apastuszak

This is because apt-get update was not run beforehand, and Docker used the image already built up to this step:

https://github.com/DocMarty84/koozic/blob/053a5f66f638bbe45ea99b916eb61d1af0f07e87/extra/docker/Dockerfile#L17

I'm pretty sure you wouldn't have had the issue if the Docker image cache was cleared. By removing the ffmpeg line, Docker re-used a previously built image.

It should be solved in https://github.com/DocMarty84/koozic/commit/b029a307dce800153f23e119cd13613a3cca500b

By the way, how does the no-transcoding feature works?

Note: by installing FFMpeg through apt, the right ffmpeg binary should be used. In the package description, the armhf version seems available, so transcoding should work on the RPi (but probably slow as hell).

DocMarty84 avatar Aug 03 '19 08:08 DocMarty84

On desktop it works great. I'll be testing Subsonic shortly.

On Sat, Aug 3, 2019 at 4:07 AM DocMarty84 [email protected] wrote:

This is because apt-get update was not run beforehand, and Docker used the image already built up to this step:

https://github.com/DocMarty84/koozic/blob/053a5f66f638bbe45ea99b916eb61d1af0f07e87/extra/docker/Dockerfile#L17

I'm pretty sure you wouldn't have had the issue if the Docker image cache was cleared. By removing the ffmpeg line, Docker re-used a previously built image.

It should be solved in b029a30 https://github.com/DocMarty84/koozic/commit/b029a307dce800153f23e119cd13613a3cca500b

By the way, how does the no-transcoding feature works?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DocMarty84/koozic/issues/27?email_source=notifications&email_token=AAZ6KXWSXGL3PDPY2UMZ7GTQCU4EXA5CNFSM4H5GDK5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PJT4A#issuecomment-517904880, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ6KXUOXDLVO2HRGXBC6V3QCU4EXANCNFSM4H5GDK5A .

apastuszak avatar Aug 03 '19 13:08 apastuszak

Subsonic is not working. I tried both AVsub and PlaySub on iOS. AVSub tells me an unknown error occrued and PlaySub pulls down the artist list and then says the server is offline.

apastuszak avatar Aug 03 '19 17:08 apastuszak

A log is needed then.

  • Stop the container: docker-compose stop
  • Modify the entrypoint.sh file to record the logs on a file (logfile and log-level):
# Start koozic
su - koozic -c "/usr/local/koozic/odoo-bin \
                --workers=4 \
                --limit-time-cpu=1800 \
                --limit-time-real=3600 \
                -d koozic-v2 \
                --db-filter=koozic-v2 \
                --db_host=db \
                --db_port=5432 \
                --db_user=koozic \
                --db_password=koozic \
                --without-demo=all \
                --no-database-list \
		--logfile /home/koozic/.local/koozic.log \
                --log-level=info"
  • Rebuild and start: docker-compose up --build
  • Retrieve the container ID: docker ps -a, e.g. abc123 (name: koozic_app:latest)
  • Connect to it: docker exec -ti abc123 /bin/bash
  • Get the log: tail -f /home/koozic/.local/koozic.log

Thanks!

DocMarty84 avatar Aug 03 '19 19:08 DocMarty84