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