popcorn-desktop icon indicating copy to clipboard operation
popcorn-desktop copied to clipboard

Fix proprietary audio codec support for the new NW.js version

Open pcenta opened this issue 3 years ago • 56 comments

Is your feature request related to a problem? Please describe. Not related to a problem but the project is using outdated version.

Describe the idea you'd like App loads NWjs from https://get.popcorntime.app/repo/nw/. First step would be to upload newer version to allow easier testing than manually tricking app on local build.

Describe alternatives you've considered We can stay on existing version?

Additional context NWjs link https://nwjs.io/

pcenta avatar Mar 16 '21 23:03 pcenta

Locally I tried it with v0.52.0 and I've tested some basic functionalities and haven't found anything broken. Since our current version works there's no hurry to do this but I think that there are some benefits (recent memory usage optimizations). Even though this is almost 10 releases newer I don't think that there will be any serious issues with it. Majority of those releases are only bumped versions of Chromium and Node and I don't think that any of them recently deprecated or removed anything PT uses.

If you could tag this as a Feature would be great. Could you upload new NWjs SDK too? Anyone can do this but it would be easier if anyone deletes their cache folders. From there it's all about changing version defined in one of the source files.

pcenta avatar Mar 19 '21 10:03 pcenta

Hello, I am curious about how you made https://nwjs.io/ work in PT. I tried to use the following patch for gulpfile.js :

--- src/popcorn-desktop/gulpfile.js     2021-04-13 12:28:56.098245263 +0200
+++ gulpfile.js 2021-04-13 12:27:57.132266951 +0200
@@ -142,8 +142,7 @@
   macIcns: './src/app/images/butter.icns',
   version: nwVersion,
   flavor: nwFlavor,
-  manifestUrl: 'https://popcorntime.app/version.json',
-  downloadUrl: 'https://get.popcorntime.app/repo/nw/',
+  downloadUrl: 'https://dl.nwjs.io/',
   platforms: parsePlatforms()
 }).on('log', console.log);

PT successfully builds but do not launch (no clear log is output). I tested 0.44.5, 0.52.0 and 0.52.2 and none of them worked. How did you do that ?

Thanks for reading

Edit : from what I understand, I have to include support at compile time for various proprietary codecs in NWJS. Still, it is unclear to me what steps I have to setup for a complete compile script.

Ouack23 avatar Apr 13 '21 13:04 Ouack23

Hello, I am curious about how you made https://nwjs.io/ work in PT. I tried to use the following patch for gulpfile.js :

--- src/popcorn-desktop/gulpfile.js     2021-04-13 12:28:56.098245263 +0200
+++ gulpfile.js 2021-04-13 12:27:57.132266951 +0200
@@ -142,8 +142,7 @@
   macIcns: './src/app/images/butter.icns',
   version: nwVersion,
   flavor: nwFlavor,
-  manifestUrl: 'https://popcorntime.app/version.json',
-  downloadUrl: 'https://get.popcorntime.app/repo/nw/',
+  downloadUrl: 'https://dl.nwjs.io/',
   platforms: parsePlatforms()
 }).on('log', console.log);

PT successfully builds but do not launch (no clear log is output). I tested 0.44.5, 0.52.0 and 0.52.2 and none of them worked. How did you do that ?

Thanks for reading

Edit : from what I understand, I have to include support at compile time for various proprietary codecs in NWJS. Still, it is unclear to me what steps I have to setup for a complete compile script.

What've done is a bit different. I manually downloaded NWjs SDK and put it into my cache folder since I wanted minimal change in actual code. Also version that worked for me was 0.52.0, it might be that there were some additional changes in other versions that broke something?

pcenta avatar Apr 14 '21 22:04 pcenta

I removed those two lines without providing new downloadUrl.

--- src/popcorn-desktop/gulpfile.js     2021-04-13 12:28:56.098245263 +0200
+++ gulpfile.js 2021-04-13 12:27:57.132266951 +0200
@@ -142,8 +142,7 @@
   macIcns: './src/app/images/butter.icns',
   version: nwVersion,
   flavor: nwFlavor,
-  manifestUrl: 'https://popcorntime.app/version.json',
-  downloadUrl: 'https://get.popcorntime.app/repo/nw/',
   platforms: parsePlatforms()
 }).on('log', console.log);

The build fallback to download by itself, seem nwjs-sdk-v0.44.5 works perfectly.

Create cache folder in ~/Projects/popcorn-official/popcorn-desktop/cache/0.44.5-sdk
Downloading: https://dl.nwjs.io/v0.44.5/nwjs-sdk-v0.44.5-osx-x64.zip

chengsokdara avatar Apr 25 '21 08:04 chengsokdara

Thanks it works.

I have problems accessing https://get.popcorntime.app/repo/nw/ is this domain down or is it just blocked by my ISP?

I removed those two lines without providing new downloadUrl.

--- src/popcorn-desktop/gulpfile.js     2021-04-13 12:28:56.098245263 +0200
+++ gulpfile.js 2021-04-13 12:27:57.132266951 +0200
@@ -142,8 +142,7 @@
   macIcns: './src/app/images/butter.icns',
   version: nwVersion,
   flavor: nwFlavor,
-  manifestUrl: 'https://popcorntime.app/version.json',
-  downloadUrl: 'https://get.popcorntime.app/repo/nw/',
   platforms: parsePlatforms()
 }).on('log', console.log);

The build fallback to download by itself, seem nwjs-sdk-v0.44.5 works perfectly.

Create cache folder in ~/Projects/popcorn-official/popcorn-desktop/cache/0.44.5-sdk
Downloading: https://dl.nwjs.io/v0.44.5/nwjs-sdk-v0.44.5-osx-x64.zip

memarko avatar Apr 25 '21 16:04 memarko

@memarko domain is down if you use https://dl.nwjs.io you get version without proprietary codecs i also save copy of 0.44.5

manifestUrl: 'http://popcorn-ru.tk/version.json', downloadUrl: 'http://popcorn-ru.tk/nw/',

ivan1986 avatar Apr 25 '21 16:04 ivan1986

@memarko domain is down if you use https://dl.nwjs.io you get version without proprietary codecs i also save copy of 0.44.5

manifestUrl: 'http://popcorn-ru.tk/version.json', downloadUrl: 'http://popcorn-ru.tk/nw/',

Is this reliable or secure?

isaamos avatar Jun 06 '21 21:06 isaamos

@isaamos it's safe

ivan1986 avatar Jun 06 '21 21:06 ivan1986

@memarko domain is down if you use https://dl.nwjs.io you get version without proprietary codecs i also save copy of 0.44.5

manifestUrl: 'http://popcorn-ru.tk/version.json', downloadUrl: 'http://popcorn-ru.tk/nw/',

FFmpeg can be added manually to SDK or SDK itself can be built with included codec (it's an option if you build NWjs manually). So this means we can download NWjs from https://nwjs.io/downloads/ and add prebuilt FFmpeg codec from https://github.com/iteufel/nwjs-ffmpeg-prebuilt. I've tested it locally with NWjs 54.1 and prebuilt FFmpeg for 54.

Can someone else test this and report if there are any issues/benefits with newer version of Chromium?

pcenta avatar Jul 22 '21 19:07 pcenta

For me build with external ffmpeg not work - many films without sound @team-pct said that he has a build script and https://github.com/iteufel/nwjs-ffmpeg-prebuilt has not codecs i try to add codecs - it's some better, but not so good https://github.com/popcorn-time-ru/nwjs-ffmpeg-prebuilt/tree/codecs

ivan1986 avatar Jul 22 '21 19:07 ivan1986

i commit current build script to https://github.com/popcorn-time-ru/nwjs-build it build nwjs with codecs, but some incorrect flags eac3 (a52) audio not working and avi files not play

for build full nwjs need about 60gb space and it work about week on oracle free vm somebody have ideas what i do wrong?

ivan1986 avatar Oct 02 '21 20:10 ivan1986

I removed those two lines without providing new downloadUrl.

--- src/popcorn-desktop/gulpfile.js     2021-04-13 12:28:56.098245263 +0200
+++ gulpfile.js 2021-04-13 12:27:57.132266951 +0200
@@ -142,8 +142,7 @@
   macIcns: './src/app/images/butter.icns',
   version: nwVersion,
   flavor: nwFlavor,
-  manifestUrl: 'https://popcorntime.app/version.json',
-  downloadUrl: 'https://get.popcorntime.app/repo/nw/',
   platforms: parsePlatforms()
 }).on('log', console.log);

The build fallback to download by itself, seem nwjs-sdk-v0.44.5 works perfectly.

Create cache folder in ~/Projects/popcorn-official/popcorn-desktop/cache/0.44.5-sdk
Downloading: https://dl.nwjs.io/v0.44.5/nwjs-sdk-v0.44.5-osx-x64.zip

How did you download it on mac? Its not opening for me

Kief5555 avatar Nov 20 '21 19:11 Kief5555

Locally I tried it with v0.52.0 and I've tested some basic functionalities and haven't found anything broken. Since our current version works there's no hurry to do this but I think that there are some benefits (recent memory usage optimizations). Even though this is almost 10 releases newer I don't think that there will be any serious issues with it. Majority of those releases are only bumped versions of Chromium and Node and I don't think that any of them recently deprecated or removed anything PT uses.

If you could tag this as a Feature would be great. Could you upload new NWjs SDK too? Anyone can do this but it would be easier if anyone deletes their cache folders. From there it's all about changing version defined in one of the source files.

How did you test?

Kief5555 avatar Dec 08 '21 03:12 Kief5555

I removed those two lines without providing new downloadUrl.

--- src/popcorn-desktop/gulpfile.js     2021-04-13 12:28:56.098245263 +0200
+++ gulpfile.js 2021-04-13 12:27:57.132266951 +0200
@@ -142,8 +142,7 @@
   macIcns: './src/app/images/butter.icns',
   version: nwVersion,
   flavor: nwFlavor,
-  manifestUrl: 'https://popcorntime.app/version.json',
-  downloadUrl: 'https://get.popcorntime.app/repo/nw/',
   platforms: parsePlatforms()
 }).on('log', console.log);

The build fallback to download by itself, seem nwjs-sdk-v0.44.5 works perfectly.

Create cache folder in ~/Projects/popcorn-official/popcorn-desktop/cache/0.44.5-sdk
Downloading: https://dl.nwjs.io/v0.44.5/nwjs-sdk-v0.44.5-osx-x64.zip

Can you provide me with a download link to the working version? (I am on mac)

Kief5555 avatar Dec 08 '21 03:12 Kief5555

@Kief5555 An easy way to build without installing any build tools or libraries or having to learn anything is to just fork the dev branch, enable 'Actions' in your branch, open gulpfile.js for edit, remove those two lines about the custom nwjs above and save the file. A new commit should have been merged and new builds for all OSes should start building in the Actions page, wait about 15 minutes and download the macOS one once its done.

(mentioning this so you dont have to rely on someone else for builds every time there is an update if you are going to try using the latest nwjs version without codecs)

Hey, I did it a different way. I bumped the NWJS version to 0.55 in gulpfile.js then removed the 2 lines where it takes downloads from. I built it using instructions in readme, but did not start. Then I downloaded Ivan's audio fixed and put it in builds then ran it. Ran just fine on Monterey.

0.55 Nwjs downloaded into my cache

Kief5555 avatar Dec 09 '21 20:12 Kief5555

https://youtu.be/3IZid6lBMJM I have a fix, you can watch from the link.

Kief5555 avatar Dec 30 '21 21:12 Kief5555

@Kief5555 you write this 5 times try to read thread it's not work - many videos have not sound

ivan1986 avatar Dec 31 '21 10:12 ivan1986

@Kief5555 you write this 5 times try to read thread it's not work - many videos have not sound

some videos do, wont they have sound if they have the codecs?

Kief5555 avatar Dec 31 '21 22:12 Kief5555

@Kief5555 need rebuild full nwjs with enable codecs patch i try to do this - https://github.com/popcorn-official/popcorn-desktop/issues/2062#issuecomment-932817059 it works better, and play many films with sound, but ac3 audio not work, some icorrct flags if you want - try to build and test this on your mac - it will be more useful than a video that can be replaced with a couple of paragraphs of text

ivan1986 avatar Dec 31 '21 23:12 ivan1986

@ivan1986 Do you have the link to downloaded these codecs?

Kief5555 avatar Jan 06 '22 23:01 Kief5555

what link? this codecs is part of ffmpeg, need compile this with enable codecs https://github.com/popcorn-time-ru/nwjs-build/blob/master/build_linux64.sh#L73-L108 i apply patch after download sources

ivan1986 avatar Jan 07 '22 01:01 ivan1986

@ivan1986 Can we work these steps into the Homebrew Cask if they produce a working build on the latest macOS…?

danielbayley avatar Jan 07 '22 11:01 danielbayley

@danielbayley Need build last nwjs with patches for all systems, for latest mac, win and linux - not need use homebrew for it, it's installer. I try build by this manual https://docs.nwjs.io/en/latest/For%20Developers/Building%20NW.js/ https://docs.nwjs.io/en/latest/For%20Developers/Enable%20Proprietary%20Codecs/

ivan1986 avatar Jan 07 '22 12:01 ivan1986

@pcenta @ivan1986 @Kief5555 See #2439 where I have tried to address this… It produces a working build for me on macOS 12.2.1, and is based on these steps in the wiki.

danielbayley avatar Feb 22 '22 02:02 danielbayley

@pcenta @ivan1986 @Kief5555 See #2439 where I have tried to address this… It produces a working build for me on macOS 12.2.1, and is based on these steps in the wiki.

I will update the wiki when audio fix is ready. For now, only some (very little) movies/shows have working audio

Kief5555 avatar Feb 24 '22 19:02 Kief5555

@pcenta @ivan1986 @Kief5555 See #2439 where I have tried to address this… It produces a working build for me on macOS 12.2.1, and is based on these steps in the wiki.

I will update the wiki when audio fix is ready. For now, only some (very little) movies/shows have working audio

@Kief5555 Ok cool, ping me when you have it, and I can finish #2439…

danielbayley avatar Mar 02 '22 13:03 danielbayley

👋 It was suggested that I discuss in this thread a (now closed) PR I made for popcorn-desktop, which combined with one for nw-builder, I was able to compile and run popcorn-desktop natively on a M1 mac. Maybe something to include in this work around nwjs?

ghost avatar Mar 04 '22 02:03 ghost

@berard you should contribute so that it will run on M1 Mac.

Ge0rges avatar Mar 10 '22 06:03 Ge0rges

Hmm... nwjs 0.55.0 seems to lag my mac quite a bit, just realized. Espcially when downloading. Having high cpu jumps with only chromium and discord running in the backround (which together only around 7% cpu), around 70% cpu is being used with popcorn time.

Device: 2012 MBP Retina 15". Intel i7 2.3 ghz 8GB ram. One of my gpus has a mosfet failure but I am running intel gpu.

Kief5555 avatar Mar 11 '22 20:03 Kief5555

@Ge0rges it is working natively on M1 here: https://github.com/berard/popcorn-desktop

ghost avatar Mar 16 '22 21:03 ghost