EPG Inside .ts File
Added by Mytril Goldhand almost 7 years ago
Hello,
i have an iptv stream in an .ts container format witch consist of a whole tv-series, which i have concatinated with ffmpeg and stream it to tvheadend.
Is it possible to add the epg data for the series. Like Episode 1 10:30 - 11:00 Episode 2 11:00 - 11:30 ... ?
Replies (13)
RE: EPG Inside .ts File - Added by Mark Clarkstone almost 7 years ago
Yes, provide/fake channel/EIT info in the mpegts stream
RE: EPG Inside .ts File - Added by Mytril Goldhand almost 7 years ago
Hallo Mark,
can you explain it a little bit more? How looks this data like? Is it an xml file which i merge with the ts stream?
RE: EPG Inside .ts File - Added by Mark Clarkstone almost 7 years ago
RE: EPG Inside .ts File - Added by Mytril Goldhand almost 7 years ago
This goes to the right side, but there is no explanation on the usage...
RE: EPG Inside .ts File - Added by Mark Clarkstone almost 7 years ago
The only other thing I could find was http://www.avalpa.com/the-key-values/15-free-software/33-opencaster
RE: EPG Inside .ts File - Added by Mytril Goldhand almost 7 years ago
This solution are not really suitable for me...
So now i have searched for other ways to get the epg at least into tvheadend and i have found xmltv. With this i can create an xml file in the xmltv format and import it into tvheadend and have an epg for my channel. So here are the basic information for all with the same problem.
xmltv file format:
http://wiki.xmltv.org/index.php/XMLTVFormat
http://xmltv.cvs.sourceforge.net/viewvc/xmltv/xmltv/xmltv.dtd
Activation in tvheadend:
Configuration -> Channel/EPG -> EPG Grabber Modules -> Activate External: XMLTV
Basic Creation/Importscript:
#!/bin/bash
function header {
echo "" > "$epgfile"
echo "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">" >> "$epgfile"
echo '<tv generator-info-name="xmltv generator">' >> "$epgfile"
}
function footer {
echo '</tv>' >> "$epgfile"
}
function channel {
echo " <channel id=\"$channelname\">" >> "$epgfile"
echo " <display-name lang=\"$channellang\">$channelname</display-name>" >> "$epgfile"
echo " </channel>" >> "$epgfile"
echo "" >> "$epgfile"
}
function program {
echo " <programme start=\"$programstart\" stop=\"$programend\" channel=\"$channelname\">" >> "$epgfile"
echo " <title lang=\"$programlang\">$programname</title>" >> "$epgfile"
echo " <desc lang=\"$programlang\">" >> "$epgfile"
echo " $programdescription" >> "$epgfile"
echo " </desc>" >> "$epgfile"
echo " </programme>" >> "$epgfile"
}
epgfile="/tmp/epg.xml"
header
#Channel Section
#channelname should be the same in tvheadend
channelname="Test1 Channel"
channellang="de"
channel
channelname="Test2 Channel"
channellang="en"
channel
#Program Section
programname="News"
programdescription="Test1 Description"
channelname="Test1 Channel"
programlang="de"
#Time in UTC in format YYYYMMDDHHMMSS
programstart="201711121500"
programend="201711121600"
program
programname="Monk"
programdescription="Test2 Description"
channelname="Test2 Channel"
programlang="de"
programstart="201711131210"
programend="201711131305"
program
footer
#Needs User hts or root
cat $epgfile | socat - UNIX-CONNECT:/home/hts/.hts/tvheadend/epggrab/xmltv.sock
createEPG.sh (1.62 KB) createEPG.sh |
RE: EPG Inside .ts File - Added by Jan g almost 7 years ago
can u please tell me more about it. i have several video files which i actually concat with ffmpeg to a stream which run a view days and then it restart when all files are played.
now i want to play them and have a epg to see which episode is running at the moment.
greetz
RE: EPG Inside .ts File - Added by Mytril Goldhand almost 7 years ago
Hello Jan g,
for my personal use, i have created two scripts.
The first script "konvToTV" concat the video files and creates a .txt file, which contains all filenames and duration.
The second script "createEPG" creates the epg, sends it to tvheadend and starts vlc. This script should be started as systemd unit Example "examoleunit".
So at first download both files and edit the sections titled with "Edit this" and end up with "Edit end"
Run konvToTV.sh for every series you want.
Create an systemd unit for every channel/http stream in /etc/systemd/system/ with edited content of exampleunit.service
There must be edited the field user,group and execstart.
At last you must have write access to the xmltv.sock, so use this command:
sudo chown user:user /home/hts/.hts/tvheadend/epggrab/xmltv.sock after you have configurated tvheadend "Configuration -> Channel/EPG -> EPG Grabber Modules -> Activate External: XMLTV"
createEPG.sh (2.52 KB) createEPG.sh | |||
konvToTV.sh (1.56 KB) konvToTV.sh | |||
exampleunit.service (305 Bytes) exampleunit.service |
RE: EPG Inside .ts File - Added by Jan g almost 7 years ago
thank you mytril
i tried it today and it worked perfekt. but i do it without vlc
you can add a pipe in mux stream:
pipe:///home/testchannel.sh
testchannel.sh looks like this:
hts@ubuntu:/home$ cat /home/testchannel.sh
#!/bin/bash
/home/epg.sh
/usr/bin/ffmpeg -re -loglevel fatal -f concat -safe 0 -i /home/outputfiles/list.txt -flags +global_header -c copy -metadata service_provider=IPTV -metadata service_name=$name -f mpegts pipe:1
so i did not concat all files into one file. with mux schedulers in tvheadend u can start the channel 24/7
RE: EPG Inside .ts File - Added by Mytril Goldhand almost 7 years ago
Hi Jan g,
nice idea, i searched a long time for a way to eliminate vlc for this project, but to use the mux scheduler to hold the channel is clever. But with wich parameters have you configured the mux schedul cronjob?
RE: EPG Inside .ts File - Added by Jan g almost 7 years ago
cron: * * * * *
timeout: 0
restart yes
so the channel starts when tvheadend is on (you have to wait 30 seconds then u see it under subscriptions). and it restarts when the last file is played
RE: EPG Inside .ts File - Added by Mytril Goldhand almost 7 years ago
Nice i have tried it and this works better and easier as my solution
But i have still a problem with the video part. Have you also the problem, that you can only see the video if you connect a second time to the same channel?
The problem shows up if i use x264, but if i use mpeg2 everything works great.
Or do you use another codec?
RE: EPG Inside .ts File - Added by Mytril Goldhand almost 7 years ago
No problem anymore, see https://tvheadend.org/issues/4856