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

Possible to set user agent? Raspberry pi support #12

Closed
owenthewizard opened this issue Mar 26, 2018 · 29 comments
Closed

Possible to set user agent? Raspberry pi support #12

owenthewizard opened this issue Mar 26, 2018 · 29 comments
Projects

Comments

@owenthewizard
Copy link
Contributor

Is it possible to set the user agent? For example to be able to use this to watch Netflix on the Raspberry Pi.

@gort818
Copy link
Owner

gort818 commented Mar 27, 2018

You can, but just curious why would you need to?

@gort818
Copy link
Owner

gort818 commented Mar 27, 2018

You can set the user agent by adding this lines in mainwindow.cpp

//QString UserAgent = "user agent goes here";
//this->webview->page()->profile()->setHttpUserAgent(UserAgent);

@omni6
Copy link
Contributor

omni6 commented Mar 27, 2018

i think it should work if you simply run:
netflix -user-agent="Mozilla/5.0 (X11; CrOS armv7l 6946.86.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.91 Safari/537.36"

user agent for chromeos (you know that you will need the widevine libs from the chrome recovery image to get it work on arm platforms?)

@owenthewizard
Copy link
Contributor Author

owenthewizard commented Mar 27, 2018

@omni6 Didn't work, according to this tool; @gort818's method worked.

@gort818
Copy link
Owner

gort818 commented Mar 27, 2018

@owenthewizard I am glad it worked, just curious is there a specific reason you need to set the user agent. If it is really needed I can add a way to change it.

@owenthewizard
Copy link
Contributor Author

@gort818 Playing Netflix on the Raspberry Pi requires the user agent to be spoofed, as per @omni6's comment.

@gort818
Copy link
Owner

gort818 commented Mar 27, 2018

@owenthewizard Ok did not know that.. I might be able to add something that checks if you are running raspberry pi and and set it to chromeos.. what do you think? would that make it easier?

@owenthewizard
Copy link
Contributor Author

@gort818 That would be nice, I was going to do that in my fork but you could probably do it better as I don't have experience with Qt.

@gort818 gort818 reopened this Mar 28, 2018
@gort818
Copy link
Owner

gort818 commented Mar 28, 2018

Ok I will leave this open.. I might have it done today

@gort818
Copy link
Owner

gort818 commented Mar 30, 2018

@owenthewizard ok I just updated it can you give it a go and see if it works?

@owenthewizard
Copy link
Contributor Author

@gort818 What version of chromium-widevine should I extract widevine from (if it matters)? Alternatively, where can I find a download of 61.0.3163.140? Debian and Arch don't seem to have it anymore.

@omni6
Copy link
Contributor

omni6 commented Mar 31, 2018

Download for arm? No way afaik. A while ago i commented this https://archlinuxarm.org/forum/viewtopic.php?f=47&t=11600#p56272
but the .deb package dissapeared.
You can try something like this:
https://forum.vivaldi.net/topic/23226/widevine-and-flash-for-vivaldi-on-arm-spotify-and-tidal-access
https://help.vivaldi.com/article/raspberry-pi/

But generally you have to extract this two files out of the chros-recovery into this directory:

/usr/lib/qt/plugins/ppapi/libwidevinecdm.so
/usr/lib/qt/plugins/ppapi/libwidevinecdmadapter.so

@owenthewizard
Copy link
Contributor Author

Extracting the widevine libraries from @kusti8's package was a success!

Tested on Arch Linux ARM, Netflix works as expected, however the resolution and framerate are nothing to write home about. I suspect this is because ffmpeg on Arch Linux ARM was not compiled with the the MMAL-accelerated h264 codecs. I will recompile ffmpeg and report back.

@gort818
Copy link
Owner

gort818 commented Mar 31, 2018

O nice! at least we got it going! Did my fix for the Useragent work as intended?

@owenthewizard
Copy link
Contributor Author

@gort818 Indeed! I saw the user agent change and 1080p unlocker on stdout.

@owenthewizard
Copy link
Contributor Author

Recompiling ffmpeg didn't make much of a difference that I could tell, maybe the Arch Linux ARM Qt5-webengine package doesn't use system-ffmpeg? Although I think it would as it does in upstream Arch.

@gort818
Copy link
Owner

gort818 commented Apr 2, 2018

I wish I had an extra raspberry pi but there are all busy as headless servers. I wonder if streaming at 1080p it bogging down the cpu.. check your cpu temps when streaming it might be throttling.

@gort818
Copy link
Owner

gort818 commented Apr 3, 2018

@owenthewizard what model pi do you have?
Also if you have a time could you do a quick how you got it running on your pi, I would like to add it to the readme for other users.

@omni6
Copy link
Contributor

omni6 commented Apr 3, 2018

You're sure that qt5-webengine uses hardware acceleleration (egl)? Had problems to get this work on my odroids but i know that compatiblity is better with raspi. Does it play youtube in hd & fullscreen flawless?

@omni6
Copy link
Contributor

omni6 commented Apr 3, 2018

@owenthewizard
can you test this?

pkgname=qt5-webengine-widevine-rpi
pkgver=56.0.2924.84
pkgrel=1
pkgdesc="Widevine libs for rpi"
arch=('armv7h' 'armv6h')
url="https://github.com/kusti8/chromium-build"
license=('custom:proprietary')
provides=('qt5-webengine-widevine')
depends=('qt5-webengine')
makedepends=('binutils')
source=("${url}/releases/download/netflix-1.0.0/chromium-browser_${pkgver}-0ubuntu0.14.04.1.1011.deb")
md5sums=('94504ef46346ecd1260cd590b38d8914')

prepare() {

   tar -xf data.tar.xz
      
}


package() {


  install -Dm644  ${srcdir}/usr/lib/chromium-browser/libwidevinecdm.so ${pkgdir}/usr/lib/qt/plugins/ppapi/libwidevinecdm.so
  install -Dm644  ${srcdir}/usr/lib/chromium-browser/libwidevinecdmadapter.so ${pkgdir}/usr/lib/qt/plugins/ppapi/libwidevinecdmadapter.so
}

don't forget:
qtwebflix --register-pepper-plugins="/usr/lib/qt/plugins/ppapi/libwidevinecdmadapter.so; application/x-ppapi-widevine-cdm

@gort818 gort818 changed the title Possible to set user agent? Possible to set user agent? Raspberry pi support Apr 3, 2018
@owenthewizard
Copy link
Contributor Author

@gort818 I have a Raspberry Pi 3 Model B. Basically I just cloned and built qtwebflix, then extracted the widevine libraries from @kusti8's chromium build.

@omni6 I don't think it's using hardware acceleration because Netflix was much smoother on my Raspbian card, not to mention being in 1080p. I can use the PKGBUILD you provided but I don't see how it is any different than what I did manually. Netflix worked without registering the plugins, do they need to be registered if they're in /usr/lib/qt/plugins/ppapi/?

I'm planning on doing some more testing this weekend. @gort818 is it possible that hardware acceleration is disabled in qtwebflix? I don't know about the internals of qtwebengine but chromium disables hardware acceleration by default on Linux iirc and needs --ignore-gpu-blacklist to override it.

@omni6
Copy link
Contributor

omni6 commented Apr 4, 2018

I can use the PKGBUILD you provided but I don't see how it is any different than what I did manually.

no it is fine if you can do it manually, but if qtwebflix ofiicially support rpi there should be IMO a simple solution to get widevine work.

and needs --ignore-gpu-blacklist to override it.

and --use-gl=egl ?

@gort818
Copy link
Owner

gort818 commented Apr 7, 2018

@owenthewizard this is with --ignore-gpu-blacklist --enable-gpu-rasterization
screenshot_2018-04-07_16-18-13

And with out
screenshot_2018-04-07_16-19-38

Can you give that a try and let me know.

Also try

--enable-native-gpu-memory-buffers

To check the settings add this in the providers file for easy access.

gpu=chrome://gpu

@owenthewizard
Copy link
Contributor Author

owenthewizard commented Apr 10, 2018

Wow I'm an idiot... Netflix runs perfectly smooth with --ignore-gpu-blacklist... I somehow forgot I needed that...

Anyway, attached are screenshots of chrome://gpu with --ignore-gpu-blacklist, --use-gl=egl, --enable-gpu-rasterization, and --enable-native-gpu-memory-buffers. However I would only recommend using --ignore-gpu-blacklist because enabling the last two cause intermittent issues (e.g. black screen) in Netflix. --use-gl=egl didn't seem to have an effect.

@omni6 The PKGBUILD works as expected, but I think you can drop binutils from the makedepends as it is included in base-devel.

Apologies for the 720p screenshots, I'll be able to test on a 1080p screen tomorrow (at the earliest).

screenshot1
screenshot2
screenshot3
screenshot4
screenshot5

Edit: I think it is safe to say that the Raspberry Pi is now a supported platform.

@gort818
Copy link
Owner

gort818 commented Apr 12, 2018

@owenthewizard awesome glad it is working!
@omni6 How would we go about making your PKGBUILD a dependency for arm users?

@omni6
Copy link
Contributor

omni6 commented Apr 12, 2018

Basically it is already a dependency for qtwebflix. This pkgbuild provides=('qt5-webengine-widevine') what is a dependency for qtwebflix. x86_64 users have to take widevine from aur, arm users can use the pkgbuild.
But you could update the readme.md and provide the link for arm users.

build requires base-devel group to be installed

mkdir qt5-webengine-widevine-rpi && cd qt5-webengine-widevine-rpi
wget https://gist.githubusercontent.com/omni6/e557af6a67a41343aa859816d0113ced/raw/0c4d4f09cdb295ba47e5022adab4813766262f46/PKGBUILD

makepkg -csi

@owenthewizard raspi 3 is aarch64, right? Tested on my 64-bit odroid and this doesn't work but on your raspi everything was fine... i ask because then i should add aarch64 as architecture...

@owenthewizard
Copy link
Contributor Author

@omni6 Raspberry Pi 3 technically supports aarch64 but upstream only provides support for aarch32. I used a Raspberry Pi 2 Arch Linux ARM tarball to install (armv7). I am planning on testing aarch64 soon (tm), as according to the Gentoo Wiki video hardware acceleration works under aarch64.

@gort818 gort818 moved this from In progress to Done in release 0.2 Dec 9, 2018
@gort818
Copy link
Owner

gort818 commented Dec 9, 2018

@owenthewizard
there are some new options you can now set useragent from the commandline.

Usage: qtwebflix [options]
Qtwebflix Help 

 To Control playback rate :
 CTRL + W = speed up 
 CTRL + S = slow down 
 CTRL + R = reset to defualt


Options:
  -h, --help                   Displays this help.
  -v, --version                Displays version information.
  -p, --provider <provider>    Set content provider eg. netflix.com
  -u, --useragent <useragent>  change useragent eg. "Mozilla/5.0 (X11; Linux
                               x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants