Project

General

Profile

TVHeadend 4.0.8 watch live TV on mobile phone

Added by Stefan Jäger over 8 years ago

Dear all,

I have successfully set up TVH 4.0.8 on my R-PI3 and I can watch live TV at home.

Now what I really want to achieve is to watch live TV also when I am on vacation on my mobile apple phone.

I am not sure what options I have and was wondering if somebody could point me to the right direction?

a) transcoding using a newer TVH version????
b) Connecting via VPN to my home network and watching over VPN (what settings do I need)??
c) any other option???

Any hint would be highly appreciated.

BR,

Stefan


Replies (17)

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

This is exactly what I use my TVH installation for - when away from home I use an Amazon Fire TV box with Kodi installed and have access to all my live channels in the hotel room - it's fantastic :)

Firstly, I would recommend upgrading to the 4.1 branch as there are lots of improvements between 4.0 and 4.1, especially in the transcoding area.

For iOS, there is TvhClient in the app store which is a free app for streaming live video from TVH.

You then have two options, you can either;
1) Just open port 9981 and 9982 and connect directly from the client to your TVH install. If you have a dynamic IP then use something like DynDNS to keep a static URL to point at
2) Use VPN and connect to the local IP address of the TVH server when the VPN is active.

Personally I would (and do) use option 1, if your RPi is just hosting TVH then I can't see any reason not to just forward the ports - there is (in my opinion) very little risk in doing so provided your TVH web interface has a good password.

Let me know if you need any more help.

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Stefan Jäger over 8 years ago

Dear Jonathan,

Thanks a lot for your swift reply!

If I go for option (1) would you agree that I need to transcode the live TV stream to a smaller bitsize so it can be streamed via the internet without any performance issues?

If so, do you have any idea how to tweak the transcoding settings?

Is there any reason why you prefer option 1 over option 2? Does option 2 even work?

Wish you a good start of the weekend.

Best Regards,
Stefan

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

Hi Stefan

Yes transcoding is highly recommended for viewing over the internet, if you give me an idea of your upstream bandwidth I can suggest some transcoding settings.

Both options are viable but for my use case (mobile viewing on my iPhone and using an Amazon Fire TV) the VPN option would not work because the Fire TV isn't capable of initiating a VPN connection.

For an iOS or Android device, VPN will work perfectly fine but you'd need to initiate the VPN tunnel before you started streaming, just seems like an extra step for little benefit unless you are particularly paranoid about forwarding ports - I'm pretty security conscious but still opted for port forwarding over VPN as the risks of opening up the port were outweighed by the convenience of the connection always being available.

Hope this helps.

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Stefan Jäger over 8 years ago

Great thanks for your Support... I will try it follow your advice as much as I can however I am stuck already at the first step which is the upgrade from 4.0.8 to 4.1 . I have tried the following recommendation:

https://tvheadend.org/projects/tvheadend/wiki/AptRepository

But when I run the update I get an error message when downloading. Is it due to the fact that I need to uninstall my current version 4.0.8 in the first place??

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

What's the error you are getting?

There have been lots of issues with the official repository, especially with armhf builds (which the Raspberry Pi needs) so I've been compiling and publishing builds for the Raspberry Pi. Please refer to the following thread for details on how to add my repository:

https://tvheadend.org/boards/5/topics/21528

Once you've added the repository and done an update (apt-get update) then the latest armhf build should be available to install.

Have a go adding my repository and let me know how you get on.

p.s. I would recommend taking a backup of your current config just incase something goes wrong then you can revert

cp -aR /home/hts/.hts/tvheadend /some/other/path

Replace /some/other/path with a real path where you want to archive the config to. The -a flag ensures the file permissions and ownership are retained :)

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Stefan Jäger over 8 years ago

Hi Jonathan,

Thanks for your great support. I have managed to upgrade to version 4.1 based on your description.

Now I have tried to connect to the web-ui and for some reason my previous password is not working any longer. Is there a default username and password in the version I have installed? Or is there any way to reset username and password for TVH web-ui?

Any hint would be great!

Stefan

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

sudo dpkg-reconfigure tvheadend

Should allow you to reset the default credentials. It should prompt for an admin user and password.

If not there is something else you can do but try the above first. When you've done that restart the tvheadend service and try logging in again.

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Stefan Jäger over 8 years ago

Million thanks for your support!! In the meantime I have managed to fix all my issues (access issue, upgrade, ... :-)) Thanks!!

I am now able to access TVHeadend via the internet since I have setup port forwarding on 9981. I have also checked my DSL upload speed and it seems to be 951kBit/s.

Do you have any advice on how to best setup transcoding based on these upload figures??

Wish you a great evening.

Stefan

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

I've attached a couple of grabs of my profiles - I use them for different scenarios so they should give you an idea how to tweak the settings. I presume you know how to link a user to a streaming profile so that when you log in with a particular user they are automatically given that profile (handy for having a 'mobile' login for 3G streaming, a 'Wifi' login for wifi etc.)

Profile.FastWifi.png (205 KB) Profile.FastWifi.png This is my home wifi streaming profile
Profile.WiFi.png (225 KB) Profile.WiFi.png I use this in hotels where the wifi isn't always great
Profile.Cellular.png (208 KB) Profile.Cellular.png This is my cellular/3G streaming profile

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Stefan Jäger over 8 years ago

Thanks a lot for sharing. I will try accordingly. However for now I really struggle to set up user reliably.

Whenever I create new user and try to connect it seems to work for one or two connections via Web-UI but then the do not work anymore!?! I cannot really say what the issue is and would like to analyse?

Is there any way of setting up tvheadend user in a more reliable manner? Maybe it is possible to set up user without the UI (in config file or so)??

Is it also possible to analyse a log file about user access to see what the real issue is?

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

Hi Stefan

Sorry this has been so difficult for you - it's always the case that something that works perfectly fine for one person gives another person hell! :) Not to worry, I'll keep on helping you as much as I can.

The user configuration in 4.1 is different to 4.0 I believe so is a bit more complicated BUT a lot more flexible.

Let's take a scenario where you want a user whose content is always transcoded;

First, create a streaming (and optionally recording) profile that you're happy with using my tips above (or just use the defaults)

Next, create your user by navigating to Configuration > Users > Access Entries. Some clients need full access to the TVHeadend UI so to start with, configure your user as per my template below - we can always remove privileges later if you want to lock it down a bit

Enabled: Checked
Username: Whatever you like
Web interface: Checked
Admin: Checked
Streaming: Checked
Advanced streaming: Checked
HTTP streaming: Checked (if you want to use this user to stream via the web UI)
Video recorder: Checked
HTSP DVR: Checked
View all DVR entries: Checked (this lets this user see all DVR entries regardless of whether this user created them or not)
All DVR (rw): Checked (this gives this user the rights to alter DVR entries regardless of whether this user created them or not)
Streaming profiles: Pick the one you want to assign this user
DVR configuration profiles: Whatever you like - I use (Default profile)

Finally, switch to the Passwords type and create an entry with the same username as you used in the step above and whatever password you like.

Now open your client on your phone and enter the URL, port, user and password of your TVHeadend server and try watching a stream. If you open the web UI at the same time and navigate to the Status > Subscriptions and take note of the 'Username' and 'Profile' columns, you should see the user you created above logged in and the associated streaming profile being used.

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Stefan Jäger over 8 years ago

Hi Jonathan,

You're right! The new version 4.1 of TVHeadend offers quite some additional, impressive settings. And I really appreciate you helping me in setting it up correctly. In the meantime I have managed to set up three different streaming profiles (as indicated above) as well as three different users pointing to those profiles. Unfortunately I still have two very different issues:

User Issue

I have been able to set up all three users and link them to the streaming profiles; however connecting to tvh using these users only works:

a) with the Macbook (within my LAN) with which I have created those users
b) with the TVHeadend client on my iPhone (both within my network and via LTE)

In case I try to connect with the same users from

c) my iPhone using the browser or
d) from a different machine inside or outside my network

the credentials won't be accepted and I have no clue why that is?

Performance Issue

I have tried all three user and streaming profiles using my TVHeadend client on my iPhone (see b above) but all of them have performance issues and the wired thing is that is even has performance issues when I am in my own network (LAN)? Do you have any view on how I can better analyse which streaming profile suits my case most?

Background: I am using a R-PI3 and I have put already GPU_MEM in config.txt to 256MB. Other than that I have not applied any performance tuning yet.

Thanks for your support and wish you a great day.

Stefan

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

Issue 1 I believe is related to digest authentication, log in with your admin user and navigate to;

Configuration > General > Base

...and uncheck 'Use HTTP digest authentication'. I had a hell of a time with the web UI with digest auth turned on so I just disabled it. Disabling it will default back to basic HTTP authentication which is less secure but as I pointed out before, the risk of exposing the TVH box is minimal in my opinion, you may have a different approach to risk and if so, I'd suggest perhaps using your VPN option we discussed earlier. For the record, I access my TVHeadend box over the internet with just basic http authentication turned on.

Issue 2 is more difficult as the Raspberry Pi is by its very nature a low powered device and doesn't have a lot of 'grunt' to transcode video. I do however believe the Raspberry Pi has (for many years now) supported hardware transcoding of x264 content but I'm not sure TVHeadend supports it out of the box.

The single biggest thing you can do to reduce load is set 'Video codec preset' to 'Ultrafast'. This sacrifices quality for speed, although for mobile viewing you'd be hard pushed to tell the difference. Also make sure your resolution isn't too high - most profiles are set to 0 which is essentially 'pass-through' so if you try transcoding a HD stream that's a large resolution it has to transcode - try something small such as 320 to start with then work your way up if the quality is poor.

I'll see if I can find any more information about transcoding on the Pi 3 - I have the luxury of having (at least) one of every Pi model released so I'll try and get my Pi 3 set up with TVHeadend (it's currently in my comms cabinet providing home automation/HomeKit duties :) ).

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

Forgot to mention previously, make sure when you log into TVHeadend with your admin user that you have the user interface level set to 'Expert' - you can alter this using the drop down at the top right hand side of the screen.

This enables many options which I might be referring to above and may not be able to see them without changing this setting.

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Jonathan Thomson over 8 years ago

...sorry and one more thing, if a lot of your TV content is provided in MPEG 2, buy the MPEG2 license for the Pi (if you haven't already). It will offload deconding of the MPEG2 stream to the GPU and give you a little bit more head room for transcoding the video back out. Not sure where you're based but it costs less than a beer in most countries and is well worth it. I always buy the MPEG2 license and the VC-1 license for my RPi's - if nothing else it supports the great work of the Raspberry Pi foundation without whom none of this would be possible :)

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Stefan Jäger over 8 years ago

It is impressive how much you know about all of this!

Based on your support I could fix the user access issue. I have unchecked "Use HTTP digest authentication" which solved my issue! Million thanks for your help!!

In regards to the performance issue I can share the following:

- MPEG Codec I have bought and installed beforehand already
- 'Video codec preset' is set to 'Ultrafast' as proposed in all of your streaming profiles
- resolution is set to 320 as proposed in your Profile.Cellular

However so far I do not have too much success. I would have hoped that TVH supports GPU transcoding because the R-PI may be powerful enough from a Hardware perspective in case GPU transcoding is supported? I will also try a bit the streaming profiles and maybe I'll find something which works for me?

On a different note: Is it more performant if I record a TV stream and transcode the recorded file??

Wish you a good evening.

Stefan

RE: TVHeadend 4.0.8 watch live TV on mobile phone - Added by Martin Ritter over 8 years ago

There is really no need to include streaming profiles in a raspberry pi-version of tvheadend. The rpi isn't capable of transcoding either way except with gstreamer.
Just buy a fast Intel PC if you need transcoding! You are really wasting your time trying it with hardware as slow as raspberry pi.

    (1-17/17)