Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTSP support for IPTV #190

Closed
wants to merge 82 commits into from
Closed

RTSP support for IPTV #190

wants to merge 82 commits into from

Conversation

Glandos
Copy link
Contributor

@Glandos Glandos commented Dec 29, 2012

Large PR for RTSP support, including basic stuff for RTCP.
This add a new dependency against libcurl for RTSP init.

Feel free to slap me if something seems wrong in the code.

However, I've tested it with valgrind, and it seems memory leak-free for now. I've also checked that performances are nearly the same.

I'd really appreciate that someone tests that the old IPTV behavior is not broken.

IMPORTANT
For now, the "interface" field is used to read the RTSP URL. So if you want to test, you have to put "rtsp://server/stream1" instead of "eth0", and the stream will be detected as RTSP. The "port" field is unused for now, but it could be used as a hint for RTP port.
If you think this "interface" field should not be used, feel free to provide me a good solution. This PR is done to test RTSP support, it is large enough, and I didn't want to make it larger (and with more bugs) by changing the web interface and the configuration.

return it when it start, and ask it to stop RTSP stream
rename multicast open to multicast start to match current name scheme
start rtsp if we recognize it's RTSP
implement bind method to the correct port
change a small test to return the correct value
call rtsp start with the pointer to the fd, rtsp open the socket itself
we take care of free'd memory for rtsp_info
transport string is set correctly based on the free port we had
check that client_port sent by server match our wish
open the socket with client port, that's the one we will sending packets from
rename attribute
count cycles
initial packet sending (not functional for now)
@jendik
Copy link

jendik commented Sep 5, 2013

Hi All,

this feature seems very interesting and smthing like I was really looking for.
I would like to use it to add/include CCTV videocameras(that are streamed by rtsp only) to PVR addon channel list - to be really easy and fast to access and watch them.

Have you got please any howto/help which would describe how to compile TVH with this feature and where and how to set this up?

What versions of TVH are compatible with this?

Thx a lot
Kind regards
j.

@HuntieDK
Copy link

HuntieDK commented Sep 8, 2013

You'll need to checkout the iptv_rtsp branch, then configure and build the usual way - you can then add rtsp sources in the configuration section.

The branch is pretty much up to date with the master development branch so it is ahead of the stable releases.

@HuntieDK
Copy link

@adamsutton: I've added a configuration page for RTSP services to Glandos' great work on RTSP. Also added a simple sub type for IPTV services to make them distinguisable, even if they're still stored in the same configuration structure. That could be a beginning of support for multiple IP transports such as http. Last, the branch has been brought a bit more up to date.

@adamsutton
Copy link
Contributor

@HuntieDK I'm sorry to say, that this code will need lots of work as the DVB code has been completely rewritten. However the framework for adding other IPTV transports should be a bit better. Currently it just supports the same as current tvh + HTTP.

If someone wants to try integrating into that feature/dvb-rewrite branch, that would be very useful.

@HuntieDK
Copy link

@adamsutton: Interesting, I'll have a look at the branch :)

RTSP support may be interesting for accessing SAT>IP tuners; I've successfully added services from a SAT>IP cable tuner using Glandos' changes; it quite much worked out of the box. Of course scanning still lacks.

@titoftit
Copy link

Hi,
I merged the change of Glandos on the 3.4 branch. I have not tested, just compiled.

If anyone's interested ...

@titoftit
Copy link

@titoftit
Copy link

@HuntieDK I did not seen that you had already done with branch master of tvheadend ...

@HuntieDK
Copy link

@Glandos: Hey Glandos, are you thinking of trying to port your RTSP additions to the new DVB-wise reworked tvheadend master (has undergone a lot of changes)? If not, I'm probably going to have a look at it. There's now an actual URL field in tvheadend (I believe http support have been, or is about to be, added). So there should be a good entry point there.

@Glandos
Copy link
Contributor Author

Glandos commented Jan 10, 2014

I'd love to. I've seen that a lot of good work has been integrated for IPTV, and that RTSP streams can now have their own place next to DVB and other sources.
But I'm clearly missing time. I'm a new father with a 3 months old child, and I would need several hours free to have a look, clean my code, and propose a new PR.
But I won't quit. If you have time and will to start working on it, please do, I'll be happy to follow and help you. If you don't, I'll work on it later, maybe in 2 or 3 months, when the difficult nights are over 😉

@adamsutton
Copy link
Contributor

I did actually start looking at the RTSP code and integrating it into the new stuff. Unfortunately, as usual, I got distracted and had more pressing concerns. However I think that some of the concepts that @Glandos used, are actually now an intrinsic part of the system. So I don't think its a massive job, just as has been said it needs some cleaning and tweaking. I imagine you could integrate a quick and dirty hack pretty quickly.

Now... to sidetrack and hijack this thread...

@Glandos I'm going to break the unwritten rule of parent hood (as a father of ~3 year old twin boys), this is the easy part :p We look back on those first few months and wonder at how simple the boys needs were. Yes it means getting up in the night a lot to feed them, but compared to what's to come it's much simpler! So don't listen to those that tell you "it gets easier", I'm sure it does eventually, around the time they leave home! But for now I think it just gets "different". But, and its a big one, it's still all worth it, so enjoy him/her :)

And I'm sure we all look forward to you being able to contribute some new code :)

@HuntieDK
Copy link

@Glandos: Congrats on the new fatherhood :-) I'll start looking at the code when I have a bit of spare time and keep a repository updated here when I move on. And @adamsutton: Kudos on the DVB rewrite - it definitely has improved the structure of the input source code! :-)

@Mettbrot
Copy link

@Glandos excited to see this PR bringing internet TV as regular channels in tvheadend. What is the status of this?

@nmaclean
Copy link
Contributor

@Mettbrot looks like Glandos has been working on this - see his branch iptv_rtsp_new.

I tried it but couldn't find a working rtsp stream to test.

@ckarrie
Copy link
Contributor

ckarrie commented May 17, 2014

@Mettbrot Does any RTSP Stream work? Google gives me http://www.wowza.com/html/mobile.html

@nmaclean
Copy link
Contributor

@ckarrie - I tried this and got this http://pastebin.com/rv7aFVvM
What video format is that stream?

@Jalle19
Copy link
Contributor

Jalle19 commented May 27, 2014

Only real IPTV (MPEG-TS) works in tvheadend.

@ckarrie
Copy link
Contributor

ckarrie commented May 27, 2014

@nmaclean @Jalle19 yes, I got it. you have to "restream" as TS to get some streams working.

Example command to restream my Edimax IP Camera for TVHeadend:

cvlc rtsp://ipcam.fritz.box:554/ipcam.sdp --sout '#transcode{vcodec=mp2v,fps=25,vb=1024,acodec=mpga,ab=192}:standard{mux=ts,dst=0.0.0.0:8180,access=http}'

Would be nice if TVHeadend could do the job... :-)

@nmaclean
Copy link
Contributor

@ckarrie - thanks. I think you helped me on IRC. I used cvlc http:// --sout '#standard{access=http,mux=ts,dst=:8180/ch168}'

I agree it would be nice if TVH could do this :)

@Jalle19
Copy link
Contributor

Jalle19 commented May 27, 2014

It looks easy (converting container to MPEG-TS) when you do it with VLC but there's probably a lot going on behind the scenes. I don't think any of this stuff belongs in tvheadend since the idea is that whatever video you feed into it is in the correct format, just like all DVB signals are in an agreed format.

@manupap1
Copy link

I've managed to get it working on tvheadend 3.9!

The "initial scan no data, failed" error is there because tvheadend waits for too much TS packets in the transport stream.
I fixed it by setting MIN_TS_PKT to 7 in file input/mpegts/mpegts_input.c (line 454).

@perexg
Copy link
Contributor

perexg commented May 28, 2014

@manupap1 : Nice. But it's not a correct fix. I would do an extra time check using dispatch_clock to deliver waiting packets sooner.

@perexg
Copy link
Contributor

perexg commented May 28, 2014

@manupap1 : I tried to fix this in commit f7422b6 . Could you test this ?

@manupap1
Copy link

I just tested, it does not work.
len never exceeds 1316 (7 x 188)

@Belokan
Copy link

Belokan commented Jun 2, 2014

Hello,

Thanks for this branch. I'm trying to build it on my Syno DS212J but I face this error during make:

[...]
CC src/avg.o
CC src/htsstr.o
CC src/rawtsinput.o
CC src/iptv_input.o
CC src/iptv_input_rtsp.o
cc1: warnings being treated as errors
src/iptv_input_rtsp.c: In function 'curl_data_write_func':
src/iptv_input_rtsp.c:67: warning: implicit declaration of function 'strndup'
src/iptv_input_rtsp.c:67: warning: incompatible implicit declaration of built-in function 'strndup'
src/iptv_input_rtsp.c: In function 'curl_header_write_func':
src/iptv_input_rtsp.c:88: warning: incompatible implicit declaration of built-in function 'strndup'
src/iptv_input_rtsp.c: In function 'iptv_rtsp_parse_sdp_port':
src/iptv_input_rtsp.c:428: warning: incompatible implicit declaration of built-in function 'strndup'
make: *** [/opt/tvheadend/build.linux/src/iptv_input_rtsp.o] Error 1

Could someone point me to a possible solution ?

Thanks a lot in advance !

PS: I've installed every (I think) required packages thru ipkg and ran the following commands:

git clone git://github.com/Glandos/tvheadend.git
cd tvheadend/
git checkout -b iptv_rtsp remotes/origin/iptv_rtsp
configure
make

@adamsutton
Copy link
Contributor

Closing this PR, if somone @Glandos ? has this working in 3.9, please re-submit.

@perexg perexg closed this Jun 10, 2014
@Glandos
Copy link
Contributor Author

Glandos commented Jun 11, 2014

Yes, I should have closed this long time ago, since it doesn't compile, and make people believe it will.
Unfortunately, I didn't have time to work more on this… It doesn't mean I don't want to, I'm still using tvheadend, but it's difficult to put some priorities…
I hope I will soon have time to finalize my work, but I don't know when.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet