Showing posts with label playing. Show all posts
Showing posts with label playing. Show all posts

Playing YouTube videos in the browser on the Raspberry Pi

This will allow you to stream up to 1080p youtube videos in the browser on the Raspberry pi using omxplayer. Its a crude hack but it seems to work pretty well on my system. Install instructions and a demonstration video are shown below.

You can install this by pulling the git repository and running the scripts below.
Commands to install are below (your user should have sudo privileges but you dont need to be root):

You may have to enable user scripts in Midori by going to Menu>Preferences>Extensions>UserScripts and clicking the check box.


sudo apt-get install git-core
git clone git://github.com/StevenHickson/PiAUISuite.git
cd PiAUISuite/Install/
./InstallAUISuite.sh

**NOTE, this will ask you if you want to install a lot of different scripts because it is a SUITE. You only have to pick the ones you want to use. If you only want to use the youtube scripts, press n on any other question except for the dependencies and youtube.

Update Instructions 

cd PiAUISuite
git pull
cd Install
sudo ./UpdateAUISuite.sh



Demonstration


There is a lot of misinformation out there on how to do this. Using gnash or HTML5 is going to result in a frame rate so slow it can be considered unworkable. Ive tried both of them out and you cant really watch videos with them. XBMC has a youtube plugin but it is buggy and crashes often.

Ive been playing youtube videos using the command line and my voicecommand using the scripts found here.
After seeing a couple people ask about playing youtube in the browser last night, I decided to go ahead and do that and create some user scripts for midori which allow the browser to utilize the same hack.

Here is the technical overview:
I created a script called youtube which uses the youtube-dl -g flag to grab the video URL. It also handles playlists and other parsing. Then it passes that video URL to omxplayer for it to stream. 
Next I registered a new URL protocol yt:// and made it pass its information to the youtube program whenever it runs. 
Finally, I created a user script in Midori which simply replaces all http://youtube.com/watch?* URLs with yt://youtube.com/watch?*.

Feel free to let me know any problems you have and enjoy your Youtube browsing experience.


 Consider donating to further my tinkering


Places you can find me
Read More..

Playing videos intelligently with the Raspberry Pi

This is a script designed to intelligently and quickly find and play any of your videos.
This is the first script in my AUI (Alternative User Interface) Series.

I found myself getting frustrated with delving through lots of different folders in order to find a tv show or movie. To keep things well organized requires a hierarchical structure and a lot of work, which also makes it harder to browse to the file in the current GUI environment.

This script aims to locate and play your videos intelligently (right now it uses omxplayer but it could be easily ported to use vlc)

It uses regular expressions and a database to quickly find your movie or tv show.

Ex.
playvideo Movie title
will quickly find and play Movie title

playvideo -r -f Show title
will quickly find and play a random "Show title" episode

playvideo -s 01 -e 01 Show title
will quickly find and play "Show title" Season 1 Episode 1

To install, download the zip here and run the InstallAUISuite.sh file located in the Install folder. It will ask you the media location in the install script.
For example, mine is /media/ExternalHD/movies

You can also choose to manually install but if so, make sure you run with the -set option. ex. playvideo -set /media/ExternalHD/movies

For the next part of my AUI Series, autonomous downloads, click here.

The man page of playvideo is shown below:

NAME

playvideo - Locate and play a video[s]  

SYNOPSIS

playvideo [OPTIONS]... [FILENAME]  

DESCRIPTION

playvideo was developed to speed up/ease the playing of videos using omxplayer on the rasperry pi. It can play movies using a single search term or play tv shows using a season and episode search term. It is based off common video naming conventions and supports mp4, avi, mkv, mov, mpg, flv, m4v, and mp3 files. It also supports randomization. It is currently in Beta and kind of a hack. Any useful suggestions are welcome. It is important to run playvideo the first time with the -set option to create the database (especially if you are using external media). Note: If you used InstallAUISuite.sh, then this has already been done for you.

OPTIONS

-set, -Set MEDIA_ROOT
       Sets up the user parameters and creates a locate db for the media root. Ex. if all your videos are located in /media/Drive1/videos you would run:

      playvideo -set /media/Drive1/videos
-season, -Season, -s, -S NN
       Selects the asked file based off the given season number NN which has to be a two digit number to follow current conventions. Doesnt require an episode number.

      Ex. playvideo -Season 02 Show title

-episode, -Episode, -e, -E N/NN
       Selects the asked file based off the given episode number N or NN which can be a one or two digit number to follow current conventions. Requires a season number to be set as well.

      Ex. playvideo -S 02 -E 01 Show title

-random, -r
       Randomizes the output list of videos.

-first, -f
       Plays the first video from the list. Can be used with the random flag.

-multi, -m
       Plays all of the given list based on the query. Requires CTRL+C to quit given that it runs omxplayer individually for each file.


-continue, -c N
       Continues to play N number of matches. If given a season and episode, it will continue playing the next episodes in order until N episodes have been reached. If given the multiple flag, it will play matches until N has been reached.


-help, -h, --help
       Displays this page.


       The script can now handle names without quotes by replacing spaces with the regex * expression.

      Ex. playvideo Movie title


       The Set up function will also set up a cron job to update the db every day for new files. This will be done in the background and is fairly quick.
 

AUTHOR

Steven Hickson (help@stevenhickson.com) 

Consider donating to further my tinkering.


Places you can find me
Read More..