MpegTV Server

What is mpegtv?
MpegTV is an mpegts streamer/restreamer
 - Written in C (Amd64 direct machine code no scripting/emulation/virtualisation)
 - Built-in h262,h264 and h265 analyser (no need to ffmpeg for restreaming)
 - Mysql database storage.
 - Very fast clients connection and channel zapping (works smoothly even with ddos attack)
 - Easy clients,streams.. manipulation (add/edit/disable/enable/delete).
 - On-demand channels option.
 - picon, epg and series support.
 - MAG devices support.
 - full xtream-codes panel compatibility (get/panel_api/player_api)
 - unlimited loadbalancers, clients, stream, channels...
 - optimized search into database (treats 30000 clients as they are only 300)
 - very low cpu usage (can be installed on VPS).
 - multi level subreseller system.
 - built-in activecode system with free android app
 - built-in anti-bruteforce attack.
Install MpegTV+Slave on Ubuntu 20/21
chmod 755
Install MpegTV+Slave on Ubuntu 18.04
chmod 755
Install Slave
Install Slave on Ubuntu 22.04 with (SSL/LIBAV)
chmod 755
Install Slave on Ubuntu 20.04/21.04 with (SSL/LIBAV)
chmod 755
Install Slave on Ubuntu 18.04 with (SSL/LIBAV)
chmod 755
Install Slave on any distribution without (SSL/LIBAV)
chmod 755
must reboot after install
Execute Main
Open now your browser and enter the server url with the http port
default login user: admin
default login pass: admin
Execute Slave Server (EX: load_balance_port=9999, main_server_ip= )
slave <port> <main_server_ip>
slave 9999
Migration from Xtream to Mpegtv
First Run Panel so it will install a new mpegtv database
Copy your xtream_iptvpro database to server and install into mysql (ex: "/root/xtream_iptvpro.sql")
mysql -p{mysql-password} -e "create database xtream_iptvpro"
mysql -p{mysql-password} xtream_iptvpro < xtream_iptvpro.sql
Restart mpegtv with xtream database
killall mpegtv
mpegtv --xtream

Open web interface in browser with your XTREAM login data (url=http://localhost:8080)
Check your database and then Click on overwrite database

in putty, you can see infos

Restart mpegtv normally
killall mpegtv
History log:

 [08.02.2021] r627
	- fixed hevc parser
	- slave: fixed memory release
	- js: fixed restream playlist page
	- js: added server filter to stream page

 [30.01.2021] r620
	- portal: fixed series create_link
	- mpegtv: reduced memory to store client/vod/epg
	- fixed libav working threads
	- epg: added daystokeep data option
	- playlist: added reseller owner
	- fixed web pages and javascript files
	- mysql: fixed saving country list
	- fixed distributed stream processing
	- slave: added memory infos and auto-restart
	- slave: close persistent connections and fixed streams priority
	- fixed get/panel_api/player_api with client output permissions (live/movie/series)
	- on-demand: check always connected streams
	- free all stream data on disconnection

 [24.11.2020] r601
	- portal: fixed VOD sub categories on mag clones
	- web: added search by id list
	- web: fixed update logo
	- fixed server connection.

 [06.11.2020] r589
	- fixed mag portal.
	- fixed tmdb and added api for arabic movies.
	- added reseller/client country list restriction.
	- added https server and client.
	- fixed epg downloader and parser.
	- changed web interface from static pages to dynamic.
	- many bugs fixes.

 [06.03.2020] mpegtv/slave (r499)
	- MAIN: fixed data exchange mpegtv/slave causing many bugs.
	- fixed category group in different playlists.
	- fixed portal connection, vod and series.
	- added Period webpage, auto loadbalancing, reseller options ...
	- many bugs fixes (web/clients/streams).

 [09.01.2020] mpegtv/slave (r410)
	- many bug fixes.
	- fixed tv archives and timeshift link.
	- added auto load balancing.

 [22.12.2019] mpegtv/slave (r350)
	- fixed vod typo.
	- fixed offline streams when slave reconnect.
	- fixed slave crash.

 [22.12.2019] mpegtv/slave (r348)
	- fixed connection between slaves and mpegtv
	- fixed timeshift in web page
	- added tv_archive in panel_api and player_api
	- added timeshift channel (ex:channel with time delay of one hour, http://ip:port/timeshift.php?username=*&password=*&stream=*&interval=60)

 [18.12.2019] mpegtv/slave (r339)
 	- added tmdb
 	- added tv archives
	- added reseller admin options
	- fixed ffmpeg reader.
	- fixed loadblanace connection
	- fixed portal
	- fixed enigma2
	- fixed ssl connections

 [06.12.2019] mpegtv/slave (r294)
	- added series infos in player_api
	- added series and logos in enigma2.
	- fixed bouquet/category editor.
	- fixed web post replies.
	- fixed web pages (restream/channel/vod)
	- fixed portal.
	- fixed HLS output.
	- added slave/mpegtv update from panel (after this update you dont need to login via ssh to update your files)
	- fixed stream selection algorithm
	- streams with priority 100+ have streaming priority on other streams.
	- fixed freeze when using max-connected streams to 1
	- added streams/clients detailed infos
	- fixed loadbalance.
	- fixed max streams connections per restreamer.
	- fixed mpegtv/slave connection.
	- fixed internal functions.
	- many bug fixes.

 [23.11.2019] mpegtv/slave (r242)
	- web: added channels and servers json output.
	- web: moved channelList from static html page to javascript code (test before moving all pages to js)
	- added channel mass edit/delete/pause...
	- added auto refresh channel page.
	- web: added import channel from m3u8 file.
	- fixed hls output.
	- slave: speedup database loading.

 [17.11.2019] mpegtv/slave (r227)
	- fixed http requests receiver.
	- fixed multi-connection detection for clients with max_conn=1

 [15.11.2019] mpegtv/slave (r221)
	- Added Most Watched VOD
	- Fixed already used Mac info
	- Block multi-connection on same channel
	- Added flag to disable internal assets (js+css)

 [14.11.2019] mpegtv/slave (r217)
	- fixed channel redirection
	- fixed invisible auto-deleted client
	- fixed xmltv
	- added auto update
	- added VOD/files browser (insert/list/rename/delete/create/exec)
	- added HLS/m3u8 output only to normal clients.
	- fixed portal
	- reduced time to load data from mysql.
	- fixed creditlog pagination

 [06.11.2019] mpegtv/slave (r186)
	- added Restart slave/mpegtv 	 
	- fixed import channel 	 
	- fixed reseller inactivity timeout
	- fixed vod buffer overflow
	- enable active clients deletion
	- fixed expired clients deletion

 [05.11.2019] slave (r184)
	- fixed https links
	- fixed rtmp links
	- fixed VOD streaming (changed max speed to 8Mbps)

 [29.10.2019] mpegtv (r171)
	- Changed style (1st step)
	- Added delete buttons.
	- Auto-detect VOD location.

 [25.10.2019] slave (r158)
	- removed updated of r156 and r157.

 [24.10.2019] slave (r157)
	- fixed m3u8 reader causing high cpu usage.

 [23.10.2019] slave (r156)
	- fixed internal stream reader.
	- fixed url parser.
	- fixed http range causing video problems.

 [18.10.2019] mpegtv, slave
	- fixed palyer_api typo.
	- added missing request 'get_vod_info' in player_api.
	- fixed: send streams to clients.
	- fixed: change stream reader from ffmpeg to internal.
	- fixed create activecode.

 [17.10.2019] mpegtv
	- fixed api (please download 'files/api.tar.gz' for more infos)
	- fixed subreseller bug
	- fixed server bugs.
	- fixed player_api series infos.

 [12.10.2019] mpegtv, slave
	- fixed ondemand buffering (must update all slaves)
	- added more API requests

 [10.10.2019] mpegtv, slave
	- fixed buffer overflow bug.
	- added ffmpeg stream reader (not available on ubuntu14)
	- fixed api request /api.php?action=user&sub=edit
	- fixed api request /api.php?action=user&sub=info

 [07.10.2019] slave
	- fixed loadbalance channel reconnection.
	- fixed ondemand.
	- fixed invalid url bug.

 [07.10.2019] mpegtv
	- fixed stalker wrong theme path.

 [06.10.2019] mpegtv, slave/14
	- fixed slave crash.
	- fixed mag, added series, added stalker 'path/theme/devices_list' in global config
	- added grace period for clients

 [03.10.2019] mpegtv, slave/14
	- fixed slave bug.
	- api.php: added user create/info/edit.
	- fixed web interface
	- added multi bouquet for clients.
	- fixed non-stop ondemand.

 [01.10.2019] slave
	- fixed stream reader.

	- fixed mpegtv, last update dont connect

 [28.09.2019] update slave_14, slave, mpegtv
	- fixed connection bug for good
	- fixed loadbalance

 [26.09.2019] update slave, mpegtv
	- fixed channel ondemand
	- fixed mpegtv conection bug (PLEASE UPDATE TO NEW VERSION)

 [25.09.2019] update mpegtv
	- added client search by mac address
	- fixed live links 'http://host:port/user/pass/id'
	- fixed mpegtv connection timeout when sending a huge database to slaves

	- import all series/vod database from xtream
	- fixed paiement system now by default prepaid.

	- fixed vod in mag, portal must be entred like that in mag: http://hostname:port/c/ (dont forget forward slash "/" after c)

	- fixed mag portal
	- xconv: added conversion of forced_country,reseller_notes,admin_notes from table users
	- xconv: identify channel server_id from database
GENERAL OPTIONS (/var/mpegtv/mpegtv.cfg)
HTTP PORT: <port value>
Listening port for HTTP server
MYSQL SERVER: <mysqlserver ip/host>
Mysql hostname
MYSQL USERNAME: <username>
Mysql connection
MYSQL PASSWORD: <passsword>
Mysql connection
MYSQL DATABASE: <database>
Mysql database name
load ipcountry data from csv file
Convert Xtream-codes database to Mpegtv
Xtream to Mpegtv Converter
xconv ouputs sql requests for mpegtv database
Usage: xcon -u <mysql_username> -p <mysql_password> -d <xtream_database>

1. Download xconv
wget -O /usr/local/bin/xconv
chmod 755 /usr/local/bin/xconv
2. Upload you Xtream_iptvpro dump in server
3. Create xtream_iptvpro database
echo "create database xtream_iptvpro" | mysql -p
4. Install xtream_iptvpro database
mysql -p --default-character-set=utf8mb4 xtream_iptvpro < xtream_iptvpro.sql
5. Get the converted database
xconv -u mysql_username -p mysql_password -d xtream_iptvpro > mpegtv.sql
6. Create mpegtv database
echo "create database mpegtv" | mysql -p
7. Update mpegtv database
mysql -p mpegtv < mpegtv.sql
Panel Screenshots

ActiveCode APP Screenshots

Source Code Of ActiveCode APP