Project

General

Profile

rtmp url for IPTV

Added by Jose Silva over 8 years ago

Hello,

I'm trying to put up a rtmp:// channel on TvH.

I've been using MythTV and Kodi for a number of years but now, for several reasons, I decided to build a Rpi samba file server with TvHeadend, with a couple other Rpi's as frontends with Kodi.

It's working with several IPTV muxes, the simple http:// kind but I can't set up rtmp:// ones. For instance, the following works directly with Kodi, either with IPTV Simple Client or PlayList Loader:

#EXTM3U
#EXTINF:-1 tvg-id="rtp1.pt"
rtmp://rtppullswflivefs.fplive.net/rtppullswflive-live playpath=2ch5h264 swfUrl=http://programas.rtp.pt/play/player.swf?v3 pageUrl=http://www.rtp.pt/play/direto/rtp1?mag swfVfy=1 live=1 timeout=15

So, the best I could do is to successfully record a file with CLI:

$ rtmpdump -r "rtmp://rtppullswflivefs.fplive.net/rtppullswflive-live" -y "2ch5h264" -W "http://programas.rtp.pt/play/player.swf" -p "http://www.rtp.pt/play/direto/rtp1" --live --timeout 15 -o test.flv

Then I tried to transpose the following to the mux url:

pipe:///usr/bin/rtmpdump -r "rtmp://rtppullswflivefs.fplive.net/rtppullswflive-live" -y "2ch5h264" -W "http://programas.rtp.pt/play/player.swf" -p "http://www.rtp.pt/play/direto/rtp1" --live --timeout 15

But it doesn't work after many hours of fiddling with parameters and url's.

Can somebody help, please?

Thks,
jss


Replies (4)

RE: rtmp url for IPTV - Added by Carlos Azevedo about 8 years ago

For future reference I got it working on 4.0.9 with this script, on file 'capture-rtmp' :

#!/bin/bash
/usr/bin/rtmpdump -r "$1" -y "$2" -W "$3" --live --timeout 15 | /usr/bin/ffmpeg -re -v error -fflags +genpts -i pipe:0 -bsf h264_mp4toannexb -vcodec libx264 -acodec ac3 -f mpegts pipe:1

and them on the URL field of the mutex:

pipe:///usr/local/bin/capture-rtmp rtmp://rtppullswflivefs.fplive.net/rtppullswflive-live 2ch5h264 http://programas.rtp.pt/play/player.swf

RE: rtmp url for IPTV - Added by Jose Silva about 8 years ago

Olá,

Thank you for replying.

In the meantime I have solved the question without using an intermediate script, but didn't post it here; see:
https://tvheadend.org/issues/3630

Essentialy, the script is:
pipe:///usr/bin/ffmpeg -re -v error -fflags +genpts -rtmp_playpath 2ch5h264 -rtmp_swfverify http://programas.rtp.pt/play/player.swf?v3 -rtmp_pageurl http://www.rtp.pt/play/direto/rtp1?mag -rtmp_live live -i rtmp://rtppullswflivefs.fplive.net/rtppullswflive-live -vcodec copy -acodec copy -bsf h264_mp4toannexb -f mpegts pipe:1

Of course, if you use libav instead of ffmpeg, just replace this by avconv.

Rgds,
jss

RE: rtmp url for IPTV - Added by Robert Cameron about 8 years ago

If this is a live stream feed, why are you using '-re', if I may ask?

It's my understanding that the '-re' option is to slow down the input to realtime for streaming out, but should not be used with live inputs as it may cause problems that weren't present before ...

(I ask because I'd like to try something similar, but with UDP inputs re-encoding with h264_vaapi, but I haven't had much luck yet ...)

RE: rtmp url for IPTV - Added by Jose Silva about 8 years ago

By reading the link I provided above you'll probably guess that I've read a lot on the net before coming to the solution which, by the way, is proven working. Furthermore, it doesn't only work with this source but with a dozen more sources aplying the same principle.

So, I vaguely remember to have read somewhere that you had to apply -re specifically on this case, and the reasons presented convinced me; I didn't copy and pasted it blindly. However, I can't remember the full discussion or even where I read it but, as they say, google is your friend :)

In my case, I wasn't re-encoding though, as the input was already h264, as you see on -vcodec copy. Maybe in your case this introduces the problem.

    (1-4/4)