In this article I try to tell the rtp or rtsp based encoder output is streaming over wowza and can be saved with as3 . This can be also used to stream Axis or other security cam over lan .
In rtsp based encoder there is no problem to stream it over wowza , cause wowza is directly supporting the rtsp input and ready to stream it with rtmp .
To setting up it , in wowza Directory / conf folder , and find the startupstream.xml and you can see the examples that rtsp , .sdp and .stream .
for Rtsp first you have to learn which port the camera or rtsp based encoder out . Where is it announcing to ?
<StartupStream> <Application>live/_definst_</Application> <MediaCasterType>rtp</MediaCasterType> <StreamName>rtsp://username:password@192.168.10.79/axis-media/media.amp</StreamName>
This is an example of rtsp output and wowza will re-stream it over rtmp , so you can play it with osmf player .
Using the live application , we can reach the stream , stream name is the same rtsp output link.
rtmp://yourWowzaIp:YourWowzaPort(Generally1935)/live/rtsp://username:password…
Rtsp is easiest .However how about the rtp ? If your rtp based encoder (like edbox virgo) out single port and two map {one of them video = h264 and the audio with two channels aac}
is a problem . If encoder supports double port so we can reach video and audio via different port .
ie : my rtp based encoder gives that 192.168.200.122:1234 to the video and 192.168.200.122:1236 to the audio , so we can easily create sdp file to stream it in wowza.
In wowza Directory / content folder to place .sdp file , it include that video and audio session description . Like
m=video 1234 RTP/AVP 96 c=IN IP4 192.168.200.102 a=rtpmap:96 H264/90000
m=audio 1236 RTP/AVP 97 c=IN IP4 192.168.200.102 b=AS:768 a=rtpmap:97 PCMU/48000/2
you can easily create sdp if u know that audio is PCMU or MPEG4-GENERIC and bitrate and channels .
But generally we dont know which format it is .
To create sdp
in ffmpeg
ffmpeg -i "rtp://192.168.200.122:1234" -vcodec libx264 -b:v 500k -tune zerolatency -strict experimental -f rtp "rtp://192.168.200.122:10000" > video.sdp
this will generate the video .sdp folder in ffmpeg bin folder {where ffmpeg.exe exists.} if you setting up the encoder to output Ts over Rtp and
the video out with h264
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
t=0 0
a=tool:libavformat 54.25.104
m=video 1234 RTP/AVP 96
c=IN IP4 192.168.200.102
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z01AH5ZWBaED58BUIAAAfSAAHUwcTAAECegACBPf4xxiYAAgT0AAQJ7/GOHaECE4,aOkJNSA=; profile-level-id=4D401F
and in wowza startup stream if u write yourSdpFilename.sdp
and restart wowza ,
you can watch the output over
rtmp://localhost:1935/live/mySdpFileName.sdp.
For audio
the same step for that , if u want , merge codes in ffmpeg
like two input
ffmpeg -i “rtp://192.168.200.122:1234” -videoConfig ….. video out rtp://…. where you wanna out -i “rtp://192.168.200.122:1236” -audioCOnfig(like -ar 48k -ac 2 -acodec aac ) ….
audio out -f rtp rtp://…. > new.sdp
still there is no problem .
However if encoder has a single port ?
In This case
in map 0:0 the video
in map 0:1 or 1:0 the audio stream will exist .
And we can split them with ffmpeg or vlc .
in ffmpeg
ffmpeg -i “rtp://192.168.200.122:1000” -videoConfig -audioConfig -f rtp first out -f rtp second out the syntax .
ffmpeg -i “rtp://192.168.200.122:1000” -vcodec copy -acodec copy -ar 96k -bufsize 5Mi -r 59.99 -b:v 500k -maxrate 512k -minrate 448k -map 0:0 -an -f rtp rtp://192.168.200.122:10000
-map 0:1 -vn -f rtp rtp://192.168.200.122:10002 > newSdp.sdp
or in vlc for single port rtp based encoder
vlc -vvv -I rc “rtp://192.168.200.102:1234” –sout “#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac,qpmax=36,qpmin=10,me=hex,merange=24,subme=9,qcomp=0.6},vcodec=x264,vb=500,scale=1,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port-video=10000,port-audio=10002,sdp= file://C:/vlc.sdp}”
and repeating the same step for wowza , in content folder place the sdp
in live application you can reach the stream with sdp name .
-> also you can wonder what about the .stream file ?
If you dont wanna mapping the stream
u can take the rtp input and
in mpegts out it over udp .
ffmpeg -i input -codecSConfigEtc ….. -f mpegts udp://192.168.200.122:10000
and in .stream file content is
udp://192.168.200.122:10000
and to start this place it startStream.xml myFile.stream
and restart wowza .
reach this stream in live app
rtmp://localhost/live/myFile.stream.