Sunday 20 March 2016

youtube-dl - How to always download mp4 only

How often do you try to watch a video on YouTube and the playback is jerky and voice is out of sync, making the whole thing painful to watch.  There are video download 'helper' add ons available for most browsers, but they are also a pain most of the time.  The only time I ever had malware on my Linux machines was form one well known download helper

There is a solution.  Youtube-dl is a handy command line tool that and can be used to download video not only form YouTube, but from many more sites.  Because it works from the command line it can also be used in conjunction with other programs that stream video.

There are even a couple of GUI interfaces that make good use of its power.  But for now, we'll look at pure command line.

The basic method to download a video (we'll use YouTube for the example) is to open a youtube page and open a video, the copy the address of the video, either by copying from the address bar, or right clicking the viceo and copying the 'vidwo url'.
The open a terminal and type youtube-dl followed by the address of the link to the video (you can copy and paste it).

So if you had uploaded a video to your YouTube account and want to download it again to watch, you might end up with something like this in your terminal.

youtube-dl https://www.youtube.com/watch?v=Vf_KLcydvik

Press enter and youtube-dl will check for the highest quality video on the page and download it.
And here is where the problem occurs.

Many of my playback devices cannot play .webm files.  And often webm. happens to be the highest quality file on the page.

So I prefer to download any video as an mp4 for consistency.  To do that, I enter:

youtube-dl -f mp4   (followed by the url of the video)

Now youtube-dl will only download and save videos as mp4, and I don;t end up with files I cannot play back.

It is also possible to set the config file of youtube-dl to only download as mp4.  To override it you would then haver to put an ignore argument in the command line.  For now though, this is the easy way to make sure you get an mp4 rather than a webm file.

Also it is worth remembering that unless you modify the config file, youtube-dl will always download to the folder in which you opened the terminal.  So if you open a terminal from your /home/Download/Youtube/  folder, that's where the files will be saved.


youtube-dl avconv error when downloading video update Ubuntu libav-tools

Sometimes runnign youtube-dl to download video from a web page will give an error warning about your avconv being out of date, and suggesting that you upgrade.  Recently mine has been telling me to upgrade to  version 10 or later.  but Elementary (Ubuntu 14.04 based repository) was only on version 9.18-6:9.18

A post on the Ubuntu forums:
http://askubuntu.com/questions/563245/avconv-warning-while-downloading-youtube-video
had the answer.

There is a PPA available (at 20 March 2016) and running the following commands added it and updated my avconv.

sudo add-apt-repository ppa:heyarje/libav-11 && sudo apt-get update
sudo apt-get install libav-tools
Now, entering avconv -version in a terminal window tells me:

radu$ avconv -version
avconv version 11.3-6:11.3-1~trusty, Copyright (c) 2000-2014 the Libav developers
  built on Apr 13 2015 22:25:55 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
avconv 11.3-6:11.3-1~trusty
libavutil     54.  3. 0 / 54.  3. 0
libavcodec    56.  1. 0 / 56.  1. 0
libavformat   56.  1. 0 / 56.  1. 0
libavdevice   55.  0. 0 / 55.  0. 0
libavfilter    5.  0. 0 /  5.  0. 0
libavresample  2.  1. 0 /  2.  1. 0
libswscale     3.  0. 0 /  3.  0. 0
radu$


Saturday 19 March 2016

Raspberry Pi - Bluetooth the Easy Way - Reposted

Recently I posted about using Blueman to make Bluetooth work on the Raspberry Pi 3B.
It gave me immediate access to transfer files to my tablets and phones so I could print using Wireless Direct to my wireless printers.

But as someone kindly commented here - it did not work with Audio.  So I deleted the original post and changed a few things so I could connect by bluetooth to my Logitech S00113  Bluetooth Audio Adapter.

Here's what I did.  I use Synaptic, so finding what is installed is easy.

sudo apt-get install synaptic

First, I made sure that bluetooth was installed, then checked that pi-bluetooth was also installed.  pi-bluetooth loads the drivers for the new on-board bluetooth in the raspberry Pi 3B.

Then it was time to add a few tools:

sudo apt-get install bluez

sudo apt-get install blueman

sudo apt-get install pulseaudio

sudo apt-get install pulseaudio-module-bluetooth

I also have bluez-tools.  It should have been installed by bluez.  If it was not, it doesn;t hurt to install it.


then, just in case I want to use pulse for anything else

sudo apt-get install pavucontrol

pavucontrol is not really needed.  But there are times I use the pulse volume control for other things.

I am listening to music playing from my Raspberry Pi 3 to my blueooth system as I write this.




Friday 11 March 2016

Slimjet Browser 64 bit in ElementaryOS / Ubuntu Couldn't Load Plugin - fixed

Friday 11th March 2016 and after updating my ElementaryOS Freya from 32 bit to 64 bit and going through all my Brother scanner problems and finally getting both Skype and the 64 bit version of Viber working, I had another glitch.  Googling the problem shows that it is pretty common but none of the suggestions worked.

I use Flashpeak Slimjet for most of my browsing.  It is based on Chromium and as well as being fast, it has some handy built in features.  Because I now had the 64 bit version of Elementary I installed the 64 bit deb package.  And it worked nicely until I wanted to play a video.  That's when I go the message that it 'couldn't load the plugin'.  So I did the usual chrome thing and installed the latest Flash (Adobe Flash Player Version: 21.0.0.182  at the moment) made sure it was enabled and restarted Slimjet.  When that failed I tried googling and tried the various suggestions.

Nothing worked.  I rebooted the computer and restarted Slimjet - and nothing worked again.  And it seems from discussions on forums and blogs that it is a bit of a lottery.  Some suggestions work for some people and not for others.

So I went back into Slimjet and entered  about:plugins in the address bar again and re-enabled the native PPAPI player plugin, which I think is called something like pepper-flash.  Then I checked the old Adobe Flash player v11.x was actually gone and I only had the 21.x version and made sure it is enabled.

And I downloaded the 32bit deb package.  Opened it using Software Centre and told it to install anyway when it told me it was not a good idea.  I had to do that twice to get the install to complete.  It removed some files, but they all seemed specific to Slimjet or Chromium.  I suppose I will find out if they affect anything else in the next few days.

But the good news is, I now have a 32 bit Slimjet running on 64 bit Ubuntu based OS (Elementary OS Freya) and I can play all my Youtube stuff again.   And the download tool still works nicely.

The neat thing about the download tool is that when I make a video in say OpenShot, I can upload a big mp4 to YouTube, and Youtube makes it into several smaller sized options at different resolutions.  Slimjet lets me open one of my videos in Youtube and choose what size file to download.  Great for emailing or uploading somewhere else.

So if all else fails, and you are sick of downloading and messing with things and getting nowhere, and if you already used Synaptic to install the latest Adobe Flash Player plugin.
Don't uninstall the 64 bit Slimjet.  Download the 32 bit, then open it using Software Centre and let is sort out the changes.

It just might work!  (and of course - it might not)

U P D A T E  - The Next Morning

Ok, I found the first problem.  Logging in this morning, there was no Network Manager icon in the Plank (Elementary's name for Panel).  I connected to my network using the menu.

Applications (Elementary's name for the start menu) >  System Settings > Network

From there I just selected my network and turned the toggle at the top right ON and it connected.  
Then in a terminal:

sudo apt-get indicator-applet

That put my Network indicator back.

Other than that so far all is well and Slimjet 32 bit on Elementary OS Freya 64 bit is still happily playing Youtube Videos.

Viber for Linux - Install in ElementaryOS 64bit and UBUNTU 64 bit

I tried the download and setup directly from Viber's website but the setup kept hanging after asking for my phone number.  So I tried another method.

THIS WORKED on 2016 March 10

Open a terminal
Type:
wget http://download.cdn.viber.com/cdn/desktop/Linux/Viber.zip
Then unzip it and cd to that viber directory.

unzip Viber.zip
cd Viber
~/Viber/Viber.sh



Brother MFC-Jxxxx Scanner not working on 64 bit Elementary and Ubuntu

I use Brother multifunction inkjet printers. Specifically MFC-J6510DW and MFC-J6520DW on USB.   And when I change my linux distribution I always end up with working printers, but no scanner.  And I'm O L D  so I forget what I did (which is the reason I created this blog).

Here's how I got them working when I changed from 32bit to 64bit Elementary OS.  It will also work on UBUNTU.

 
FIRST - Before installing the BROTHER Printer LPR and Cupswrapper and brscan drivers

Make Sure you install the 32 bit libs needed (see Brother Support Pre Install Instructions)
Either of these (Elementary only had lib32stdc++ 
ia32-libs or lib32stdc++

(Elementary only had lib32stdc++ in the repository - and it worked fine.

Then do the install 

Test the printers.  They probably work.

If you don't already have them, install xsane, sane and sane-utils.  

Open xsane and try to scan.

Usually you will get errors when you try to use xsane.  This is because by default Brother scanner driver needs to be root.  
***  There is actually a hint about this in the Brother Support Website, but it is easy to miss and I could not find it again after the first time I saw it  ***

To test this, if you cannot open the scanner with xsane open a terminal and type:

sudo xsane

You'll get a warning saying it is dangerous, but go ahead anyway - Chances are, xsane will work.

So you need to change the user from root to yourself.

In the terminal type;

sudo apt-get install gnome-system-tools    (if you are using Ubuntu this might already be installed)

In your menu you should fine a new entry 'Users and Groups'
Edit the saned  and scanner groups and add yourself as a user.

REBOOT and try xsane again

If you still have the error you might have to add an entry in a file.
Open a File Manager as root and go to:
/lib/udev/rules.d/
Edit the file called        40-libsane.rules
near the bottom of the file is a line that says "# The following rule will disable"

Above that line, add these two new lines:

# Brother scanner
ATTRS {idVendor}=="04f9", ENV {libsane_matched}="yes"

(Leave a BLANK LINE AFTER them)


Reboot and it should all work.
If it still doesn't work after all this you can use Brute Force if you're only using this computer at home.  It has some security risks in the work place!

Open a file manager as root and go to the /etc/udev/rules.d/ folder

Create a new file called 40-scanner-permissions.rules

Put these lines in the new file:
# usb scanner
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE:="0666"
SUBSYSTEM=="usb_device",MODE:="0666"

Then Save and REBOOT

See if the scanner is working

****   NOTE   ****

If you installed using the Brother Install Tool and all the stuff above doesn't work  (Unlikely)
Go back and MANUALLY  (download each driver and install it).

Then try xsane.  

If it still won't work, start at the beginning again by changing the permissions and try xsane.
You should not have to edit any files again.

By the time I remembered it was a permission thing I had installed using both the Brother install tool  and then manually installed, so I can't say if it would have simply worked after changing permissions.




Monday 7 March 2016

Raspberry Pi 3 Enabling Analog Audio in omxplayerGUI - and avoiding the KODI shutdown problem.

Since the first release the Raspberry Pi has been used as a Media Centre, and the extra performance of the Pi 3B means more of them will be used that way.  But a media centre outputs sound and the Pi 3 and Raspbian have some problems in that area.

UPDATED

The best video playback on Raspberry Pi is achieved using omxplayer, and in Raspbian Jessie, omxplayer defaults to playing audio through HDMI if an HDMI cable is plugged in.  Of course if you are using a HDMI cable for video, you will get HDMI sound.  Changing the output by right clicking the Volume (speaker) icon on the panel will not change this for omxplayer, although it does for most other players.

If you are opening omxplayer from the command line, you can output through the Analog jack on your Raspberry Pi by typing

omxplayer -o local filename.mp4    

And in this example it would play the file filename.mp4 with the sound through the Analog jack.

However if you happen to be using the fastest browser available for Raspberry Pi, this will not work, because kweb uses omxplayerGUI.  And omxplayerGUI does not have a button to select the audio output.

What kweb does have though is a very detailed Configuration system accessed by clicking the 'Home' button.  I wasted a week trying to get sound working by adding it in various forms to each of the places where omxplayer arguments can be placed.

Once at the Home page,  clicking the  Settings button will open a page with lots of places to tweak the program.

Scroll down about 1/3 of the page and you will find a heading:
GENERAL OMXPLAYER AUDIO VIDEO OPTIONS. arguments.

To switch the audio output in omxplayerGUI from HDMI to ANALOG or back again you need to click the Settings button and scroll down the page to:

There are four headings with a text box below them to enter argumentsWhat kweb does have though is a very detailed Configuration system accessed by clicking the 'Home' button.  I wasted a week trying to get sound working by adding it in various forms to each of the places where omxplayer arguments can be placed.

Once at the Home page,  clicking the  Settings button will open a page with lots of places to tweak the program.

Scroll down about 1/3 of the page and you will find a heading:
GENERAL OMXPLAYER AUDIO VIDEO OPTIONS. to send to omxplayer.
Each part of an argument MUST BE On A SEPARATE LINE.   So to enter   -o local  You would enter it like this in each box.

-o
local

These are the places you need to enter it:
NOTE!!   Click the SAVE button next to each box after you add the lines.
The first three settings are about 1/3 down the page under the heading:

GENERAL OMXPLAYER AUDIO VIDEO OPTIONS.
omxoptions (video player)
omxaudiooptions (audio player)
omx_livetv_options (video player, special settings for live TV streams)

The last is near the bottom of the page under the heading:
ONLINE VIDEO OPTIONS
youtube_omxoptions (video player, used for web video)

To return your omxplayerGUI output to HDMI, simply open Settings again and chenge the entries under each heading to:

-o HDMI

NOTE!  
In the Settings page there is an option to create 'Presets'.
I will write more about these in a few days.  For now I'll mention tat once you have made any special changes to the Settings of kweb and omxplayerGUI, you can save the state of those settings and kweb will create buttons so you can apply them quickly with a mouse clisk.

So you can change the above settings for Analog and create a Preset for Analog audio, then change them back and create a Preset for HDMI audio and simply click the appropriate button to swap output modes.

Presets can easily be created for quick access to various other functions.


Some videos will not play in omxplayer, but do play in KODI.  However KODI has a problem.   Choosing 'EXIT' from the KODI menu leaves you with a blank screen and the risk of corrupting your bootable micro SD card if you simply unplug the power.


So what to do about it.

Quitting KODI.
FORGET about the 'Exit'  option that is supposed to take you back to the desktop.
Choose 'Power Off' - to get out of KODI and turn the system off.
Choose 'REBOOT'  - if you plan to use Raspbian again.

I use omxplayerGUI for just about all of my video playing needs, except where I want to loop a video or a playlist.  In that case I simply open KODI.

Saturday 5 March 2016

Raspberry Pi - Print to a Brother Inkjet Printer

Brother has not released printer drivers for the Raspberry Pi's ARM architecture for its range of inkjets, and the i386 drivers apparently don;t work.  There are CUPS drivers for many Brother laser printers, but not for the inkjets.  That leaves those of us with a Brother stuck with turning on a network printer that is connected to a Brother printer and using that.

But there's another way.  For years I have been using Brother's "iPrint & Scan' app on Android to print to any of the three Brother inkjets on my network.

However there are times when the computers are turned off and I can't be bothered turning one on just to print a file, then shutting down again.  But I almost always have a phone or table turned on.  So I have iPrint& Scan installed on my Android devices.

This works with the Raspberry Pi 3B with built in Bluetooth and I suppose it would work with an earlier Pi that has a Bluetooth dongle.

First, I set up my Brother MFC-J6510DW printers using the WPS option and the button on my router. Takes a few seconds to automatically become available in the WLAN.

Next I activated bluetooth on my Samsung Galaxy Tab 2 10.1. 
Then I opened the Bluetooth GUI on the Pi 3 and searched. It found the Tablet, so I sent a file via bluetooth. An Accept? option poppeed up on the Tablet, and tapping Yes, the file transferred.

So far, so good. I opened the Brother iPrint and Scan app, and it found the printer and connected, then I just had to select the file I transferred from the Raspberry Pi and it showed it in Print Preview, and allowed me to change some settings if I wished. 

I chose Print, and out it came.

Certainly not an elegant solution, and it does require wireless access to the network, but it works and solves one problem for me. It might make life easier for anyone else with an Android or Apple device and a Brother Inkjet.

Cheers,

RossD

Raspbian - Disable Screen Blanking

Many Linux distributions over the years have had a problem where disabling the distro's screen save and power options do nothing.  Raspbian doesn;t even have the option to put it out of screen save mode, so at rather annoying intervals the screen simply blanks.  Fortunately the fix is exactly the same as it has been for years.

The quickest and simplest way to stop Raspbian going into screen save mode is:

sudo apt-get install xscreensaver

Once it is installed, you should find a new Menu Item under Preferences  called Screensaver.

Just open that and select Disable Screensaver from the Modes dropdown list.  Or, if you prefer, set a slide show or something.  At least you will be able select the time between screen saves.

Raspbian - Multiple Desktops EASY FIX

Linux users have always been used to being able to spread the work load across multiple desktops.

In Raspbian you can right click the desktop and add a new desktop as you want one.  But you can't see how many you have and on reboot you are back to only having one desktop again.

First thing to do is to right click the panel and add a Pager.

Once you have done that you will see how many desktops are available and be able to switch between them.

To set the number of desktops permanently:

sudo apt-get install obconf

Once you have installed that, you can find a new option in the Menu under Preferences, called Openbox Configuration Manager.

Click the tab that says 'Desktop' and you will find the option to select the number of desktops you require.  Once that is set, rebooting will always bring you back to that number of desktops.