HOWTO: YouTube on the Raspberry Pi - sans X B-)


165 posts   Page 6 of 7   1 ... 3, 4, 5, 6, 7
by wad67 » Wed Jan 02, 2013 2:39 pm
I am having trouble getting this to work.
When i put into the terminal ~$ yt
it says
bash: ~$: command not found
I followed the previous instructions and they all worked fine.
How can I fix this.
Also my tilde key looks like this ¬ and my "at" key is this: "
Any idea how to fix any of that?
Posts: 3
Joined: Wed Jan 02, 2013 2:29 pm
by gabello » Wed Jan 02, 2013 5:03 pm
First of all thanks for this wonderful piece of software. I manged to install and configure this, however some of the videos (like documentaries) suffer from severe interruptions. I'm guessing this is somehow related with the quality/size of the video (there is not enough bandwidth).

I tried to check the speed with youtube-dl and I get about 250 k/s (see below):

pi@raspberrypi /media/LG_EXT_HDD $ youtube-dl http://www.youtube.com/watch?v=8UtNF-Le2L0
[youtube] Setting language
[youtube] 8UtNF-Le2L0: Downloading video webpage
[youtube] 8UtNF-Le2L0: Downloading video info webpage
[youtube] 8UtNF-Le2L0: Extracting video information
[download] Destination: 8UtNF-Le2L0.mp4
[download] 0.3% of 1.76G at 245.66k/s ETA --:--^C


N.B. http://www.youtube.com/watch?v=8UtNF-Le2L0 is one of the video that do not work well at all.

Questions:

1. Is there a way to decide the quality of the video?
2. Is there a way to increase the buffer? I tried pausing the video and then letting it like this for a few minutes (in order to load more of it), but this does not seem to work.
Posts: 47
Joined: Sun Aug 05, 2012 8:02 pm
by feba » Fri Jan 04, 2013 3:46 pm
Hi,
i'm a new Raspi user.

I've installed all fine, but when i choose a listet video with a number, only a popup like "playing https://www.youtube.com/watch?..... the video don't play. :(

What must i do?

thnx
Feba
Posts: 2
Joined: Sat Aug 04, 2012 10:12 am
by feba » Sat Jan 05, 2013 8:44 am
Here my Traceback errors..

    Traceback (most recent call last):
    File "/usr/local/bin/yt", line 9, in <module>
    load_entry_point('whitey==0.2', 'console_scripts', 'yt')()
    File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 28, in main
    ui.run()
    File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 71, in run
    curses.wrapper(self._curses_main)
    File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
    File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 115, in _curses_main
    self._run_pager()
    File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 242, in _run_pager
    self._play_video(c - ord('1'))
    File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 269, in _play_video
    play_url(url,self._player)
    File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 380, in play_url
    play_url_mplayer(url)
    File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 387, in play_url_mplayer
    stdout = subprocess.PIPE, stderr = subprocess.PIPE)
    File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
    File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
    OSError: [Errno 2] Datei oder Verzeichnis nicht gefunden

What is going wrong?
Posts: 2
Joined: Sat Aug 04, 2012 10:12 am
by DaveCs_Pi » Sat Jan 05, 2013 11:52 am
Whenever I try to install setup.py, I receive an error message saying
Code: Select all
python: Can't open file 'setup.py': [Errno2] No such file or directory


How can I get around this? I followed the instructions to a t!
Posts: 2
Joined: Tue Jan 01, 2013 2:10 am
by Licaon_Kter » Sun Jan 06, 2013 10:01 pm
DaveCs_Pi wrote:Whenever I try to install setup.py, I receive an error message saying
Code: Select all
python: Can't open file 'setup.py': [Errno2] No such file or directory


How can I get around this? I followed the instructions to a t!
are you running sudo python ./setup.py ?
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)
User avatar
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.
by FigNeutron » Thu Jan 10, 2013 1:00 am
feba wrote:Hi,
i'm a new Raspi user.

I've installed all fine, but when i choose a listet video with a number, only a popup like "playing https://www.youtube.com/watch?..... the video don't play. :(

What must i do?

thnx
Feba


I am having the same problem as well......everything is working fine, and OMXPlayer is working fine, but when I select a video, it says "Playing https://youtube....... in a pop-up for about 5 seconds, and then goes back to the search results. Any help would be appreciated. Thanks in advance.

FigNeutron
Posts: 4
Joined: Tue Dec 18, 2012 6:04 pm
by FigNeutron » Thu Jan 10, 2013 9:21 pm
trinigooner wrote:So I've been mostly responding to myself :-) But I found the problem. My version of youtube-dl was wrong. Don't use the version mentioned in the post with the latest version of Raspian. Use this one instead: https://github.com/rg3/youtube-dl/raw/2 ... youtube-dl


For those of you having the problem of no video or audio playback as the only problem (no error messages or anything else) the solution above solved the problem after about 1-2 hours of fiddling around. A worthwhile endeavor nonetheless, and thanks for posting this!

FigNeutron
Posts: 4
Joined: Tue Dec 18, 2012 6:04 pm
by suneclipse » Fri Feb 01, 2013 5:00 pm
DaveCs_Pi wrote:Whenever I try to install setup.py, I receive an error message saying
Code: Select all
python: Can't open file 'setup.py': [Errno2] No such file or directory


How can I get around this? I followed the instructions to a t!


Hi, first you need to go to the directory /whitey-0.* and then run sudo python setup.py install
cheers.
Posts: 2
Joined: Fri Feb 01, 2013 4:43 pm
by rpin00b » Mon Feb 04, 2013 1:46 am
I see that this thread has been dormant for a while, but I'll give it a try - I've done all the steps in here on two different RPis, both yield the same result - in yt, I can get a list of videos but when I try and play one it says it's playing but doesn't do anything. I have no idea! HELLPPPPP!

RPi / Raspbian Wheezy.
Posts: 2
Joined: Mon Feb 04, 2013 1:43 am
by imbadingers » Mon Feb 04, 2013 7:40 pm
gtvfan wrote:Fixed my own problem, apparently a simple sim link from /usr/bin/python to /usr/bin/python2.7 was all that was needed.


What do you mean? Teach me master! :(
Posts: 2
Joined: Mon Feb 04, 2013 7:36 pm
by imbadingers » Mon Feb 04, 2013 10:55 pm
gtvfan wrote:I am currently able to run youtube-dl successfully and launch yt and even search. As soon as I make a selection, I receive this error: RuntimeError: Error getting URL. Any help would be most appreciated, thanks!

[root@pi ~]# yt
Traceback (most recent call last):
File "/usr/bin/yt", line 9, in <module>
load_entry_point('whitey==0.1', 'console_scripts', 'yt')()
File "/usr/lib/python2.7/site-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 16, in main
ui.run()
File "/usr/lib/python2.7/site-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 56, in run
curses.wrapper(self._curses_main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "/usr/lib/python2.7/site-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 100, in _curses_main
self._run_pager()
File "/usr/lib/python2.7/site-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 227, in _run_pager
self._play_video(c - ord('1'))
File "/usr/lib/python2.7/site-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 254, in _play_video
play_url(url)
File "/usr/lib/python2.7/site-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 361, in play_url
raise RuntimeError('Error getting URL.')
RuntimeError: Error getting URL.


Same problem as this one :(, HELP!
Posts: 2
Joined: Mon Feb 04, 2013 7:36 pm
by rpin00b » Mon Feb 04, 2013 11:05 pm
Not that I have it working, but I think my problems relate to the constant morphing of YouTube's inner workings. I am trying to ensure I have the latest youtube-dl, omxplayer and libraries, and yt files.

This tutorial hasn't been updated to reflect a newer version of the Python script:

http://pypi.python.org/packages/source/ ... 0.2.tar.gz

But as i said, what do I know? It doesn't work for me either.
Best,
Chris
Posts: 2
Joined: Mon Feb 04, 2013 1:43 am
by kdoul » Fri Feb 08, 2013 8:20 pm
I cant get it working. I installed youtube-dl with "apt-get install youtube-dl", and replaced the omxplayer I had with the latest testing version. The whitey 0.2 has the option to chose omxplayer without editing the __init__.py ( with yt --player omxplayer). Anyway I think omxplayer is causing the trouble because after playing anything ( video or audio ) the screen goes black in a weird way ( moving mouse cursor or a window around the screen will "clean" the blackness )
User avatar
Posts: 2
Joined: Tue Feb 05, 2013 5:31 pm
by suneclipse » Sat Feb 09, 2013 11:11 am
kdoul wrote:I cant get it working. I installed youtube-dl with "apt-get install youtube-dl", and replaced the omxplayer I had with the latest testing version. The whitey 0.2 has the option to chose omxplayer without editing the __init__.py ( with yt --player omxplayer). Anyway I think omxplayer is causing the trouble because after playing anything ( video or audio ) the screen goes black in a weird way ( moving mouse cursor or a window around the screen will "clean" the blackness )


Hi, I had exactly the same problem, after lots of research I decided to upgrade the firmware raspberry and do the steps once again, I followed the previous instructions and they all worked fine.
https://github.com/Hexxeh/rpi-update

NB: use the __init__.py marktbaldridge file
https://dl.dropbox.com/u/33311875/__init__.py

Cheers
Posts: 2
Joined: Fri Feb 01, 2013 4:43 pm
by kdoul » Sat Feb 09, 2013 10:56 pm
Thanks for the reply suneclipse, but the problem wasnt firmware related.Anyway, I got it working now. The problem seems to be with youtube-dl being out of date. The guide needs to be updated.

@any random reader:
if you cant get it working try this:

Get whitey v0.2 ( latest version for now ):
Code: Select all
wget http://pypi.python.org/packages/source/w/whitey/whitey-0.2.tar.gz
tar -zxvf whitey-0.2.tar.gz


Install youtube-dl with apt :
Code: Select all
sudo apt-get install youtube-dl


Update youtube-dl with:
Code: Select all
youtube-dl -U

Note: You might need to do that multiple times. You are ok when it tells you it is up to date.

Also make sure you have the latest firmware. There is a very useful tool for that called rpi-update.
You can get it here : https://github.com/Hexxeh/rpi-update

Install the latest version of omxplayer, from http://omxplayer.sconde.net/ ( the one currently on raspbian repos is outdated and has issues with sound ).
You can install the currently latest version with :
Code: Select all
wget http://omxplayer.sconde.net/builds/omxplayer_0.2.4~git20130208~5c2f65e3_armhf.deb
sudo dpkg -i omxplayer_0.2.4~git20130208~5c2f65e3_armhf.deb


Note that you don't need to edit __init__.py for whitey v0.2 to get it working with omxplayer. After installation though, you need to type:
Code: Select all
yt --player omxplayer

instead of just yt. Default sound output is hdmi so if you need to get it working with the analog output you still need to edit __init__.py , find and remove:
Code: Select all
, '-o hdmi'

before installing.

P.S. : If you are using the desktop ( aka xwindow ) your screen probably goes black after omxplayer finishes playing anything and you need to move your mouse cursor or a window around the desktop to clear the "blackness". There is an easy way to fix this:

Run :
Code: Select all
sudo apt-get install x11-xserver-utils

to get the xrefresh app

After that edit /usr/bin/omxplayer with
Code: Select all
sudo nano /usr/bin/omxplayer


and add to the END of the file the following:
Code: Select all
xrefresh -display :0

Ctrl+O, Enter, Ctrl+X and you are good to go.

Note: You will need to do this procedure each time you update/install/re-install omxplayer to keep the fix ( unless it gets fixed by the developer at some point ).
Source : https://github.com/huceke/omxplayer/issues/44#issuecomment-12192380

P.S.2: Sorry for the double post above. I posted from RasPi with apt working on the background >.<
User avatar
Posts: 2
Joined: Tue Feb 05, 2013 5:31 pm
by heinz57 » Sun Feb 10, 2013 11:10 pm
billybangleballs wrote:I figured it out, I edited the file /usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py
and changed the line
Code: Select all
['omxplayer', '-ohdmi', url.decode('UTF-8').strip()],
 to
['omxplayer', url.decode('UTF-8').strip()],

Job sorted.


Thanks for your posting! Analog audio works for me as well now, with HDMI!

Thanks for the great posts in this thread!

Cheers
Posts: 1
Joined: Sun Feb 10, 2013 10:27 pm
by dpguest » Fri Feb 22, 2013 7:44 pm
I followed you instructions exactly, I think ... and when I $yt, I get a list of youtube videos. However, when I select a digit, half the screen (with a full screen terminal) is black, and there is no video...

any ideas of what I am missing?

Raspberry Pi B with Rasbain ... latest update and upgrade...

thanks and have a nice day....

David Guest
Posts: 28
Joined: Wed Feb 06, 2013 4:17 pm
by HallonJonas » Mon Feb 25, 2013 4:27 pm
Im sorry but I get these errors when I try to run it :(: Any idea where the problem is?

Code: Select all
pi@raspberrypi / $ yt --player omxplayer
Traceback (most recent call last):
  File "/usr/local/bin/yt", line 9, in <module>
    load_entry_point('whitey==0.2', 'console_scripts', 'yt')()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 16, in main
    ui.run()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 56, in run
    curses.wrapper(self._curses_main)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 99, in _curses_main
    self._update_screen()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 157, in _update_screen
    self._add_table_row(self._help, 0, 0, w-1, self._bar_attr, max_width=16, win=self._help_bar)
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.2-py2.7.egg/yt/__init__.py", line 334, in _add_table_row
    win.addstr(y, x, truncate('%s:%s' % (k,v), min(w-x, cell_w)).encode(self._code), attr)
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2026' in position 12: ordinal not in range(256)
Posts: 5
Joined: Thu Feb 14, 2013 5:34 pm
by argulp » Mon Feb 25, 2013 9:22 pm
Hi

In my case... (same error)
I don't remember clearly but I have mixed some AUR/Archlinux package with other one.

Archlinux provide python 3.3 and 2.7, the 3.3 is the default one,
the python2 executable is a link to python 2 (true !)
and some script need to be modificated to use this python or other one

I have just intalled python2, and youtube-dl was trying to use only python.
After change python to python2 in the first line of youtube-dl file, error has disappear
Maybe it can help
Posts: 1
Joined: Mon Feb 25, 2013 9:17 pm
by CalumJEadie » Sun Mar 17, 2013 11:20 am
I've updated the documentation for yt and raspytube - check out viewtopic.php?f=22&t=37417

Hope that helps!
Posts: 15
Joined: Thu Oct 18, 2012 10:51 pm
by nommo » Sat Mar 30, 2013 9:31 pm
Cor - that was interesting.

Up until recently my YT install worked fine (using the original install, after updating youtube-dl a few times), but I tried to run it today and got:
Code: Select all
pi@raspberrypi ~ $ yt
Traceback (most recent call last):
  File "/usr/local/bin/yt", line 9, in <module>
    load_entry_point('whitey==0.1', 'console_scripts', 'yt')()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 16, in main
    ui.run()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 56, in run
    curses.wrapper(self._curses_main)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 99, in _curses_main
    self._update_screen()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 157, in _update_screen
    self._add_table_row(self._help, 0, 0, w-1, self._bar_attr, max_width=16, win=self._help_bar)
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.1-py2.7.egg/yt/__init__.py", line 334, in _add_table_row
    win.addstr(y, x, truncate('%s:%s' % (k,v), min(w-x, cell_w)).encode(self._code), attr)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 12: ordinal not in range(128)
So I read around the threads and discovered I'm running version 1 - so I tried to update hoping that would help.

Incidentally - I had trouble updating/installing with all the methods posted on this PyPi page - it kept using using /usr/local/lib/python2.7/dist-packages/whitey-0.1-py2.7.egg and not the newer version and GitHub complained about "Not a git repository (or any of the parent directories): .git"...anyway - the "One line install for the Raspberry Pi" worked, but it didn't fix the error:
Code: Select all
pi@raspberrypi ~ $ yt
Traceback (most recent call last):
  File "/usr/local/bin/yt", line 9, in <module>
    load_entry_point('whitey==0.3', 'console_scripts', 'yt')()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.3-py2.7.egg/yt/__init__.py", line 31, in main
    ui.run()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.3-py2.7.egg/yt/__init__.py", line 84, in run
    curses.wrapper(self._curses_main)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.3-py2.7.egg/yt/__init__.py", line 127, in _curses_main
    self._update_screen()
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.3-py2.7.egg/yt/__init__.py", line 185, in _update_screen
    self._add_table_row(self._help, 0, 0, w-1, self._bar_attr, max_width=16, win=self._help_bar)
  File "/usr/local/lib/python2.7/dist-packages/whitey-0.3-py2.7.egg/yt/__init__.py", line 362, in _add_table_row
    win.addstr(y, x, truncate('%s:%s' % (k,v), min(w-x, cell_w)).encode(self._code), attr)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 12: ordinal not in range(128)
Same deal - different version.

So I noticed someone suggested adding:
Code: Select all
export LANG=en_US.utf-8
to .profile in your home directory, but that didn't work for me - I guess that conflicts with other locale settings, I figured we're just trying to add UTF-8 support so tried:
Code: Select all
export LANG=en_GB.utf-8
That did the job after restarting my ssh session - so I learned something today. I think...

Anyway YT lives once again 8-)
Early model B with Raspbian updating Xively (was Cosm) with CurrentCost Envi plus NAS, Get Iplayer, YT (whitey) and a general ssh linux playpen plus a 512MB model B with OpenElec.
Posts: 37
Joined: Sun Jun 10, 2012 10:17 am
Location: UK
by BrianXP7 » Tue May 07, 2013 2:40 am
I just want to mention Whitey v0.3 is out and with a better tutorial. (By better, I mean easier to setup and has troubleshooting solutions.) You can get it at https://pypi.python.org/pypi/whitey.
Posts: 26
Joined: Sat Mar 30, 2013 6:35 am
by lonfo » Mon May 27, 2013 6:40 pm
Thanks for the beautiful post!
I have a question: I usually use ssh and have no problems launching omxplayer remotely and I wish to use your hint to view youtube videos. Actually, the output is not redirected to my TV. Maybe I have to change "stdout = subprocess.PIPE" in the phyton script but I have no idea how.
Please can you help me? Thanks
Posts: 1
Joined: Mon May 27, 2013 6:31 pm
by Deniqer » Sat Jun 01, 2013 11:07 am
Hey guys!
This solution works perfectly, but I've noticed that, considering Youtube terms of usage, downloading videos per se is illegal.
You shall not download any Content unless you see a "download" or similar link displayed by YouTube on the Service for that Content. You shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other purposes without the prior written consent of YouTube or the respective licensors of the Content. YouTube and its licencors reserve all rights not expressly granted in and to the Service and the Content.

What is your take on that?
Posts: 1
Joined: Sat Jun 01, 2013 9:22 am