lumsdot
Posts: 121
Joined: Wed Mar 11, 2015 5:29 pm

Fullscreen hi res Youtube on PIXEL mod

Sat Oct 15, 2016 12:59 pm

This allows you to watch youtube videos in hi res in full screen , using chromium or any other browser.
It works as follows, you open chromium (or any browser) and browse to youtube, you copy the link of the video you wish to watch (i.e. right click mouse and copy), then you move the mouse to the top Pixel menu bar and click on the new youtube icon, this will launch omxplayer and play you video full screen. Plus you can edit the script and select which default youtube resolution you want your vids to play at. In operation it works well.

sudo apt-get update
sudo apt-get install youtube-dl
sudo apt-get install xsel
sudo apt-get install xdotool

xsel allows scripts to reference the clipboard, youtube-dl get the address of youtube videos and xdotool allows scripts to send key presses, in this case it minimizes chromium

in a terminal now type
sudo nano /home/pi/youtube.sh
then paste

#!/bin/bash
xdotool key ctrl+alt+d
omxplayer -o local "$(youtube-dl -g -f 22 `xsel`)"

then save the new file using ctrl o

the -f 22 is the youtube resolution 720p, you can change this to -f 18 for 360p if needed

now in a terminal type code below, this will make the script executable

sudo chmod +x /home/pi/youtube.sh

you can now test using sh youtube.sh (note you must have a youtube video link copied in the clipboard for it to work)

if the script is working, now you need to create a new icon at the top of the screen to easily launch you new script
now type in a terminal

sudo nano /usr/share/applications/youtube.desktop

and paste

[Desktop Entry]
Name=Youtube
Comment=GUI for omxplayer
Exec=/home/pi/youtube.sh
Icon=video-display
Terminal=true
Type=Application
Categories=Application;Multimedia;Audio;AudioVideo

and save using ctrl o
(i dont know if the icon will only work with pixel, so feel free to try another icon if not using pixel )
sudo chmod +777 /usr/share/applications/youtube.desktop


under the rasberry menu logo under sound and video you should now see a youtube logo and test to make sure it works.
Now if you right click on the top pixel menu and select "Application launch bar setting" you should now be able to add the new youtube icon to the top menu bar, just after the Wolfram icon.

So now if you just copy a youtube video link and click on the new icon at the top of the screen , the video should play full screen.

The keyboard controls for omxplayer are p for pause, q for quit , space unpause, just do a search for omxplayer controls
Last edited by lumsdot on Sat Oct 15, 2016 4:20 pm, edited 1 time in total.

lumsdot
Posts: 121
Joined: Wed Mar 11, 2015 5:29 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sat Oct 15, 2016 1:59 pm

note you can use -f best (instead of -f 22) in the script to get the best youtube resolution available.

-f 22 will default to 720p , not all vids (i.e. older ones) will have a 720p option and will fail

lumsdot
Posts: 121
Joined: Wed Mar 11, 2015 5:29 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sat Oct 15, 2016 5:48 pm

video here of youtube mod in action

https://www.youtube.com/watch?v=3IxEssq_h-A


(had to fake part of it, since my internet connection is so slow i cant play 720p unless I wait for buffer to fill)

User avatar
Trixster
Posts: 261
Joined: Sat Jul 07, 2012 3:53 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 9:53 am

Cool, I like it. it's a good replacement for rpi-youtube (at last until that's back working again).

Is it possible to call OMXPlayerGUI instead so that opens and extracts the stream? That way you'd get a window with controls rather than just a borderless video stream.

HypnoToad
Posts: 68
Joined: Thu Dec 11, 2014 6:00 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 12:00 pm

Hi, is there a recommended setting for GPU memory when running fullscreen videos?

I people running Kodi on the Pi recommend at least 160Mb of GPU memory, is it the same case with fullscreen using OMXplayer? Thanks

gkreidl
Posts: 6002
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 12:45 pm

Trixster wrote:Cool, I like it. it's a good replacement for rpi-youtube (at last until that's back working again).

Is it possible to call OMXPlayerGUI instead so that opens and extracts the stream? That way you'd get a window with controls rather than just a borderless video stream.
Yes. The call to omxplayerGui to show web video is
omxplayergui ytdl URL
(URL = website URL).
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

User avatar
Trixster
Posts: 261
Joined: Sat Jul 07, 2012 3:53 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 1:19 pm

How to edit lumsdot's little script to fire up omxplayergui then?

lumsdot
Posts: 121
Joined: Wed Mar 11, 2015 5:29 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 1:20 pm

Im using 64 meg for my gpu settings and omxplayer seems happy.

As gkreidl says above omxplayergui will work also, but i think you can only get omxplayergui if you do a KWEB install which is a big install. Please correct me if i'm wrong.

lumsdot
Posts: 121
Joined: Wed Mar 11, 2015 5:29 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 1:21 pm

YT_LINK=`xsel`
omxplayergui --preset=default ytdl $YT_LINK


this should make it work with omxplayergui (if you have KWEB installed)

User avatar
Trixster
Posts: 261
Joined: Sat Jul 07, 2012 3:53 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 1:29 pm

Sorry, I'm a bit thick, how exactly would you alter your script?

#!/bin/bash
xdotool key ctrl+alt+d
YT_LINK=`xsel`
omxplayergui --preset=default ytdl $YT_LINK

Like this?

lumsdot
Posts: 121
Joined: Wed Mar 11, 2015 5:29 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 1:33 pm

should work, you will have to test

the xdotool line minimizes chromium, in theory you could take that out , since omxplayergui acts like a normal window

User avatar
Trixster
Posts: 261
Joined: Sat Jul 07, 2012 3:53 pm

Re: Fullscreen hi res Youtube on PIXEL mod

Sun Oct 16, 2016 2:57 pm

Hmm, omxplayergui does not appear to like calling either YT_LINK or xsel, whereas if I just paste in the contents of xsel (the URL) it works fine.

gkreidl
Posts: 6002
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Fullscreen hi res Youtube on PIXEL mod

Mon Oct 17, 2016 9:30 am

Here's another simple solution which adds a button + menu commands to chromium:
viewtopic.php?f=66&t=163018
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

jejjy123
Posts: 1
Joined: Wed May 17, 2017 5:05 pm
Location: india
Contact: Website

Re: Fullscreen hi res Youtube on PIXEL mod

Wed May 17, 2017 5:17 pm

hey, can also the youtube alternative for more videos or options. Can get youtube alternatives here
https://alternativeso.com/youtube

Return to “General discussion”