Sunday, July 08, 2012

XBMC PVR How-to : Enhance your XBMC Media Center Experience with Live TV


*** Updated August 2012:  ***
- Debian/Ubuntu package 3.0
************************

The Goal:


Configuring Live TV on XBMC is a great way to complete your Media Center Experience, that's called "PVR" and will allow you to watch real Live TV on your XBMC Box!

For now, XBMC does not take in charge TV Backend functionality, it will only act as a frontend to a backend software that will manage the TV Tuner.

Please take a look on my Full XBMC post to help you installing and configuring XBMC:
xbmc-install-and-config-howto-for-linux

What you need:


  • A working XBMC installation embedded with PVR (if you used my post, PVR is part of XBMC compilation)
  • A TV Tuner: USB Tv tuner, PCI, HD HomeRun... I used an "Elgato Eye TV Diversity"
  • A Backend software to manage TV flow, i recommend you to use tvheadend

Step 1: Install the TV Tuner and check configuration

First, plug the TV Tuner to your Linux Box and check kernel log, if everything are right you should get this kind of message:

[30943.681707] dvb-usb: found a 'Elgato EyeTV Diversity' in cold state, will try to load a firmware
[30943.690351] dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
[30943.929564] dib0700: firmware started successfully.
[30944.432325] dvb-usb: found a 'Elgato EyeTV Diversity' in warm state.
[30944.432550] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[30944.432693] DVB: registering new adapter (Elgato EyeTV Diversity)
[30944.700631] DVB: registering adapter 0 frontend 0 (DiBcom 7000PC)...
[30944.936519] DiB0070: successfully identified
[30944.936530] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[30944.936749] DVB: registering new adapter (Elgato EyeTV Diversity)
[30945.106998] DVB: registering adapter 1 frontend 0 (DiBcom 7000PC)...
[30945.348653] DiB0070: successfully identified
[30945.348689] Registered IR keymap rc-dib0700-nec
[30945.349030] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:12.2/usb1/1-1/rc/rc1/input8
[30945.349535] rc1: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:12.2/usb1/1-1/rc/rc1
[30945.349911] dvb-usb: schedule remote query interval to 50 msecs.
[30945.349924] dvb-usb: Elgato EyeTV Diversity successfully initialized and connected.


You can see here that the kernel successfully identified the USB TV Tuner ind installed appropriated driver, i recommend you to double check Linux compatibility before buying your TV Tuner.

Step 2: Install tvheadend as the Backend for Live TV


Download and install the backend, we will use "tvheadend".
In my opinion, this a very good TV Backend that comes with a nice web interface.

So we will use the last version which is still running underdevelopment to get all tvheadend functionalities. Tvheadend is small and does not have much dependencies, so compilation will be easy.

(You can also install the version provided by your package system, on Debian derived systems: sudo apt-get install tvheadend)

Install tvheadend:

Source:
$ wget https://github.com/downloads/tvheadend/tvheadend/tvheadend_3.0_amd64.deb
$ sudo dpkg -i tvheadend_3.0_amd64.deb

Answer to installation questions, admin username and password.

After installation, you should find the process up (ps -ef - grep tvheadend) and an init script in "/etc/init.d/tvheadend".

Configuration files will be located in "/home/hts/.hts" and "/home/hts/.xmltv".

Step 3: Configure tvheadend

Connect to tvheadend web interface using your localhost URL (change localhost by appropriated backend IP or Hostname if required) :



Click on "Configuration" then "TVAdapters" and choose your adapter:


Scan for channels:

Select "Add DVB Networks By Location" and add your country and/or city, in my case i choosed defaults and my country to ensure i would get all channels.

Immediately after that, tvheadend will start to scan for channels.
Be patient, this will required a long time to end.
In "General" screen (middle right page), you will see the scan result and running "services". (which mean channels found by the adapter)

Take a look on "Multiplexes", if your antenna and your TV Tuner works fine you should see something like that:



When the scan process will be over, you will see channels in "Services":



Wait for the full process to end, then in "General", click "Map DB services to channels".

Additionally, edit others services and map them manually to channels.

Edit channels to end configuration:

Go in "Channels" panel and edit any channel to set channel number and so on.

If you want channels logo to appear in XBMC (and you will because that's pretty), we will have to use an apache instance for it, so create an apache instance, download channels logo (use google image) and save them to the root folder of the apache instance.

In a few words:

  • Edit new Apache service (don't forget to add the port if new in ports.conf) and tune to your needs:

<VirtualHost *:10000>
ServerAdmin webmaster@localhost
ServerName xxxxxxxxxxxxxxx
DocumentRoot /media/xbmc/logo
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel notice
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/error.log
ServerSignature On
</VirtualHost>


  • Restart apache and add channels logo pictures to the apache root folder
  • Ensure it works by get one logo as for an example with your web browser
  • In tvheadend "Channels" panel, configure the logo, configuration example:


You're done with tvheadend configuration, i recommend you to simply add it to your session automatic run. (if your are using a desktop session)

You may also simply write an initrc script shell to start and stop it as a service.

Finally configure the XML Grabber:

On Debian derived systems, install xmltv:

sudo apt-get install xmltv

Go to XML TV panel, select your country and follow instruction.


Step 4: Configure XBMC


Go back in XBMC and activate the PVR addon for tvheadend frontend (system>settings>add-ons>activated addons):


If you don't run tvheadend on same host, or if you wanted to set an admin user in tvheadend, configure it.

If you haven't changed anything, default configuration is fine and will work.



Save, and Go to "Live TV", XBMC will automatically get channels configuration, final result:




Everything works ^^ Take a look on time-shift function or record, some of them are still under improvement and may not be as stable as it should but work.

As a conclusion, your XBMC Media Center is now really complete, enjoy :-)

FAQ and issues:

  • Failing to start tvheadend with message of segmentation fault

I experienced this several time for unknown reasons after reboots, it was always caused by some king o epg file corruption.

I you experience this, just remove the file and restart:


rm ~/.hts/tvheadend/epgdb








XBMC PVR How-to : Enhance your XBMC Media Center Experience with Live TV


*** Updated August 2012:  ***
- Debian/Ubuntu package 3.0
************************

The Goal:


Configuring Live TV on XBMC is a great way to complete your Media Center Experience, that's called "PVR" and will allow you to watch real Live TV on your XBMC Box!

For now, XBMC does not take in charge TV Backend functionality, it will only act as a frontend to a backend software that will manage the TV Tuner.

Please take a look on my Full XBMC post to help you installing and configuring XBMC:
xbmc-install-and-config-howto-for-linux

What you need:


  • A working XBMC installation embedded with PVR (if you used my post, PVR is part of XBMC compilation)
  • A TV Tuner: USB Tv tuner, PCI, HD HomeRun... I used an "Elgato Eye TV Diversity"
  • A Backend software to manage TV flow, i recommend you to use tvheadend

Step 1: Install the TV Tuner and check configuration

First, plug the TV Tuner to your Linux Box and check kernel log, if everything are right you should get this kind of message:

[30943.681707] dvb-usb: found a 'Elgato EyeTV Diversity' in cold state, will try to load a firmware
[30943.690351] dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
[30943.929564] dib0700: firmware started successfully.
[30944.432325] dvb-usb: found a 'Elgato EyeTV Diversity' in warm state.
[30944.432550] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[30944.432693] DVB: registering new adapter (Elgato EyeTV Diversity)
[30944.700631] DVB: registering adapter 0 frontend 0 (DiBcom 7000PC)...
[30944.936519] DiB0070: successfully identified
[30944.936530] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[30944.936749] DVB: registering new adapter (Elgato EyeTV Diversity)
[30945.106998] DVB: registering adapter 1 frontend 0 (DiBcom 7000PC)...
[30945.348653] DiB0070: successfully identified
[30945.348689] Registered IR keymap rc-dib0700-nec
[30945.349030] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:12.2/usb1/1-1/rc/rc1/input8
[30945.349535] rc1: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:12.2/usb1/1-1/rc/rc1
[30945.349911] dvb-usb: schedule remote query interval to 50 msecs.
[30945.349924] dvb-usb: Elgato EyeTV Diversity successfully initialized and connected.


You can see here that the kernel successfully identified the USB TV Tuner ind installed appropriated driver, i recommend you to double check Linux compatibility before buying your TV Tuner.

Step 2: Install tvheadend as the Backend for Live TV


Download and install the backend, we will use "tvheadend".
In my opinion, this a very good TV Backend that comes with a nice web interface.

So we will use the last version which is still running underdevelopment to get all tvheadend functionalities. Tvheadend is small and does not have much dependencies, so compilation will be easy.

(You can also install the version provided by your package system, on Debian derived systems: sudo apt-get install tvheadend)

Install tvheadend:

Source:
$ wget https://github.com/downloads/tvheadend/tvheadend/tvheadend_3.0_amd64.deb
$ sudo dpkg -i tvheadend_3.0_amd64.deb

Answer to installation questions, admin username and password.

After installation, you should find the process up (ps -ef - grep tvheadend) and an init script in "/etc/init.d/tvheadend".

Configuration files will be located in "/home/hts/.hts" and "/home/hts/.xmltv".

Step 3: Configure tvheadend

Connect to tvheadend web interface using your localhost URL (change localhost by appropriated backend IP or Hostname if required) :



Click on "Configuration" then "TVAdapters" and choose your adapter:


Scan for channels:

Select "Add DVB Networks By Location" and add your country and/or city, in my case i choosed defaults and my country to ensure i would get all channels.

Immediately after that, tvheadend will start to scan for channels.
Be patient, this will required a long time to end.
In "General" screen (middle right page), you will see the scan result and running "services". (which mean channels found by the adapter)

Take a look on "Multiplexes", if your antenna and your TV Tuner works fine you should see something like that:



When the scan process will be over, you will see channels in "Services":



Wait for the full process to end, then in "General", click "Map DB services to channels".

Additionally, edit others services and map them manually to channels.

Edit channels to end configuration:

Go in "Channels" panel and edit any channel to set channel number and so on.

If you want channels logo to appear in XBMC (and you will because that's pretty), we will have to use an apache instance for it, so create an apache instance, download channels logo (use google image) and save them to the root folder of the apache instance.

In a few words:

  • Edit new Apache service (don't forget to add the port if new in ports.conf) and tune to your needs:

<VirtualHost *:10000>
ServerAdmin webmaster@localhost
ServerName xxxxxxxxxxxxxxx
DocumentRoot /media/xbmc/logo
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel notice
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/error.log
ServerSignature On
</VirtualHost>


  • Restart apache and add channels logo pictures to the apache root folder
  • Ensure it works by get one logo as for an example with your web browser
  • In tvheadend "Channels" panel, configure the logo, configuration example:


You're done with tvheadend configuration, i recommend you to simply add it to your session automatic run. (if your are using a desktop session)

You may also simply write an initrc script shell to start and stop it as a service.

Finally configure the XML Grabber:

On Debian derived systems, install xmltv:

sudo apt-get install xmltv

Go to XML TV panel, select your country and follow instruction.


Step 4: Configure XBMC


Go back in XBMC and activate the PVR addon for tvheadend frontend (system>settings>add-ons>activated addons):


If you don't run tvheadend on same host, or if you wanted to set an admin user in tvheadend, configure it.

If you haven't changed anything, default configuration is fine and will work.



Save, and Go to "Live TV", XBMC will automatically get channels configuration, final result:




Everything works ^^ Take a look on time-shift function or record, some of them are still under improvement and may not be as stable as it should but work.

As a conclusion, your XBMC Media Center is now really complete, enjoy :-)

FAQ and issues:

  • Failing to start tvheadend with message of segmentation fault

I experienced this several time for unknown reasons after reboots, it was always caused by some king o epg file corruption.

I you experience this, just remove the file and restart:


rm ~/.hts/tvheadend/epgdb








Tuesday, July 03, 2012

Google Account Howto - Protect and secure your Google Account (gmail, google+, Google Drive...) with Strong Authentication (turn your phone into a Software Secure Token, use 2 steps authentication)

The Goal:

How much is your Google account precious to you ? Does Google host your mails, contacts, documents of all sorts (thanks to Google Drive), professional or confidential datas ? Do you think only protecting it with a password (even strong) is enough ? You may be wrong !

Google offers you a great and free service which is almost the better way to secure your account access and really improves the security of your Google services and your personal data security.

They call it "2 Steps Authentication", in professional environment you may already know it as "Strong Identification" such as RSA SecureID and others professional solutions.

Off course Google gives you all required explanations here:

My Goal here is to present you and easily help to activate this great Google service in a few simple steps.
It will drastically improve your account Security!

With this service, the only way to connect to your account will be to get your login name, your current password and to steal your Smartphone!


What you need:


  • First of all, a Google account ! ^^
  • A computer
  • A smartphone that will act as the Security device, IOS, Android or RIM (even an Ipad or could do the job you will have to always keep it in the pocket !)
  • Optionally a printer to be able to print your personal code for safety 

Step 1: Connect to your Google Account and activate the 2 Steps authentication


  • Connect to your Google account management interface and sign in:
 (you may also connect to any Google service such as gmail, Google Drive..développement. and access to your account properties) :

  • When connected, click on "Security" (bottom left page) :

















  • In this new page, look a at the middle of the page and click on "Edit" :
  • In the animation page, Click on "Start Setup" (bottom right):
  • Enter your (real) phone number and select Text message for the way to transmit you the activation code and submit:

  • You will receive a text message from Google, Enter the received code:
  • Select if you want or not trust the computer you are connected to for 30 days:
If you are on your personal computer you can activate this to avoid having to systematically submit your verification code using Google Authenticator.

If you are a non private computer, don't activate this this is not a computer you can trust !

  

  • Confirm to activate:


  • In the new page, Sign in (you do not yet need to provide a verification code because not things are not yet over ^^), the following page will open :

  • Answer "Do this later", we will take care of that a small bit later
  • VERY IMPORTANT: Print your backup code in case of loose of your Phone !!!

Print the code provided by Google and keep it always on you (or at home if you prefer), with this code you will be able to connect to your account and deactivate 2 Steps Authentication if you loose your phone and can't get a new code quickly.

Without this code and without your phone or being able to access to a text message Google could send you if required, you will irremediably loose your account access !!!

  • Configure your Phone, click on your smartphone System:


  • You will get this page:


  • Take your Phone and install the Google application "Google Authenticator" :
With Apple's Iphone:



  • Open Google Authenticator:
NB: 
Sorry Screenshots will be in french :)

As i already had a Google account configured, you will see one at the bottom of the screen.
As a consequence, you know now that you can have various Google account configured using 2 Steps authentication !



  • Select the "plus" sign and then select the option "Read bar code":




  • Use your smartphone camera to get the Bar code, Google Authenticator will detect it and automatically add the associated service in the application !
  • Last Step, enter the validation code provided by your phone into your web browser and submit, you're done and 2 steps authentication has been activated


Step 2: Sign out and access to your account using 2 steps authentication

How does it work:

Google Authenticator automaticaly generates a new validation code associated with your account every minute.

When you will sign in in any non trusted computer, you will obligatory have to provide :

- Your login name
- Your account password

And now the Google verification code, it has to be still valid when your enter it in your browser and submit, if not you have to try again using the re-generated code.

 As explained before, you also have the possibility to you allow the computer you are connecting with to be associated as a trust computer.
In other words, if you allow that, there is no validation code required during 30 days and so no 2 steps authentication.

Off course, you should do that only with your own personal computers.
  • Sign in into your account as usual (if not done before, sign out before signing in again)
You will get this new Window on any non trusted computer:

If you want to trust this computer, tick the box.

In any case, enter the code provided by Google Authenticator and Submit "Verify", if your code is valid then you'll be connected.

You have to this every time you connect from a non trusted computer.

Step 3: Configure "Applications codes" for additional access to your account

Any application that was connecting to your account won't work anymore after you activated the 2 steps authentication.

As far an example, your Apple mail Application will be unable to connect to your account until you configure a specific application code to allow it : Iphone, Chrome synchronization...

It will be the case for any application that automatically connects to your Google account and for any Google service associated with your account.

  • Configure a specific Application code for any access needed (you'll do it one time per application that needs an access)
Go back to your account management.

Select "Authorizing applications and sites":

On the new page, Choose a description for your Application and click "Generate Password":


You will get a dedicated password for you application:


And then simply configure your application (in the example your gmail account configuration in your Iphone) and use this password instead of your account password, and you're done !

Repeat this operation for any application that needs access to your account.


Conclusion:

You're done, your Google account access is now much more secured than simply using a standard password mechanism protection.

It happens very often that well known Internet companies are hacked and password databases stolen, if you have the bad idea to use the same password (or even same syntax) it is not really difficult to associate it with your Google account and gain access to it...

With strong Authentication as Google provides, things are much more complicated, hacking your account won't be easy anyway!

As a conclusion, with constant development of Clouds services like Google Drive, a such security mechanism becomes necessary and something you really have to consider if you are interested in protecting your data. 














Google Account Howto - Protect and secure your Google Account (gmail, google+, Google Drive...) with Strong Authentication (turn your phone into a Software Secure Token, use 2 steps authentication)

The Goal:

How much is your Google account precious to you ? Does Google host your mails, contacts, documents of all sorts (thanks to Google Drive), professional or confidential datas ? Do you think only protecting it with a password (even strong) is enough ? You may be wrong !

Google offers you a great and free service which is almost the better way to secure your account access and really improves the security of your Google services and your personal data security.

They call it "2 Steps Authentication", in professional environment you may already know it as "Strong Identification" such as RSA SecureID and others professional solutions.

Off course Google gives you all required explanations here:

My Goal here is to present you and easily help to activate this great Google service in a few simple steps.
It will drastically improve your account Security!

With this service, the only way to connect to your account will be to get your login name, your current password and to steal your Smartphone!


What you need:


  • First of all, a Google account ! ^^
  • A computer
  • A smartphone that will act as the Security device, IOS, Android or RIM (even an Ipad or could do the job you will have to always keep it in the pocket !)
  • Optionally a printer to be able to print your personal code for safety 

Step 1: Connect to your Google Account and activate the 2 Steps authentication


  • Connect to your Google account management interface and sign in:
 (you may also connect to any Google service such as gmail, Google Drive..développement. and access to your account properties) :

  • When connected, click on "Security" (bottom left page) :

















  • In this new page, look a at the middle of the page and click on "Edit" :
  • In the animation page, Click on "Start Setup" (bottom right):
  • Enter your (real) phone number and select Text message for the way to transmit you the activation code and submit:

  • You will receive a text message from Google, Enter the received code:
  • Select if you want or not trust the computer you are connected to for 30 days:
If you are on your personal computer you can activate this to avoid having to systematically submit your verification code using Google Authenticator.

If you are a non private computer, don't activate this this is not a computer you can trust !

  

  • Confirm to activate:


  • In the new page, Sign in (you do not yet need to provide a verification code because not things are not yet over ^^), the following page will open :

  • Answer "Do this later", we will take care of that a small bit later
  • VERY IMPORTANT: Print your backup code in case of loose of your Phone !!!

Print the code provided by Google and keep it always on you (or at home if you prefer), with this code you will be able to connect to your account and deactivate 2 Steps Authentication if you loose your phone and can't get a new code quickly.

Without this code and without your phone or being able to access to a text message Google could send you if required, you will irremediably loose your account access !!!

  • Configure your Phone, click on your smartphone System:


  • You will get this page:


  • Take your Phone and install the Google application "Google Authenticator" :
With Apple's Iphone:



  • Open Google Authenticator:
NB: 
Sorry Screenshots will be in french :)

As i already had a Google account configured, you will see one at the bottom of the screen.
As a consequence, you know now that you can have various Google account configured using 2 Steps authentication !



  • Select the "plus" sign and then select the option "Read bar code":




  • Use your smartphone camera to get the Bar code, Google Authenticator will detect it and automatically add the associated service in the application !
  • Last Step, enter the validation code provided by your phone into your web browser and submit, you're done and 2 steps authentication has been activated


Step 2: Sign out and access to your account using 2 steps authentication

How does it work:

Google Authenticator automaticaly generates a new validation code associated with your account every minute.

When you will sign in in any non trusted computer, you will obligatory have to provide :

- Your login name
- Your account password

And now the Google verification code, it has to be still valid when your enter it in your browser and submit, if not you have to try again using the re-generated code.

 As explained before, you also have the possibility to you allow the computer you are connecting with to be associated as a trust computer.
In other words, if you allow that, there is no validation code required during 30 days and so no 2 steps authentication.

Off course, you should do that only with your own personal computers.
  • Sign in into your account as usual (if not done before, sign out before signing in again)
You will get this new Window on any non trusted computer:

If you want to trust this computer, tick the box.

In any case, enter the code provided by Google Authenticator and Submit "Verify", if your code is valid then you'll be connected.

You have to this every time you connect from a non trusted computer.

Step 3: Configure "Applications codes" for additional access to your account

Any application that was connecting to your account won't work anymore after you activated the 2 steps authentication.

As far an example, your Apple mail Application will be unable to connect to your account until you configure a specific application code to allow it : Iphone, Chrome synchronization...

It will be the case for any application that automatically connects to your Google account and for any Google service associated with your account.

  • Configure a specific Application code for any access needed (you'll do it one time per application that needs an access)
Go back to your account management.

Select "Authorizing applications and sites":

On the new page, Choose a description for your Application and click "Generate Password":


You will get a dedicated password for you application:


And then simply configure your application (in the example your gmail account configuration in your Iphone) and use this password instead of your account password, and you're done !

Repeat this operation for any application that needs access to your account.


Conclusion:

You're done, your Google account access is now much more secured than simply using a standard password mechanism protection.

It happens very often that well known Internet companies are hacked and password databases stolen, if you have the bad idea to use the same password (or even same syntax) it is not really difficult to associate it with your Google account and gain access to it...

With strong Authentication as Google provides, things are much more complicated, hacking your account won't be easy anyway!

As a conclusion, with constant development of Clouds services like Google Drive, a such security mechanism becomes necessary and something you really have to consider if you are interested in protecting your data.