Project

General

Profile

Connect TVHeadend to m3u8 stream

Added by Kony Kony over 7 years ago

Hello, I have such a problem, I have here streams on m3u8 streams in the form http: //xxxyyy.xx/mmmmmm_xxx.m3u8.

The m3u8 file contains:

  1. EXTM3U
  2. EXT-X-ALLOW-CACHE: NO
  3. EXT-X-STREAM-INF: PROGRAM-ID = 333, BANDWIDTH = 6000000, RESOLUTION = 1280x720
    Xxxxxx_profilex.m3u8

When I enter TVHeadend link http: //xxxyyy.xx/mmmmmm_xxx.m3u8 so I did it when scanning the FAIL throw. But as soon as this address goes to VLC, everything goes as it should.

I tried and put in the muxes address on the m3u file where it is:

  1. EXTM3U
    #EXTINF: 0, HBO HD
    Http: //xxxyyy.xx/mmmmmm_xxx.m3u8

But it is the same result, and once again I enter the address to m3u file in Firefox and open the file in VLC everything goes as it should.

Thank you very much for your advice


Replies (23)

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

M3U8 files are not media files. They are playlists, just like M3U: a plain text file describing a series of media files.

Tvheadend expects M3U playlists to MPEG-TS streams. Usually, M3U8 playlists are used for HLS, which are usually chunked/segmented bits of a whole. If you are certain that your streams are MPEG-TS and playable in Tvheadend, then this is something to look into further.

However, if your streams are not, you need to find a workaround. Generally, playlists of playlists are not a great idea (M3U containing references to M3U8). One option is to use a pipe:// URI in the M3U to call ffmpeg to convert the stream from HLS to MPEG-TS.

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

Yes you are right, it's a sequence of videos .. now I was wondering ... it's probably the HLS. How can I convert HLS to MPEG-TS ? Can it ever ?

In VLC it just works normally. I open the file with the m3u or m3u8 terminal and the station go right away.

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

Yes, as I mentioned in my first post. An IPTV network with a pipe:// URI, using ffmpeg to convert to an MPEG-TS.

pipe:///usr/bin/ffmpeg -i <INSERT M3U8 URL HERE> -c copy -f mpegts pipe:1

You may need some additional options, but that's the gist of it.

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

Well, this is an online streaming TV ... and I would like to do about 50 channels. It takes my entire computing power on the server.

And I have to enter this directly in SSH ? Or where do you mean to enter ? Can you send me a link to your topic?

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

There are many threads here on using the pipe:// protocol with an IPTV network to convert codecs or containers.

In short, the easy way is to create an M3U playlist, which each item being a "pipe://..." URI of the type I just posted above. Then you add that M3U as an Automatic IPTV network.

Otherwise, you can create a regular IPTV network, and for each channel you want to add, create a mux with the "pipe://..." URI in the URL field of the Create Mux dialog.

You may want to be certain about how many concurrent streams your IPTV provider allows you, and set this as the max in your Network settings, otherwise your IP may get blocked by your provider when Tvheadend attempts to scan the muxes for services.

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

So this address
Pipe: /// usr / bin / ffmpeg -i <INSERT M3U8 URL HERE> -c copy -f mpegts pipe: 1

Will I enter directly in MUX settings ???

I will not put it in a set m3u ???

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

Kony Kony wrote:

So this address
Pipe: /// usr / bin / ffmpeg -i <INSERT M3U8 URL HERE> -c copy -f mpegts pipe: 1

Will I enter directly in MUX settings ???

I will not put it in a set m3u ???

If you read my post, you will see I gave 2 options:

1. Use the "Automatic IPTV network" type in Tvheadend to create a network from an M3U file. In that M3U file, you format it as:

#EXTM3U
#EXTINF:-1 tvh-chnum="<CHANNEL NUMBER>",<SERVICE NAME>
pipe://<PATH TO FFMPEG> -i <IPTV URL> -c copy -f mpegts pipe:1
#EXTINF:-1 tvh-chnum="<CHANNEL NUMBER>",<SERVICE NAME>
pipe://<PATH TO FFMPEG> -i <IPTV URL> -c copy -f mpegts pipe:1
...

Replace the <CHANNEL NUMBER> with the channel number you want the stream to be assigned in Tvheadend, replace <SERVICE NAME> with what you want the service (and the channel) to be named in Tvheadend, replace <PATH TO FFMPEG> with the path to your ffmpeg executable, and <IPTV URL> gets replaced with the URL to the M3U8 playlist of your IPTV channel.

After you have crafted your M3U playlist, save it some place that Tvheadend can read, and add it to Tvheadend. Make sure when you create the network you set the maximum number of streams to what your IPTV provider allows, of you may find your IP blocked and Tvheadend unable to tune any stream.

2. Create a regular "IPTV network". Then, you individually create each mux manually, setting its "URL" field in the creation dialog to the same "pipe://..." URI that you would have created for the M3U. (See 1 above for information on that.)

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

Thank you very much, I have already understood and it works

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

The last question, when I turn this on and give a link to my tvheadent friend, my IPTV provider will see I look at myself from my IP address ???

And where does the automatic iptv network still work? I only have an IPTV network

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

Kony Kony wrote:

The last question, when I turn this on and give a link to my tvheadent friend, my IPTV provider will see I look at myself from my IP address ???

And where does the automatic iptv network still work? I only have an IPTV network

You need to be a little clearer in what you want, because reading what you wrote, I'm very confused as to what you are asking. Trying being explicit in your questions?

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

This is because I do not know where to choose the IPTV network. But more than that, it makes me worry that when I add a stream, it will be stored in the name of the Service01 channel for all the streams as well.

The image iptv3.jpg is how I set up an IPTV network

Na obrázku iptv2.jpg je jak mám nastavený mux. celý odkaz co tam zadávám je pipe:///usr/bin/ffmpeg -i http://xxx.yyy/myyy.m3u8 -c copy -f mpegts pipe:1

And the picture in iptv1.jpg is what it looks like when it shows up those programs. But the name Service01 can not be changed, that would not be such a problem, but when I create a m3u file with links to those channels, then the name changes to all of Service01

iptv1.jpg (25.2 KB) iptv1.jpg
iptv2.jpg (72.1 KB) iptv2.jpg
iptv3.jpg (76.5 KB) iptv3.jpg

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

Resolved, enough in Muxes to skip the ATSC option:

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

But one more thing I would be interested in. And it. Is it possible to set the program that is streaming from tvhedend to run on some port?

Now it's like I have to enter the address in the stream in the form:

Http://192.168.1.33:9981/play/stream/service/b316d523813bf185becde9fc0ac82ff7?title=HBO%202%20HD%20%2F%20

But it would be better if it was in the form of:

Http://192.168.1.33:1000

And the next program is in shape

Http://192.168.1.33:1001
etc

Because my IPTV Provider can change the address of the stream and when I change it, of course it will change the link to my stream and then I have to edit it

And now I'm testing it and I've found a more serious problem, and that the picture is severely choppy. If I run a DVB-T program from a server, it does normally, but as soon as I leave the restream from the IPTV provider, it is severely choppy. So I figured it could not be set somewhere to make the quality of the stream worse? Just to not be in such a quality and take just 2 Mbit.

And another thing. TvHeadend runs on Alix with Atom. Can not it be the problem?

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

I had forgotten that ffmpeg will provide a generic service and network name. Those can be changed by modifying the ffmpeg command line the add the appropriate option after the -f mpegts option. I can't recall what it is, but there are posts on the forum here with it, and of course you can check ffmpeg's extensive documentation: http://ffmpeg.org

If you want your stream to be accessed from a particular port, then you need another program to handle that, like a reverse or application proxy. Relayd can do this, but I'm not sure about which Linux software would do it.

The quality of your stream being sent to Tvheadend can be modified by ffmpeg and transcoded. Again, read their documentation to find the appropriate options and what will work best for your situation.

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

And can not you set it by Stream Profile ??? So I have only three options, but there are pictures on the Internet where there are a few to choose from. So now I'm looking at how to add more options, and then I would specify in the user settings that the given user should have the given profile for the stream

So I upgraded tvhedend and there are some other profiles there, but once I select one for that user, so tvhedend will fall ...

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

Again, you are not being clear in what you are asking.

Kony Kony wrote:

And can not you set it by Stream Profile ???

Set what by stream profile? I have no idea what you are referring to.

If all you are looking to do is redistribute your IPTV streams, and want them offered in different resolutions/bitrates (quality), then perhaps you should look into ffserver or some other software more geared towards that type of use case.

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

I'm afraid that the picture is choppy. I have a 100/100 Mbit line on the server and I do not understand why it is choppy. So I'm trying what it might be like

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

I still ask one question that the stream from my IPTV ISP goes stream and there are different soundtracks, how can I choose the right one.

If I have a standard link:
Pipe: /// usr / bin / ffmpeg -i http: //xxx.yyy/mxxx.m3u8 -c copy -f mpegts pipe: 1

So the first track will be automatically blown away, but I would have to choose a different one. In VLC my tracks are going to switch, but how do I get TVHeadend to choose the track I need ????

Thank you so much for your patience

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 7 years ago

By default ffmpeg only selects the first stream of each type to pass to the output. You can control which streams are used by using the -map options.

RE: Connect TVHeadend to m3u8 stream - Added by Kony Kony over 7 years ago

Thanks a lot ... solved

Among other things, chopping was solved by moving to the latest 4.2

Probably the last question:

Is somehow solving EPG ??? When I get this stream I do not have an EPG. Is it possible to get an EPG? And this actually also recording ??

RE: Connect TVHeadend to m3u8 stream - Added by Joan Planas over 6 years ago

Robert Cameron wrote:

Kony Kony wrote:

So this address
Pipe: /// usr / bin / ffmpeg -i <INSERT M3U8 URL HERE> -c copy -f mpegts pipe: 1

Will I enter directly in MUX settings ???

I will not put it in a set m3u ???

If you read my post, you will see I gave 2 options:

1. Use the "Automatic IPTV network" type in Tvheadend to create a network from an M3U file. In that M3U file, you format it as:
[...]
Replace the <CHANNEL NUMBER> with the channel number you want the stream to be assigned in Tvheadend, replace <SERVICE NAME> with what you want the service (and the channel) to be named in Tvheadend, replace <PATH TO FFMPEG> with the path to your ffmpeg executable, and <IPTV URL> gets replaced with the URL to the M3U8 playlist of your IPTV channel.

After you have crafted your M3U playlist, save it some place that Tvheadend can read, and add it to Tvheadend. Make sure when you create the network you set the maximum number of streams to what your IPTV provider allows, of you may find your IP blocked and Tvheadend unable to tune any stream.

2. Create a regular "IPTV network". Then, you individually create each mux manually, setting its "URL" field in the creation dialog to the same "pipe://..." URI that you would have created for the M3U. (See 1 above for information on that.)

After reading this hint, I tried to do, at first, the second option to know how valid is my piping line and there is no problem.

However, when I try to apply the first option, that is to say, when I build the m3u file then it fails and log file said: [ ERROR] iptv: unknown playlist format for network

My m3u file shows like this:

#EXTM3U
#EXTINF:-1 tvh-chnum ="1",ServiceName
pipe:///usr/bin/ffmpeg -i http://server.com:8657/user/password/9967.ts -c copy -f mpegts pipe:1

Specs:

- Raspberry Pi 3B
- Libreelec 8.2.5
- TVHeadend 4.2

Somebody can help me, please ?

Joan.

RE: Connect TVHeadend to m3u8 stream - Added by Robert Cameron over 6 years ago

A few things:

First, do you have /usr/bin/ffmpeg? Second, are you sure your playlist is properly formatted (there should not be a space in the tvh-chnum attribute assignment). Third, what are the results of a command like (you'll have to manually kill the command after a bit…):

/usr/bin/ffmpeg -i "http://server.com:8657/user/password/9967.ts" -c copy -f mpegts pipe:1 | cat > test.ts

(Because Tvheadend often has problems with parsing arguments to external system commands, it's always a good idea to double-quote your URL. This has gotten better with 4.3 IIRC, but it's still an issue with 4.2. Also, LibreELEC is a very poor choice if you want to do anything more than the absolute basic; it simply is not really cut out for any real custom configurations.)

RE: Connect TVHeadend to m3u8 stream - Added by Joan Planas over 6 years ago

Robert Cameron wrote:

A few things:

First, do you have /usr/bin/ffmpeg? Second, are you sure your playlist is properly formatted (there should not be a space in the tvh-chnum attribute assignment). Third, what are the results of a command like (you'll have to manually kill the command after a bit…):
[...]

(Because Tvheadend often has problems with parsing arguments to external system commands, it's always a good idea to double-quote your URL. This has gotten better with 4.3 IIRC, but it's still an issue with 4.2. Also, LibreELEC is a very poor choice if you want to do anything more than the absolute basic; it simply is not really cut out for any real custom configurations.)

First at all, thanks for your hints and your interest.

1) If I create a simple IP Network and then I create a mux with my pipe URL line -> There is no problem.
2) If I execute your suggested command -> There is no problem.
3) My only problem is when I use my pipe URL line in a m3u file and then I use IPTV Automatic Network to process this file.

I normally use TVH with a DVB-T and DVB-S syntonizers and I have no problem with them (Muxes, Channels, EPG).
Now, I want to add a 50 IPTV channels, but I want to create a m3u file to import all the channels at same time.

Conclusion, I think that I have "parsing" problems in my m3u file to be correctly processed by TVH server.

    (1-23/23)