Skip to content
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

Add Apple Silicon Support #356

Open
kokroo opened this issue Aug 31, 2023 · 14 comments
Open

Add Apple Silicon Support #356

kokroo opened this issue Aug 31, 2023 · 14 comments

Comments

@kokroo
Copy link

kokroo commented Aug 31, 2023

https://www.reddit.com/r/Stremio/comments/15gijoq/stremio_for_apple_silicon_m1_m2_etc/

@_pajarito was able to compile Stremio for Apple Silicon, and I think we can do the same. One thing to note here is that it will save a lot of battery life, but we should also make sure that hardware video decoding is enabled. That will be the biggest battery life saver.

@zisra
Copy link

zisra commented Sep 25, 2023

yes it's really laggy on my m2 laptop

@kokroo
Copy link
Author

kokroo commented Sep 25, 2023

yes it's really laggy on my m2 laptop

It's laggy and also consumes too much battery. HDR content plays but the HDR effect is not present. I'm not complaining though, it's open source and free, this is just a humble request to the project developers.

@TRtomasz
Copy link
Member

TRtomasz commented Sep 25, 2023

What do you mean by laggy? I had M1 macbook pro for almost 3 years now and there is nothing 'laggy' it plays 4k content without issues. Be sure to enable hw accelerated decoding in the settings.

@kokroo
Copy link
Author

kokroo commented Sep 25, 2023

What do you mean by laggy? I had M1 macbook pro for almost 3 years now and there is nothing 'laggy' it plays 4k content without issues. Be sure to enable hw accelerated decoding in the settings.

I have the M1 Pro and it does lag sometimes. Hardware acceleration is on but it's not really supported on macOS including HDR. That toggle doesn't change anything, try for yourself. And this application is a battery hog, no doubt.

@zisra
Copy link

zisra commented Sep 25, 2023

What do you mean by laggy? I had M1 macbook pro for almost 3 years now and there is nothing 'laggy' it plays 4k content without issues. Be sure to enable hw accelerated decoding in the settings.

I can drop a recording some other time, but pressing every button has significant delay and animations are choppy

@edde746
Copy link

edde746 commented Oct 19, 2023

Seems like the main issue preventing a build for arm64 is libmpv, which wouldn't be an issue if Stremio wasn't using 6 year old binaries of it. As said in #326, switching to meson would make it significantly easier to manage cross-platform builds.

@HVR88
Copy link

HVR88 commented Aug 27, 2024

I thought this had to be a joke. 4 years Apple Silicon has been available. Even MS is going full-steam ahead with ARM on Windows now.

@sanskar350
Copy link

+1 for Apple silicon please. Normal version takes up a lot of CPU/Memory usage and is not battery efficient + it lags sometimes. It is usable but not a very good exp.

@zavan
Copy link

zavan commented Nov 16, 2024

Instructions to build from source for Apple Silicon (requires git, homebrew and Xcode CLI Tools):

  1. Install and link the dependencies:
brew install mpv ffmpeg node cmake qt@5 openssl
brew install --cask qt-creator
brew link openssl --force
brew link qt5 --force
  1. Clone the repo and enter the directory:
git clone --recursive https://github.com/Stremio/stremio-shell.git
cd stremio-shell
  1. Make the following changes to ./CMakeLists.txt and ./mac/finalize.sh:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 047d5c0..5849ac2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,10 +44,10 @@ endif()
 if(APPLE)
   list(APPEND SOURCES images/stremio.icns)
   set_source_files_properties(images/stremio.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
-  set(MPV_LIBRARY_mpv ${CMAKE_CURRENT_SOURCE_DIR}/deps/lib/libmpv.dylib)
+  set(MPV_LIBRARY_mpv /opt/homebrew/opt/mpv/lib/libmpv.dylib)
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,@executable_path/../Frameworks")
   add_definitions("-pipe")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -arch x86_64")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -arch arm64")
   set(ENV{OPENSSL_ROOT_DIR} $ENV{OPENSSL_BIN_PATH})
 endif()
diff --git a/mac/finalize.sh b/mac/finalize.sh
old mode 100755
new mode 100644
index bd2e312..b23ca43
--- a/mac/finalize.sh
+++ b/mac/finalize.sh
@@ -6,20 +6,14 @@ TAG=${1:-master}
 
 DEST_DIR=./stremio.app/Contents/MacOS
 
-cp ./mac/ffmpeg $DEST_DIR/
-cp ./mac/ffprobe $DEST_DIR/
-cp $(which node) $DEST_DIR/
+cp -f $(which ffmpeg) $DEST_DIR/
+cp -f $(which ffprobe) $DEST_DIR/
+cp -f $(which node) $DEST_DIR/
 chmod +w $DEST_DIR/ffmpeg
 chmod +w $DEST_DIR/ffprobe
 chmod +w $DEST_DIR/node
 
 mkdir -p ./stremio.app/Contents/Frameworks
-cp ./deps/libmpv/mac/lib/*.dylib ./stremio.app/Contents/Frameworks/
-
-# https://bugreports.qt.io/browse/QTBUG-57265
-# you don't want to be using always-overwrite in any version until Qt 5.11.3
-macdeployqt ./stremio.app -executable=./stremio.app/Contents/MacOS/ffmpeg -executable=./stremio.app/Contents/MacOS/ffprobe -executable=./stremio.app/Contents/MacOS/node
 
 SHELL_VERSION=$(git grep -hoP '^\s*VERSION\s*=\s*\K.*$' HEAD -- stremio.pro)
 curl $(cat ./server-url.txt) > $DEST_DIR/server.js
-# ./mac/fix_osx_deps.sh "./stremio.app/Contents/Frameworks" "@executable_path/../Frameworks"
  1. Config, build and pack:
qmake CONFIG+=sdk_no_version_check
cmake -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@5 .
cmake --build .
chmod +x ./mac/finalize.sh && ./mac/finalize.sh
chmod +x ./mac/pack.sh && ./mac/pack.sh
  1. It will build Stremio 4.4.168.dmg in the directory, run it to install. Don't forget to enable hardware acceleration in Stremio settings.

This worked on my M4 Pro with macOS Sequoia, hopefully it works for someone else too.

Many thanks to everyone in this thread: https://www.reddit.com/r/Stremio/comments/15gijoq/stremio_for_apple_silicon_m1_m2_etc/

@TRtomasz
Copy link
Member

@zavan what node version are you using?

@zavan
Copy link

zavan commented Nov 19, 2024

@zavan what node version are you using?

node -v
v22.11.0

I already had it installed via asdf.

@TRtomasz
Copy link
Member

thanks @zavan now latest one is 23 and it breaks dmg building, perhaps due some outdated function used

@zavan
Copy link

zavan commented Nov 20, 2024

thanks @zavan now latest one is 23 and it breaks dmg building, perhaps due some outdated function used

Ah. In any case, I think the project should stick to the latest LTS version, which is v22. This helps minimize breaking changes.

@apotenza92
Copy link

Not sure if this will help anyone but I've used this successfully to get it working natively:
https://github.com/erfansamandarian/stremio-mac

@Stremio Stremio deleted a comment from maxoliinyk Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants