简体   繁体   中英

Can FFMPEG library send the live H264 iOS Camera stream to Wowza using RTSP

My requirement is to get iphone camera feed, encode it into H264 format and send it to server. In search, I found encoding part is possible with ffmpeg lib with x264 (libx264). But now the next task is to send the encoded data to Wowza server using rtsp.

Please share some code or useful document if anyone is aware about this.

There is one another library for encoding purpose live555. But I am not sure it can send the data to server using rtsp.

Actualy I made an iOS streaming app (with wowza as streaming server)

I believe you can stream video only with FFmpeg with rtsp protocol although FFmpeg don't fully support it

However with ffmpeg you can get a valid SDP and pass it to wowza using RTCP protocol - ANNOUNCE OPTION SETUP RECORD -

I didn't use FFmpeg for encoding but if you can get the raw H264 data you can packetize it to make a valid RTP packet using rfc6184

edit : here is a sample to connect wowza :

    NSString* response = [NSString stringWithFormat:@"ANNOUNCE %@ RTSP/1.0\r\n",self->addr];
    response = [response stringByAppendingFormat:@"CSeq: %d\r\n",self->cseq];
    response = [response stringByAppendingFormat:@"Content-Type: application/sdp\r\nContent-Length: %d\r\n\r\n", [self->sdp length] ];
    response = [response stringByAppendingString:self->sdp];
    NSString* result = [self sendAndRecvData:response];

where sendAndRecvData is a tcp socket bound to wowza_ip:1935

you can use the same kind of code for SETUP, which will send back RTP (+RTCP) ports where you should send your datas

您使用live555时,可以使用设备上的live 555服务器发送音频和视频,这将为您提供rtsp + rtcp流到wowza,以便宣布和记录live 555具有不受支持的dss模块。

Wowza有一个名为GoCoder的iPhone应用程序,它将向Wowza服务器发送实时编码流。

You can stream directly to a Wowza server using RTMP instead of RTSP. The ffmpeg command is something like:

ffmpeg -re -i localFile.mp4 -c copy -f flv rtmp://server/live/streamName

As long as you specify your output format as flv and the output destination as rtmp://xxx then you should be OK.

Source: ffmpeg streaming

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM