Giter Site home page Giter Site logo

phpbg / watchtv Goto Github PK

View Code? Open in Web Editor NEW
27.0 4.0 5.0 869 KB

This is a small server that allows you to watch digital television on your computer and your local network.

License: MIT License

JavaScript 68.75% CSS 4.89% PHP 24.15% HTML 2.01% Shell 0.20%

watchtv's Introduction

Watch TV

This is a small server that allows you to watch digital television on your computer and your local network.

Features

  • scan and configure TV channels
  • browse your TV channels and EPG from a web browser
  • view current EPG while browsing channels
  • stream tv using RTSP 1.0
  • Kodi support, see below
  • watch simultaneously all channels in the same multiplex
  • logical channel numbering (please note that this is not standard and may depend on your country)

Quick installation (debian, raspbian, ubuntu)

wget https://github.com/phpbg/watchtv/releases/download/1.1.0/watchtv-1.1.0.tar.gz
tar xf watchtv-1.1.0.tar.gz
cd watchtv/
sudo ./install.sh

Is is compatible in my country?

Use this map to know your broadcasting technology.

  • This has been developed and tested on a DVB-T network only, with MPEG-4 (H.264) streams.
  • It will probably work on DVB-T2 (not tested yet).
  • It may work on other networks (Cable, Satellite, ATSC), but it is yet untested.
  • Please open an issue or merge request to report your success or failure to improve this software.

Requirements

You can run the server and the client on the same device if you want.

Client

  • Must be powerful enough to decode TV streams, that will probably be MPEG 2 (H.262) or MPEG 4 (H.264) or MPEG H (H.265).
  • Desktop:
    • MPV (recommended)

    • MPlayer

    • VLC: expect troubles with VLC

      • TCP does not work with VLC (it is supported but I didn't manage to make it work)
      • UDP is the default and works, but glitches are expected, probably because TS stream should be converted to RTP? (if you know well RTSP and RTP please feedback wanted)
    • Kodi using IPTV Simple Client

      Follow this guide

      You can copy m3u and epg URLs from main channels page (links at bottom). I highly recommend you disable caching channels in IPTV plugin configuration and in kodi PVR settings

  • Android
  • Web browser if you want to lauch channels from it

Server

  • Linux
  • PHP 7+
  • A TV adapter
  • ethernet network. Wifi works but please avoid wifi: wifi is not that reliable. I do not recommend you use wifi for the server side.

IMPORTANT: there is a bug in dvbv5 that may crash your raspberry sooner or later. Please wait for bug resolution before using this on your raspberries: bug report. If you experience the issue I highly suggest you install and use dvbjet from https://github.com/lightful/DVBdirect , it is faster and stable.

A raspberry zero-w is enough, although I recommend you something more reliable:

  • the raspberry zero will be pushed at it's own limits (expect 80% to 100% CPU)
  • it has wifi only (you may try USB attached ethernet adapter)
  • some TV dongles require a lot of current, and some power supplies don't handle this corectly
  • Raspberry pi does not have a reliable wifi (at least raspberry-zero and raspberry 3B have wifi troubles - raspberry 3B+ seems not to be affected). Discussion here and here

Manual installation

  1. Install requirements :

    Those requirements are already packaged in most ditributions: Ubuntu / raspbian

    $ sudo apt install php-cli dvb-tools

    Debian (as root)

    # apt install php-cli dvb-tools

    Archlinux

    $ sudo pacman -S php v4l-utils

    Fedora (as root)

    # dnf install php-cli v4l-utils
  2. Download latest release package from https://github.com/phpbg/watchtv/releases

  3. Extract it

    $ tar xf watchtv-1.1.0.tar.gz
  4. Test the server manually

    $ cd watchtv
    $ php server.php
    • Make sure there is no error.
    • You will be instructed to open a browser (on local machine or from your local network) to finish the configuration

Installing as a service with systemd (auto start at boot)

If you want the server to start automatically at boot, install it as a service.

  1. Edit watchtv.service
    • change ExecStart path, or copy the files extracted to /opt/watchtv
    • change User and Group or create watchtv user with useradd -U watchtv -M -G video
  2. Copy watchtv.service to /etc/systemd/system/
    $ sudo cp watchtv.service /etc/systemd/system/
  3. Reload systemd daemon
    $ sudo systemctl daemon-reload
  4. Start the service
    $ sudo systemctl start watchtv
  5. Enable the service at boot
    $ sudo systemctl enable watchtv

To check logs run $ journalctl -u watchtv

FAQ

Is my TV adapter compatible

See here for a complete list of DVB digital devices that should be compatible. Tested:

  • TerraTec Cinergy T Stick+: OK
  • RTL SDR v2: OK but some glitches appears after a few hours (when the dongle is hot)
  • Raspberry TV HAT should work. If you have one please open an issue or a merge request to report the status (try to run it for many hours to check longterm stability). Note: this device use SPI at 55Mhz. I don't know yet if this is sufficient to watch all channels within a multiplex...

Horizontal lines (more or less visible) on image

Your video may be interlaced.

With mpv, try pressing d to activate deinterlace

If it works, you can make it permanent with deinterlace=yes in ~/.config/mpv/mpv.conf

Make Windows 10 / Edge open channels in mpv

When you use the web interface with edge, you need to tell windows to open channel with, for example, mpv.

  1. Download this file
  2. Make sure mpv is installed here: C:\\Program Files\\mpv\\mpv.exe or update the downloaded file with the correct path
  3. Run the file (double click on it)

Ideas for future releases

  • Packaging for common linux distributions
  • Support Fedora and arch in install script
  • live update web interface to reflect avaliable channels when a stream is already running
  • multiple adapter support
  • pause (live recording)
  • scheduled recording
  • remote
  • performance improvements (starting a channel is way too slow)
  • watch TV directly in the browser with HTTP_Live_Streaming

Contributions

After cloning the project run:

git submodule init
git submodule update

Build a release

#Make sure log level is set to INFO in server.php
composer install --no-dev --optimize-autoloader
cd ..
tar --exclude='watchtv/.git' --exclude='watchtv/.idea' --exclude='watchtv/channels.conf' -czf watchtv.tar.gz watchtv/

watchtv's People

Contributors

dependabot[bot] avatar oliviernes avatar phpbg avatar samuelchemla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

watchtv's Issues

Please Help

Can you please explain how it works and what I need to set up .
I live in Australia, I want to watch streams from India, I have Linux servers from Digital Ocean & AWS in India. Do I need any hardware ?
I am having Digital TV subscription in India (have user ID & Password)
You help is appreciated
Thanks

Problem playing channels with a quote mark in the name

Hi Samuel,

My pull request #7 fixed the syntax error when I was clicking on the "Refresh channels" button of the configure page because of the quote mark in the channel "L’Equipe".

The error (from PHP) was : PHP Warning: syntax error, unexpected $end, expecting ']'

The channels can be displayed after adding the INI_SCANNER_RAW option in parse_ini_file().

They can all be played correctly with mpv but not "L’Equipe". Tinkering in your code, I thought I fixed the problem by removing the quote mark in the M3u8.php file because the weird thing is that sometimes it’s possible to play the channel "L’Equipe" (it worked by chance just after I modified the code and I didn’t try enough times). So I thought I fixed the problem before you show me that the M3u8.php file is only generating a m3u8 file.

The error (from bash) playing the channel "L’Equipe" is [warning] sh: 1: Syntax error: Unterminated quoted string

The only solution I found was to add a sed command after the dvbv5-scan like that :

sudo dvbv5-scan -v -o /path/to/channels.conf /path/to/data/dtv-scan-tables/dvb-t/fr-All && sudo sed -i -e "s/'/_/g" /path/to/channels.conf

The sed command replaces all single quotes with an underscore which seems fine as the single quotes should only appear in the channels’ names.

It is also possible to put back the quote mark in the M3u8.php generator as I have done in the pull request →replace("_","’")

As I don’t know PHP, I can’t add the sed command after the dvbv5-scan but it seems it solved the quote mark problem because I can always play the "L’Equipe" channel after replacing the quote mark by _.

What a stupid idea to put a quote mark in a tv channel name! :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.