Project

General

Profile

IPTV: MKV instead of TS

Added by Chris Pazz about 5 years ago

Hi,
in my m3u I also have some channel that links to mkv files instead of TS streams.
Is there a way to have tvh play those streams?

When scanning those mux I always get "scan no data, failed".

Thank you


Replies (13)

RE: IPTV: MKV instead of TS - Added by K Shea about 5 years ago

When you create the mux (which should be an IPTV mux), try using this for the URL:

pipe:///path/to/ffmpeg -loglevel fatal -i http://stream-link.m3u8 -c copy -flags +global_header -strict -2 -metadata service_provider=Provider_Name -metadata service_name=Service_Name -f mpegts pipe:1

Replace /path/to/ffmpeg with the full path to ffmpeg (note the three slash characters together). Requires a current version of ffmpeg, use "which ffmpeg" (without the quotes) from the Linux command prompt to check, it should show the path to ffmpeg if you have it.

Replace http://stream-link.m3u8, Provider_Name, and Service_Name with appropriate values - the last two can be whatever you like, but use underscores in place of spaces (if any).

RE: IPTV: MKV instead of TS - Added by Chris Pazz about 5 years ago

Thank you for answer.
I have ffmpeg 3.3.3

I tried but it is still scan, no data.
Also, If in my m3u (automatic scan of muxes) there are more of these kind, shoud I have to edit them all one by one or is there any massive change?

Ty
Chris

RE: IPTV: MKV instead of TS - Added by Robert Cameron about 5 years ago

New development versions of Tvheadend have a MPEG-TS PASS type which you can use to pipe all inputs into an external program, but not sure if that would work in this situation. When scanning for data on muxes, Tvheadend needs the input to be in a TS container.

RE: IPTV: MKV instead of TS - Added by Dean s about 5 years ago

I'm having the same problem.. where I have some of my iptv in ts and other (vod) in mkv.
Can someone guide me through a solution?

RE: IPTV: MKV instead of TS - Added by K Shea about 5 years ago

Dean s wrote:

I'm having the same problem.. where I have some of my iptv in ts and other (vod) in mkv.
Can someone guide me through a solution?

Basically the pipe:// syntax I posted above should work for any IPTV stream (just replace the .m3u8 link with the .mkv link) BUT there is a big caveat. If all ffmpeg has to do is container conversion, such as when it converts .mp4 to .ts, then the conversion takes place significantly faster than real time and therefore will work. The problem is that if you are doing a conversion that actually changes the video format (not just the container), no consumer-grade system that I am aware of can do that in real time or faster, therefore trying to use the pipe:// syntax in that situation will fail because ffmpeg just can't keep up with the incoming stream.

I'm not familiar with .mkv streams so I don't know if converting .mkv to .ts is just a container conversion or an actual video format conversion. I would assume that because the -c copy argument is used, all the actual streams are simply copied and the only thing changed is the container (as is the case when converting .mp4 to .ts) but I can't be sure.

The other thing about using the pipe:// syntax is that it seems to deal best with single streams. Since you are adding it as a mux, in theory it can handle multiple streams, but in practice it doesn't always work (and it may in part depend on which version of Tvheadend you have as to whether it works). And the contents of something like a .m3u8 file can change at any time, which could necessitate needing to rescan the mux (assuming this works in the first place).

When you create the mux, these are the settings you need to be most concerned about:

Enabled: Enable
EPG scan: Disable
URL: Your pipe://... goes here (see my previous post)
ATSC: (leave unchecked)
Mux name: Give it a meaningful name (whatever you like)
...
Scan status: PEND (so it will scan the mux and hopefully find the stream(s))
...
In Tvheaend 4.2 or later you MAY also need to check these boxes under Expert Settings:
Accept zero value for TSID
EIT - skip TSID check

With regard to the last two, the problem with Tvheadend is every new version seems to add more settings but they don't always document what the new settings do, or in what situations they should be used. I created all my IPTV streams under 4.0 and they worked at the time I created them, though most have stopped working since, because providers change their stream addresses. But there were fewer settings in 4.0. My GUESS is that to more closely emulate 4.0 behavior you need to check both of those boxes, but I don't know for sure.

RE: IPTV: MKV instead of TS - Added by Dean s about 5 years ago

Thank you for all the details.
However, changing each stream(mux) is unacceptable because my iptv provider keep updating his vod...
Moreover the commend you gave didn't work for a single stream I checked:/

Any ideas people?
my mkv data:

encoder : libebml v1.3.4 + libmatroska v1.4.5
creation_time : 2017-09-13 01:17:20
Duration: 02:34:43.23, start: 0.000000, bitrate: 5496 kb/s

RE: IPTV: MKV instead of TS - Added by K Shea about 5 years ago

Dean s wrote:

Moreover the commend you gave didn't work for a single stream I checked:/

Can't help you then but usually a single steam works - you may need to include the full path to ffmpeg, e.g pipe:///usr/local/bin/ffmpeg ... (note the 3 slashes after pipe: )

In fact I think I will change my previous reply since including the full path is always safer and sometimes necessary, and I think it might be necessary in 4.2 and above.

Hope someone else can help you with your particular issue. This is something that simply may not be doable since I don't think Tvheadend has any way to automatically refresh the mux every time you try to tune or record the channel. I only suggested ffmpeg in the first place because it can often take a stream that makes no sense to Tvheadend and translate ii into something Tvheadend recognizes as valid. I know that the Tvheadend devs keep adding stuff to better deal with streams but the problem is they don't always document what they have done, so the capability to do what you want might be available (or will be in a future version) but right now it might be that no one knows how. But I hope in this case I am wrong and that you do find an answer. If you do, please post it, since it would probably be helpful to many other users.

P.S. Can you play the stream in VLC? If not there is about zero chance it will work in Tvheadend, but if you can then there is hope.

RE: IPTV: MKV instead of TS - Added by Dean s about 5 years ago

pipe:///usr/bin/ffmpeg -loglevel fatal -user-agent Kodi/14.1 -i http://INPUTLINK -codec copy -bsf:v h264_mp4toannexb,dump_extra
-metadata service_provider=PROVIDER -metadata service_name=SERVICE -tune zerolatency -f mpegts pipe:1

did the job :)

RE: IPTV: MKV instead of TS - Added by Anonymous about 5 years ago

HI Guys,

Sorry if i'm looking stupid, but i want to try to solve the same thing, i guess... In my .m3u file also some VOD streams as MKV. But i do not understand how to fix... :-(

This is what i have (done):

- Installed LibreElec
- Installed TVHeadEnd Server
- Installed TvHeadEnd Client
- Created Autamatic IPTV Network, with service ID "1" so it does not have to search all services to muxes
- Mapped created services

My Issue:

- All TS Files work fine, but none of the .mkv files will play.

Can someone take the time to help me step by step what to do to get this fixed?

Thnx up front!

RE: IPTV: MKV instead of TS - Added by Robert Cameron about 5 years ago

As already stated, Tvheadend only works with MPEG-TS streams for IPTV muxes. This means that in order for Tvheadend to scan them and find/assign a service to an IPTV mux, the stream must be MPEG-TS (.ts stream/file).

You can either convert the stream before it gets to Tvheadend (so your playlist file points to the converted transport stream), or you can use a pipe:// protocol descriptor as described above to convert the file/stream to a transport stream that Tvheadend can read; ffmpeg is most often used for this, but gstreamer and others ought to work, too.

RE: IPTV: MKV instead of TS - Added by Anonymous about 5 years ago

Hi Robert,

Thnx for the quick reply! :-)

But i really do not understand how-to use pipe:// protocol... Can you give me a link you YouTube or so so i can see how this works?

Thnx up front!

RE: IPTV: MKV instead of TS - Added by Robert Cameron about 5 years ago

Chad Derksen wrote:

Hi Robert,

Thnx for the quick reply! :-)

But i really do not understand how-to use pipe:// protocol... Can you give me a link you YouTube or so so i can see how this works?

Thnx up front!

The post immediately before yours shows a pipe command. This is what gets put in your M3U playlist, instead of the http://, file://, or other protocol. So if your M3U reads:

#EXTINF:-1,IPTV VOD stream
http://vod.tld/movie.mkv

it would now instead read:
#EXTINF:-1,IPTV VOD stream
pipe:///usr/bin/ffmpeg -loglevel 0 -re -i http://vod.tld/movie.mkv -c copy -flags +global_headers -f mpegts pipe:1

That will repackage the movie from a Matroska container to a MPEG transport stream container with no other changes. You may need other options depending upon the format of the source. (In my personal experience I needed to add headers to the stream for Tvheadend to process it, but your mileage may vary. If your source is a file and not an actual live broadcast stream, the -re option is needed to force ffmpeg to process it as a live stream. Check out the ffmpeg documentation. It is quite extensive, but well documented.)

RE: IPTV: MKV instead of TS - Added by Anonymous about 5 years ago

Cheer, thnx! :-)

    (1-13/13)