Project

General

Profile

FilmOn integration

Added by Pasi Porri over 9 years ago

Is there a way to integrate channels from FilmOn to tvheadend?
Would be easier to handle Kodi PVR addon if all the channels would come from same backend.


Replies (8)

RE: FilmOn integration - Added by Hanspeter Müller over 9 years ago

You can do this with http://docs.livestreamer.io/ (as pipe:// iptv-source in tvheadend)...

Regards,

/hp

RE: FilmOn integration - Added by Bengt Madeberg over 9 years ago

I tried this but.....

pipe:///usr/local/bin/livestreamer http://www.svtplay.se/vader best -O | /usr/bin/avconv -i pipe:0 -acodec copy -vcodec copy -bsf h264_mp4toannexb -f mpegts pipe:1

2015-03-03 23:39:25.146 mpegts: Vader in IPTV - tuning on IPTV
2015-03-03 23:39:25.153 spawn: Executing "/usr/local/bin/livestreamer"
2015-03-03 23:39:25.155 opentv-skyuk: registering mux Vader in IPTV
2015-03-03 23:39:25.159 subscription: 000B: "scan" subscribing to mux, weight: 5, adapter: "IPTV", network: "IPTV", mux: "Vader", hostname: "", username: "", client: ""
2015-03-03 23:39:25.227 spawn: usage: livestreamer [OPTIONS] [URL] [STREAM]
2015-03-03 23:39:25.227 spawn: livestreamer: error: unrecognized arguments: | /usr/bin/avconv -i pipe:0 copy copy -bsf h264_mp4toannexb mpegts pipe:1
2015-03-03 23:39:25.235 iptv: stdin pipe unexpectedly closed: No data
2015-03-03 23:39:40.146 mpegts: Vader in IPTV - scan no data, failed
2015-03-03 23:39:40.146 subscription: 000B: "scan" unsubscribing

It works in a terminal window. I think I know why it not works. How to solve it ?

RE: FilmOn integration - Added by dan jericho over 9 years ago

Is there a how-to or guide for this?

How are these added within the tvheadend interface?

Ive added an IPTV Network and attempting to add the pipe:// in the URL field of the mux?

Any help would be great.

Thanks

RE: FilmOn integration - Added by Bengt Madeberg over 9 years ago

https://tvheadend.org/projects/tvheadend/wiki/Custom_MPEG-TS_Input

You can use ffmpeg, avconv etc. But what I tried above was to let livstreamer find the URL and put it to avconv. If you have the URL it's easy. But some streams will change the URL several times a day. Then it would be good if livestreamer could be used since it will fetch the (new) URL automatically each time you start the stream.

RE: FilmOn integration - Added by Hanspeter Müller over 9 years ago

Hi everyone,

it's a bit tricky, but it works if you put it into a script like this:

#!/bin/bash
trap 'kill -9 $PID 2>/dev/null' EXIT

livestreamer -O "$1" best | avconv -re -v quiet -fflags +genpts+igndts -i pipe:0 -bsf h264_mp4toannexb -vcodec libx264 -tune zerolatency -acodec ac3 -f mpegts pipe:1 &

PID=$!
wait $PID

Put the script into i.e. /usr/bin/livestreamer.sh and call it with "pipe:///usr/bin/livestreamer.sh yoururl" in the tvheadend-mux. This way allmost any source/codec (that livestreamer can deliver) works, check what codec is actually delivered, if it is allready h264/aac, you can avoid the reencoding...

Problem with that, in this case tvheadend kill's the script after you no longer watch a channel, so the subprocesses still run. If you compile from source, try this patch (so tvheadend sends a TERM to the script which can be traped, instead of KILL)

--- a/src/input/mpegts/iptv/iptv_pipe.c
+++ b/src/input/mpegts/iptv/iptv_pipe.c
@@ -82,7 +82,7 @@ iptv_pipe_stop
 {
   int rd = im->mm_iptv_fd;
   pid_t pid = (intptr_t)im->im_data;
-  spawn_kill(pid, SIGKILL);
+  spawn_kill(pid, SIGTERM);
   if (rd > 0)
     close(rd);
   im->mm_iptv_fd = -1;

There's a bug open for the later problem, not sure why KILL is used, i'm not a programmer, try my patch at your own perill ;)

lemmeknow, if this works for you :). If it doesn't, remove the "-v quiet" from avconv to see why it's choking...

Regards,

/hp

RE: FilmOn integration - Added by Bengt Madeberg over 9 years ago

Yes. I just did the same "trick" with a shell script and noticed that livestreamer is running forever....Otherwise it works perfect...

RE: FilmOn integration - Added by Pasi Porri over 9 years ago

Hanspeter Müller wrote:

Hi everyone,

it's a bit tricky, but it works if you put it into a script like this:

[...]

Put the script into i.e. /usr/bin/livestreamer.sh and call it with "pipe:///usr/bin/livestreamer.sh yoururl" in the tvheadend-mux. This way allmost any source/codec (that livestreamer can deliver) works, check what codec is actually delivered, if it is allready h264/aac, you can avoid the reencoding...

Problem with that, in this case tvheadend kill's the script after you no longer watch a channel, so the subprocesses still run. If you compile from source, try this patch (so tvheadend sends a TERM to the script which can be traped, instead of KILL)

[...]

There's a bug open for the later problem, not sure why KILL is used, i'm not a programmer, try my patch at your own perill ;)

lemmeknow, if this works for you :). If it doesn't, remove the "-v quiet" from avconv to see why it's choking...

Regards,

/hp

As a person who was used Windows all his life and now has Ubuntu based system running as TV server, I don't understand anything :(

RE: FilmOn integration - Added by Bengt Madeberg over 9 years ago

If you only want to watch the channels use the FTV plugin for KODI (former XBMC). If you want to record, you need to find the URL for each channel and do according to the how-to. If you dont have the URL you can use livestreamer but you must do the above things to get it killed properly when you stop viewing...

    (1-8/8)