Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

RTSP streaming on iphone works great!

nicklenecknickleneck Posts: 4New Users
edited June 2012 in iPhone SDK Development
This app uses Live555 and FFMPEG to stream live video and audio to iphone via RTSP / RTP . Download the free app (link to iTunes at dropcam.com) to your iphone and view one of the public IP cameras, you'll see how smooth the live video is. I used Wireshark to sniff the packets from one of the cameras and was surprised to find the stream used RTP / RTSP / RTCP even noticed RTMPT - tunneled? protocol's all working fine on the iphone.

Does that mean that the iphone iOS supports RTSP stack but not mobileSafari?

Any ideas on how this works?


You can look at the source code for the app at dropcam's dropcam_for_iphone at master - GitHub
Post edited by nickleneck on
«1345

Replies

  • nicklenecknickleneck Posts: 4New Users
    edited July 2010
    No comments or thoughts on how this actually works?

    I thought more developers out there would be interested to see RTSP streaming working on the iphone iOS. Looking at the source files on github I've noticed that they use CHDataStructures framework. What does this framework do?

    Thanks in advance
  • iXeniXen Posts: 12Registered Users
    edited July 2010
    I can not compile this project, someone has compiled?
  • PetyPety Posts: 17Registered Users
    edited July 2010
    iXen what´s your problem man??
    We have another app that uses this project. Thanks to all the people from Dropcam

    Bye!
  • testxtestx Posts: 2New Users
    edited July 2010
    Hi,,
    like iXen,, some help to understand how to work with would be appreciated
  • iXeniXen Posts: 12Registered Users
    edited July 2010
    I could make to compile the project. The problem now is not how to make work. There is no documentation, and I can not know how it works.
  • testxtestx Posts: 2New Users
    edited July 2010
    that's what i meant by "how it works",
    i've compiled the framework and add it successfully to a test project,
    and iam now trying to understand the API
  • iXeniXen Posts: 12Registered Users
    edited July 2010
    hi and sorry for my English. I am from spain


    I also compiled the framework and add it to a test project successfully, but do not understand the api.

    which would have to show the video?

    RTSPClientSession *session = [[RTSPClientSession alloc] initWithURL:[NSURL URLWithString:@"rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp"]];
    [session setup];
    [session play];

    this code does not work.

    Me too trying to understand the API
  • nicklenecknickleneck Posts: 4New Users
    edited July 2010
    It looks like Dropcam's repository at github only make's available the modified code as required by the LGPLv2.1 for the respective open source projects that they used code from. I'm fairly new to xcode and iphone sdk development so correct me if I'm wrong but it looks like the folders inside the lib/ directory are each separate static libraries (actually ffmpeg is built inside of and a direct dependent of DecoderWrapper, Live555 is a dependent of RTSPClient). So when you compile all of the included libraries you should end up with 4 static libraries: libCHDataStructures.a, libDecoderWrapper.a, libJSON.a, and libRTSPClient.a. Linking all these together wont produce an executable nor will it produce the libDropcam.a library that they included at github. It will give a developer a good starting point/head start on using these libraries in their own projects. I'm especially interested in the RTSPClient functionality.

    Have any of you more seasoned developers had a chance to look through these libraries? Are they usable in other projects? Looking at all the post's regarding the use of FFMPEG in iphone apps, you would think the devs would be all over this example of FFMPEG working without the need for an SDL library.

    I know, I know, looks like I want someone to do all the hard work for me and then post their code on how they got their iphone app to play any video (ffmpeg?) over any network (Live555?) Just kidding.... Although an example of how to get MPmovieplayer.framework working with ffmpeg would help.
  • iXeniXen Posts: 12Registered Users
    edited July 2010
    Hi all.

    I enabled the mode verbosite, and this is the log.

    2010-07-19 14:29:21.720 rtsp[6041:207] CLICK
    Sending request: OPTIONS rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp RTSP/1.0
    CSeq: 1
    User-Agent: LIVE555 Streaming Media v2010.01.07


    Received OPTIONS response: RTSP/1.0 200 OK
    Server: QTSS/6.0.2 (Build/526.2; Platform/MacOSX; Release/Mac OS X Server; )
    Cseq: 1
    Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


    2010-07-19 14:29:22.035 rtsp[6041:207] DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD
    Sending request: DESCRIBE rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp RTSP/1.0
    CSeq: 2
    Accept: application/sdp
    User-Agent: LIVE555 Streaming Media v2010.01.07


    Received DESCRIBE response: RTSP/1.0 200 OK
    Server: QTSS/6.0.2 (Build/526.2; Platform/MacOSX; Release/Mac OS X Server; )
    Cseq: 2
    Cache-Control: no-cache
    Content-length: 798
    Date: Mon, 19 Jul 2010 12:28:34 GMT
    Expires: Mon, 19 Jul 2010 12:28:34 GMT
    Content-Type: application/sdp
    x-Accept-Retransmit: our-retransmit
    x-Accept-Dynamic-Rate: 1
    Content-Base: rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp/


    Need to read 798 extra bytes
    Read 798 extra bytes: v=0
    o=QTSS_Play_List 3854710900 4137169342 IN IP4 63.105.122.38
    s=AFTVComedyH2641000
    c=IN IP4 0.0.0.0
    b=AS:1005
    t=0 0
    a=x-broadcastcontrol:RTSP
    a=maxprate:113.000000
    a=isma-compliance:2,2.0,2
    a=control:*
    m=video 0 RTP/AVP 96
    b=AS:906
    b=TIAS:881
    a=3GPP-Adaptation-Support:1
    a=maxprate:113
    a=rtpmap:96 H264/90000
    a=control:trackID=1
    a=cliprect:0,0,576,768
    a=framesize:96 768-576
    a=fmtp:96 packetization-mode=1;profile-level-id=4D401F;sprop-parameter-sets=J01AH6kYGAJNgDUGAQa23oDeApl73wE=,KN4JyA==
    a=mpeg4-esid:201
    m=audio 0 RTP/AVP 97
    b=AS:109
    b=TIAS:100
    a=3GPP-Adaptation-Support:1
    a=maxprate:43
    a=rtpmap:97 mpeg4-generic/44100/2
    a=control:trackID=2
    a=fmtp:97 profile-level-id=15;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1210
    a=mpeg4-esid:101

    2010-07-19 14:29:22.188 rtsp[6041:207] getSDP: --> v=0
    o=QTSS_Play_List 3854710900 4137169342 IN IP4 63.105.122.38
    s=AFTVComedyH2641000
    c=IN IP4 0.0.0.0
    b=AS:1005
    t=0 0
    a=x-broadcastcontrol:RTSP
    a=maxprate:113.000000
    a=isma-compliance:2,2.0,2
    a=control:*
    m=video 0 RTP/AVP 96
    b=AS:906
    b=TIAS:881
    a=3GPP-Adaptation-Support:1
    a=maxprate:113
    a=rtpmap:96 H264/90000
    a=control:trackID=1
    a=cliprect:0,0,576,768
    a=framesize:96 768-576
    a=fmtp:96 packetization-mode=1;profile-level-id=4D401F;sprop-parameter-sets=J01AH6kYGAJNgDUGAQa23oDeApl73wE=,KN4JyA==
    a=mpeg4-esid:201
    m=audio 0 RTP/AVP 97
    b=AS:109
    b=TIAS:100
    a=3GPP-Adaptation-Support:1
    a=maxprate:43
    a=rtpmap:97 mpeg4-generic/44100/2
    a=control:trackID=2
    a=fmtp:97 profile-level-id=15;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1210
    a=mpeg4-esid:101
    Sending request: SETUP rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp/trackID=1 RTSP/1.0
    CSeq: 3
    Transport: RTP/AVP;unicast;client_port=54676-54677
    User-Agent: LIVE555 Streaming Media v2010.01.07


    Received SETUP response: RTSP/1.0 200 OK
    Server: QTSS/6.0.2 (Build/526.2; Platform/MacOSX; Release/Mac OS X Server; )
    Cseq: 3
    Cache-Control: no-cache
    Session: 4196043102457707518
    Date: Mon, 19 Jul 2010 12:28:34 GMT
    Expires: Mon, 19 Jul 2010 12:28:34 GMT
    Transport: RTP/AVP;unicast;source=63.105.122.39;client_port=54676-54677;server_port=6970-6971


    2010-07-19 14:29:22.339 rtsp[6041:207] RTP
    2010-07-19 14:29:22.340 rtsp[6041:207] H264
    2010-07-19 14:29:22.340 rtsp[6041:207] video
    Current language: auto; currently objective-c++
    (gdb) continue
    2010-07-19 14:29:25.651 rtsp[6041:207] 0
    2010-07-19 14:29:25.652 rtsp[6041:207] 6970
    Sending request: SETUP rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp/trackID=2 RTSP/1.0
    CSeq: 4
    Transport: RTP/AVP;unicast;client_port=64828-64829
    Session: 4196043102457707518
    User-Agent: LIVE555 Streaming Media v2010.01.07


    Received SETUP response: RTSP/1.0 200 OK
    Server: QTSS/6.0.2 (Build/526.2; Platform/MacOSX; Release/Mac OS X Server; )
    Cseq: 4
    Session: 4196043102457707518
    Cache-Control: no-cache
    Date: Mon, 19 Jul 2010 12:28:34 GMT
    Expires: Mon, 19 Jul 2010 12:28:34 GMT
    Transport: RTP/AVP;unicast;source=63.105.122.39;client_port=64828-64829;server_port=6970-6971


    2010-07-19 14:29:25.809 rtsp[6041:207] RTP
    2010-07-19 14:29:25.810 rtsp[6041:207] MPEG4-GENERIC
    2010-07-19 14:29:25.810 rtsp[6041:207] audio
    2010-07-19 14:29:25.811 rtsp[6041:207] 0
    2010-07-19 14:29:25.811 rtsp[6041:207] 6970

    2010-07-19 14:29:27.696 rtsp[6041:207] startTime ---> 0.000000
    Sending request: PLAY rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp/ RTSP/1.0
    CSeq: 5
    Session: 4196043102457707518
    Range: npt=0.000-
    User-Agent: LIVE555 Streaming Media v2010.01.07


    Received PLAY response: RTSP/1.0 200 OK
    Server: QTSS/6.0.2 (Build/526.2; Platform/MacOSX; Release/Mac OS X Server; )
    Cseq: 5
    Session: 4196043102457707518
    Range: npt=now-
    RTP-Info: url=rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp/trackID=1,url=rtsp://video3.americafree.tv/AFTVComedyH2641000.sdp/trackID=2

    If packet capture from vlc, the log is the same.

    Vlc play after the call teardown and start from scratch.
    the second time you play vlc connect.

    I do play and do nothing
  • iXeniXen Posts: 12Registered Users
    edited July 2010
    Hello, I've managed to capture packets.

    The problem is that if I keep all the packages as they come in a file that file will not play any player.

    What happens after a packet capture? (afterGettingFrame after)
  • ewpaus@pobox.comewpaus@pobox.com Posts: 8New Users
    edited August 2010
    iXen wrote: »
    Hello, I've managed to capture packets.

    The problem is that if I keep all the packages as they come in a file that file will not play any player.

    What happens after a packet capture? (afterGettingFrame after)

    I'm capturing packets too. I'm trying to decode them but I think I'm missing a step. In the Live555 documentation I have read about :
    H264VideoStreamFramer that needs to be subclassed to provide a specific implementation for currentNALUnitEndsAccessUnit(). But, I don't know where this fits into the process. I wonder if the stream I'm getting without this is worthless. Also, I notice every other "frame" is length 2. The other frames being much larger. Is this small frame audio?

    Does anyone have any knowledge of this? Would anyone like to get together and compare notes. I seriously need to get this working.
  • ewpaus@pobox.comewpaus@pobox.com Posts: 8New Users
    edited August 2010
    I'm capturing packets too. I'm trying to decode them but I think I'm missing a step. In the Live555 documentation I have read about :
    H264VideoStreamFramer that needs to be subclassed to provide a specific implementation for currentNALUnitEndsAccessUnit(). But, I don't know where this fits into the process. I wonder if the stream I'm getting without this is worthless. Also, I notice every other "frame" is length 2. The other frames being much larger. Is this small frame audio?

    Does anyone have any knowledge of this? Would anyone like to get together and compare notes. I seriously need to get this working.

    Also, I've compared the functionality of ffmpeg examples with DecoderWrapper. There are structures in the ffmpeg examples that are no where to be found in DecoderWrapper, such as AVFormatContext. In all the other examples I've read, this structure seems pretty important. Does anyone know if decoding can be accomplished without this. Perhaps they are getting info from the sdp. Has anyone else noticed this and do you have any thoughts about it?
  • nicklenecknickleneck Posts: 4New Users
    edited August 2010
    The Dropcam App for iPhone only connects to Dropcam branded IP cameras.
    The cameras in question (Axis M1031?) have been modified with custom
    firmware in an effort to make the network set-up process much easier for
    the end user. The firmware also reduces the various streaming options
    normally found on that model camera to down to just one 320x240
    H.264/AAC stream over RTP/RTSP thus making the video more network
    friendly.

    Maybe the packets you guys are capturing are a different flavor of h264
    than that of the type coming from the Dropcam cameras, and
    Decoder/Wrapper doesn't recognize it.

    The FFmpeg build script that the Dropcam app uses doesn't leave much
    wiggle room as far as decoding or demuxing goes:


    COMMON_PARAMS="--disable-doc --disable-ffplay --disable-ffserver \
    --disable-ipv6 --disable-encoders --disable-decoders --disable-hwaccels \
    --disable-muxers --disable-demuxers --disable-parsers --disable-bsfs \
    --disable-protocols --disable-indevs --disable-outdevs --disable-devices \
    --disable-filters \
    --enable-encoder=rawvideo \
    --enable-decoder=h264 \
    --enable-muxer=rawvideo \
    --enable-demuxer=h264 \
    --enable-parser=h264 \
    --disable-zlib --disable-bzlib"


    I see a lot of --disable
  • iXeniXen Posts: 12Registered Users
    edited August 2010
    hi, my idea is capture packages and stored in a file.
    I think that if the issuer is h264 file would have no problem to play with MPMoviePlayerController.

    problems:
    1 .- order of the packets.
    2 .- packages together
    3 .- file headers

    Is this possible?

    ewpaus@pobox.com: if you want I send my project. I am very interested in progress

    nickleneck:testing video is h264. --> rtsp: / / video3.americafree.tv/AFTVComedyH2641000.sdp

    helppppppp!!!!
  • ewpaus@pobox.comewpaus@pobox.com Posts: 8New Users
    edited August 2010
    I'm very interested in progress too. Saving it to a file will not work for me because it is very importance that I keep the latency as low as possible.

    Recently I have been using the mplayer code as a guide to what I need to do. I've found the functionality matches up very well between the two projects.

    I was going with the idea that they left something out and I needed to figure out what it is. Now I think that everything is there, I just have to figure out how to use it.

    The code I'm looking at in mplayer is in the libmpdemux dir. It's demux_rtp_codec.cpp and deumx_rtp.cpp. The rtsp functionality seems to be in demux_rtp, while the h264 stuff is in demux_rtp_codec.

    As far as understanding the code, I gotten as far as setting up the MediaSubsessions. It looks like the next step is decoding. But, I'm hitting a wall.

    As for my video source, I'm just streaming/transcoding a .mov file. But, the transcoding looks very similar to the ffmpeg script that was described just above.
  • ewpaus@pobox.comewpaus@pobox.com Posts: 8New Users
    edited August 2010
  • ewpaus@pobox.comewpaus@pobox.com Posts: 8New Users
    edited August 2010
    Pety -
    So nice to hear of your success. Open source projects are not for the faint of heart. If you have any insights - like the steps involved in decoding H264, please share.
    Thanks in advance,
    Estelle
    Pety wrote: »
    iXen what´s your problem man??
    We have another app that uses this project. Thanks to all the people from Dropcam

    Bye!
  • ewpaus@pobox.comewpaus@pobox.com Posts: 8New Users
    edited August 2010
    Does anyone know what this means:

    No accelerated colorspace conversion found from yuv420p to rgba.

    -e
  • iXeniXen Posts: 12Registered Users
    edited August 2010
    Hi,

    I still do not make much progress.

    call me didReceiveFrame,what are the steps to display video?

    if I have to do decoding, that's my problem.
  • iXeniXen Posts: 12Registered Users
    edited August 2010
    This is my code in case anyone wants to see
    rtspsample.zip
    1 x 1 - 21K
  • beefonbeefon Posts: 2New Users
    edited August 2010
    iXen, compiled your code and it doesn't work. Always getting:

    error: --> liveMedia7 (with AFTVComedyH2641000.sdp stream)
    error: --> liveMedia8 (with live_3gpp.sdp stream)

    Any thoughts?
  • iXeniXen Posts: 12Registered Users
    edited August 2010
    error: --> liveMedia7 (with AFTVComedyH2641000.sdp stream)
    error: --> liveMedia8 (with live_3gpp.sdp stream)

    this is not an error, is only the last value of "context-> env-> getResultMsg ()"

    if call "- (void) didReceiveFrame: (NSData *) frameData presentationTime: (NSDate *) presentationTime" I think that everything is correct in reception of data
  • aniucoaniuco Posts: 2New Users
    edited August 2010
    iXen wrote: »
    this is not an error, is only the last value of "context-> env-> getResultMsg ()"

    if call "- (void) didReceiveFrame: (NSData *) frameData presentationTime: (NSDate *) presentationTime" I think that everything is correct in reception of data

    how to call didReceiveFrame .....can you help ???
  • VictorTiamatVictorTiamat Posts: 38Registered Users
    edited August 2010
    Have somebody managed to make it works? I've tried to compile and run project uploaded by iXen and nothing happened. There is just a lot of logs.
  • VictorTiamatVictorTiamat Posts: 38Registered Users
    edited August 2010
    I'm capturing packets too. I'm trying to decode them but I think I'm missing a step. In the Live555 documentation I have read about :
    H264VideoStreamFramer that needs to be subclassed to provide a specific implementation for currentNALUnitEndsAccessUnit(). But, I don't know where this fits into the process. I wonder if the stream I'm getting without this is worthless. Also, I notice every other "frame" is length 2. The other frames being much larger. Is this small frame audio?

    Does anyone have any knowledge of this? Would anyone like to get together and compare notes. I seriously need to get this working.

    Hi. How did you capture the frame? I'm trying it and can see that afterGettingFrame method has never called. What have I done to make that method works?

    Thanks.
«1345
Sign In or Register to comment.