Aug 212013
 

Aka how to view YouTube videos on your Raspberry Pi from Midori or Chromium!

youtube-on-the-raspberry-pi

We have pulled together some software magic and are proud to announce an easy installation procedure for PiVid, the YouTube / HTML5 Video / VeeHD Raspberry Pi video enabler:

Installation

Open a shell – for instance LXTerminal, if you are working on the Raspberry Pi desktop, it can be opened by double-clicking the LXTerminal icon – and enter the following commands:

Step I: Please add our Repository

sudo wget -O /etc/apt/sources.list.d/repository.pi3g.com.list http://repository.pi3g.com/sources.list
sudo wget -O - http://repository.pi3g.com/pubkey | sudo apt-key add -
sudo aptitude update

This will:

  • set up our repository as an additional package source on your Raspberry Pi (your main sources.list will not be modified in any way)
  • get our public key
  • fetch the available packages from our repository server

Step II: Install PiVid

sudo aptitude install pivid

This will:

  • install PiVid and dependencies (other packages which PiVid requires to work)

Please press “Enter” when asked whether you want to continue, and once again “Enter” during the installation process of the youtube-dl package, when asked to.

Step III: Activate PiVid

service pivid start

This will:

  • start the pivid service (it talks to your browser and to omxplayer to play your video)

If you want to stop the pivid service, simply use “service pivid stop” – this will save a small amount of computing resources.

Step IV: Install PiVid in your browser

Install PiVid in Midori:

To use the userscript in Midori (Raspbians default browser), you have to activate the “User addons” extension. Start Midori. Open the preferences dialog (Menu>Preferences), select the Extensions tab and tick “User addons”. (“User addons” is the very last entry, use the scroll bar to find it). Click “Close”.

Then simply open the script ( file:///usr/share/pivid/replace.user.js ) in your browser (copy & paste the link into your URL bar, and press enter) and click “Install user script” when asked.

pivid-userscript-midori

 

Install PiVid in Chromium:

To install pivid in Chromium, please open a shell in the X desktop environment (e.g. LXTerminal), and start Chromium like this:

# chromium --enable-easy-off-store-extension-install /usr/share/pivid/replace.user.js

pivid-userscript-chromium

Please click “Continue”, and then click “Add” on the “Confirm New Extension” dialogue:

click-add

Chrome will confirm, that the extension has been added.

Usage

Please note: after every reboot, you need to start the pivid service, as described above. Open LXTerminal, and (as user pi), enter:

service pivid start

You can close LXTerminal after starting the service, if you want. If the service pivid is already running, it will tell you so – you don’t need to worry about entering it twice by accident.

Starting PiVid will open a web server on your Raspberry Pi’s port 3000. This will be accessible on your local network – and can be used to control video playback (of external URLs) on the Raspberry. This is by design, and we plan to release more documentation about this soon.

YouTube

youtube-raspberry-chromium

Navigate to a YouTube video (for example: Xcylin, shooting with a frickin’ laser). First, the browsers will display “Flash Player missing”, but after some seconds, the web site should reload, and display the PiVid play button, as seen above for Chromium.

Simply click this button, and the video should launch in a short while. This will be indicated by a “pause” button:

youtube-raspberry-c-pause

If you want to see the video again, please reload the page – PiVid currently can’t identify when the video has stopped playing.  The pause button currently has no function, but you can use omxplayer keyboard control (see below).

VeeHD

VeeHD is an alternative video hosting platform / community, sporting an interesting selection of movies, documentaries, etc.

PiVid supports playback on VeeHD. You may need to log in as a VeeHD user for some videos to work, and some videos are hosted on very slow servers – where streaming is impossible with PiVid. Please download the video and play it with omxplayer instead.

Usage: Search with the VeeHD search, and click on the video you would like to see. PiVid will show you the play button after a short while:

veehd-raspberry-pi

Omxplayer keyboard control

Space or p = Pause / Resume
– / + = Decrease / Increase Volume
q = Quit

 

Problem handling

YouTube play button not showing

If the PiVid play button does not show up on a YouTube video, instead of the warning about an incompatible browser, please try to simply reload the page – it should show up now.

Restarting the service

If you run into any unexpected problems using the software, try restarting the pivid service:

service pivid restart

If this does not help, try restarting your Raspberry, and starting the service after that. If still stuck, comment below. (Use “pivid” instead of “service pivid start” to see some advanced debugging output).

update-rc.d

Please note, that update-rc.d can’t be used right now to install the service as autostart on boot – we are investigating the cause and will release an update soon. (pivid service will start, but without video playback.) Please use the manual starting method ( service pivid start ) in the meantime – thank you!

Background

PiVid works as a server (written in the uber-cool Node.JS), which will display an IFRAME in your browser. Through a user script, the browser can submit the URL needed to retrieve and play the video. Once you click on the “play” button, PiVid will invoke some software incantations (sprinkle the equivalent of magic fairy dust – we’re building on the shoulders of giants – you guys know who you are :-) – and voilà – the video location will be passed to omxplayer, the trusty workhorse of Raspberry Pi video playback!

You can, of course, fork us on GitHUB.

By the way – we have also packaged a newer version of Node.JS to go along with PiVid on our repository – package name is “nodejs”. Stay tuned for more about this.

The idea for PiVid was taken from a very similar client-server approach, which was coded in Python, but seems to be abandoned now. Thank you for the inspiration!

Reference

Aug 032013
 

LibreOffice ist mittlerweile frei als Paket für Raspbian verfügbar. Die Installation geht wie bei jedem anderen Paket auch, ganz einfach so:

sudo aptitude update
sudo aptitude upgrade
sudo aptitude dist-upgrade
sudo aptitude install libreoffice

unter der Konsole (bspw. unter LXTerminal).

Man sollte sich einiges an Zeit mitnehmen, da der Prozess länger dauert (> 100 MB download, > 300 MB im installierten Zustand).

Anschließend kann man unter X-Windows die LibreOffice Suite aus dem Start-Menü unter dem Punkt “Office” ganz einfach starten. LibreOffice Writer, LibreOffice Calc, und die anderen Programme sind wie gewohnt bedienbar.

Raspberry Pi LibreOffice Edition

Wir haben eine besondere LibreOffice Edition für den Raspberry Pi entwickelt: auf dem Gehäuse des Raspberries befindet sich das LibreOffice Logo. Für jedes verkaufte LibreOffice Edition Kit spenden wir für Dich 5 € an die Document Foundation, die gemeinnützige Organisation hinter LibreOffice.

In unseren LibreOffice Edition Raspberry Pis ist LibreOffice bereits vorinstalliert – so kannst Du gleich loslegen.

Klicke bitte auf das Bild um in den Shop zu gelangen:

libreoffice-essentials-kit

Aug 022013
 

This is a work still in progress with unsatisfactory results (image quality, delay, very low frame rate), but here’s for the brave-hearted and those who are researching into the same direction:

Set up Windows streaming host

This can be a multi-monitor machine. Your left-most monitor will be streamed.

I generally use FullHD resolution for testing.

  • Install a Direct Show Screen Capture Filter for Windows. We used the direct show filter provided with “Screen Capturer Recorder” by Roger D Pack. Roger also includes an audio direct show capturer. And all free of charge – a real bargain 😉
  • Maybe a reboot is necessary here
  • Install latest version of ffmpeg from Zeranoe. Opt for the static builds (probably 64 bit if you are running a modern Windows 64 bit OS on a modern computer)
  • extract the download to a safe location
  • Open PowerShell, and navigate to the location

List the available screen filter devices:

This and all following shell commands are to be issued in the PowerShell. 

.\ffmpeg -list_devices true -f dshow -i dummy

This will show you the available input devices to capture from. My list looks like this, for instance:

 DirectShow video devices
  "Integrated Webcam"
  "screen-capture-recorder"
 DirectShow audio devices
  "Microphone (2- High Definition Audio Device)"
  "virtual-audio-capturer"

Start the stream:

.\ffmpeg -f dshow -i video="screen-capture-recorder" -vcodec libx264 -vprofile baseline -preset ultrafast -tune zerolatency  -pix_fmt yuv420p -b:v 400k -r 30  -threads 4  -fflags nobuffer -f rtp rtp://192.168.1.14:1234

I used PowerShell to start this, thus the .\ is needed in front of an application in the current folder.

  • libx264 is used as video codec, rather than mpeg4 (for superior quality – the Raspi is capable of H264 hardware decoding)
  • baseline profile needs to be used together with –pix_fmt yuv420p – this basically reduces the encoding to a simple subset of the full standard. Leaving out these two options led to the streaming not working, but you may be able to figure out something – please comment!
  • -preset ultrafast and –tune zerolatency both accelerate the video output. I have a latency of about 1 – 2 sec. in our lab here
  • -b:v 400k sets the target bitrate (as variable)
  • -r 30 this sets the framerate to 30
  • -threads 4 – give more threads to ffmpeg
  • -fflags nobuffer – should decrease latency even further. Not sure if it does, though.
  • -f rtp – specifies the output format. Here we use rtp, and stream it directly to the raspberry – which has the IP 192.168.1.14 on our network. You can choose whatever you like for the port, by an odd coincidence we chose 1234. Aliens?!?

Hit “Enter” and ffmpeg will start streaming. It will show you handy statistics – current frame number, framerate, quality, total size, total time, current bitrate, duplicated capture-frames, dropped capture-frames (i.e. the capturing rate does not align with the streaming rate). Do not worry too much about those for now.

Please note that you need some horsepower for capturing, encoding and streaming in real-time.

Set up Raspberry Pi

omxplayer can’t handle RTP streams directly – thus, we resort to GStreamer.

GStreamer 1.0 includes special support for the Raspberry Pi’s Broadcom SoC’s VideoCore IV hardware video functions (also known as OpenMax). Unfortunately, the Raspbian maintainers do not want to include it (yet), in order not to diverge too far from the official Debian repositories.

Luckily for you, though, someone has precompiled the binaries and set up a repository. See this thread for more background information, or simply follow my instructions:

sudo nano /etc/apt/sources.list

This will open nano to edit your package repository list. Please add the following line into this file:

deb http://vontaene.de/raspbian-updates/ . main

After saving the file (Ctrl + O, Ctrl + X), run the following commands:

sudo aptitude update
sudo aptitude install libgstreamer1.0-0-dbg gstreamer1.0-tools libgstreamer-plugins-base1.0-0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad-dbg gstreamer1.0-omx gstreamer1.0-alsa

This will install the necessary gstreamer1.0 & components.

Start the stream receiver & decoder chain:

gst-launch-1.0 -v udpsrc port=1234 caps='application/x-rtp,payload=(int)96,encoding-name=(string)H264' ! queue ! rtph264depay ! h264parse ! omxh264dec ! autovideosink sync=True

This can be done as user pi. Please note, that this may not be the perfect command to achieve playback, but it is a good starting point – as it works!

Gstreamer sets up “pipelines”, in which data is passed on in transformed state from step to step. While it seems to be quite a bit at the first look, it is very logical in itself, once you have figured it out.

  • we specify a UDP source (udpsrc), the port, and “caps”
  • Without the RTP caps, playback is not possible. Apparently they are not provided along with the stream? Thus, we have to specify the caps manually.
  • In the caps we specify some information for the pipeline
  • queue may be omitted, I am not sure what it does
  • rtph264depay – depayload h264 data from rtp stream
  • h264parse – parse h264 data
  • omxh264dec – decode the data with BroadCom OpenMAX hardware acceleration
  • autovideosink – put the result on the display
  • sync=True – I am not sure whether this does anything, or whether it is in the right place and form. It was an attempt to fix the gst_base_sink_is_too_late problems (but it did NOT fix them).

Issues

slow screen updates

These are very likely caused by a slow screen capture refresh rate, this may be better with a different screen capturer.

On Windows 8, with a pretty powerful Core i7 machine, I get possible fps 15.41 (negotiated for 30 fps). This is using Roger’s / betterlogic’s screen-capture-recorder. Roger claims this is due to Aero.

See more about it here  and here (also provides a list of available other directshow screen capture filters).

artifacts

Gstreamer shows massive H.264 artifacts – Matthias Bock has opened an issue for this, and some further hints.

This seems to be related to the bitrate set in FFMPEG – if I lower it to ~ 400 k, the artifacts become less distorted, and image quality is quite OK. Also, use a variable bitrate instead of a constant one.

gst_base_sink_is_too_late()

This may be related to the Pi’s fake hardware clock (?). It also appears when running gstreamer with a simple test image setup:

gst-launch-1.0 videotestsrc ! autovideosink

gstbasesink.c(2683): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstEglGlesSink:autovideosink0-actual-sink-eglgles:
There may be a timestamping problem, or this computer is too slow.

 

The command above will display a test video image.

Sound

I have not tried sound yet. Sound shoud be input into ffmpeg using the following arguments:

-i audio="virtual-audio-capturer":video="screen-capture-recorder"

This directly from Roger’s GitHUB documentation.

Ideas

  • try to use gstreamer on Windows for streaming?
  • Adjust Parameters for betterlogic/Roger’s direct show capturer
    • apparently it hits the ceiling at 15 fps with Aero on
  • Use a different direct show capturer
  • Tune quality for ffmpeg stream

Background info

  • H.264 is MPEG-4 Part 10 or = MPEG-4 AVC – and is the more modern and data-efficient codec format (“advanced video coding”);
  • whereas MPEG-4 Part 2 = MPEG-4 Visual is based on the older image compression standards used in MPEG-2, and also implemented in DivX, Xvid, etc.
  • you can also use .\ffplay –i udp://:1234 to test the streaming output on the local machine. The video quality IS NOT TO BE USED AS A REFERENCE. It just shows, that it “works”. Change the target IP accordingly (“localhost” instead of the Raspi’s IP will do, I believe.)

References

Jan 312013
 

 

This is actually a quite accurate prediction of what we have now. And all of it is possible with the Raspberry Pi minicomputer! You can have a look at the current news, the weather, your stocks – of course provided by the Internet, and free of charge to you. Printing websites is easy, you just attach a printer …

If you want to see someone while you are talking to them, you can use Skype.

Closed Circuit Television – also possible with webcams. One Pi drives a webcam, and the other can access it over the network. Or even the Internet via IPv6 … truly there are no limits!

The only thing this “office of the future” did not hit spot on: there’s only ONE device to do it all – and it can be small enough to fit into your pocket (smartphone). Yes, the world’s knowledge is at your fingertips!

Optimization WordPress Plugins & Solutions by W3 EDGE