I'm trying to sniff RTMP streams from my IPCAM for recording them separately from my computer. Unfortunately, they do not support RTSP unless connected directly to the PC instead of the NVR, however, I noticed that the web gui has RTMP streams that seem to work remotely as well as locally and I was hoping to sniff them and record the same. The camera support said they cannot help me with this. The system works really well and I'd hate to change them. The brand of the cameras are OOSSXX and they use 3rd party apps like eseecloud and IP Pro that work well with them.
Here's the relevant code:
$(document).ready(function(){
dvr_camcnt = Cookies.get("dvr_camcnt");
iSetAble = Cookies.get("iSetAble");
iPlayBack = Cookies.get("iPlayBack");
dvr_usr = Cookies.get("dvr_usr");
dvr_pwd = Cookies.get("dvr_pwd");
if(iSetAble == '0'){
$('#pb_settings').css('display','none');
}
if(iPlayBack == '0'){
$('#pb_review').css('display','none');
}
if(dvr_camcnt == null || dvr_usr == null || dvr_pwd == null)
{
location.href = "/index.html";
}
var urlarg=new getarg();
if(urlarg.type == "main")
{
dvr_type = "main";
$("#lst_type")[0].selectedIndex = 0;
}
else
{
dvr_type = "sub";
$("#lst_type")[0].selectedIndex = 1;
}
var flashvars =
{
player_max: dvr_camcnt,
usr:dvr_usr,
pwd:dvr_pwd
};
var params =
{
player_max: dvr_camcnt,
allowFullScreen: "true"
};
var attributes =
{
id: "viewer",
name: "viewer"
};
swfobject.embedSWF("JaViewer.swf?player_max=4", "flashcontent", "100%", "100%", "10.2.0","expressinstall.swf", flashvars, params, attributes);
var container = $("#chn_container")[0];
for(var i = 0; i < dvr_camcnt; i++)
{
var str = "<div style=\"color:#FFFFFF;\"><img id=\"chn_status_" + i + "\" align=\"absmiddle\" src=\"images/ch_1.jpg\" width=\"28\" height=\"18\" onMouseOver=\"pic_btn_over(this)\" onMouseOut=\"pic_btn_out(this)\" onMouseDown=\"pic_btn_down(this)\" onMouseUp=\"pic_btn_up(this)\"><span lxc_lang=\"view_Channel\">Channel</span>" + (i+1) + " <a href=\"/cgi-bin/snapshot.cgi?chn=" + i + "&u=" + dvr_usr + "&p=" + dvr_pwd + "&q=0&d=1&rand=" + Math.random() + "\" style=\"color:white; text-decoration:none;\"><span lxc_lang=\"view_snapshot\">Snapshot</span></a></div>";
container.innerHTML += str;
}
language_show_page("view_title");
setTimeout(goto_open_all, 2000);
});
function goto_open_all()
{
if(dvr_viewer && dvr_viewer.ConnectRTMP)
{
dvr_viewer.SetPlayerNum(dvr_camcnt);
dvr_viewer.Login(dvr_usr, dvr_pwd, "");
// switch(dvr_camcnt)
// {
// case "4":
// dvr_viewer.flSetViewDiv(4);
// break;
// case "8":
// dvr_viewer.flSetViewDiv(9);
// break;
// case "16":
// dvr_viewer.flSetViewDiv(16);
// break;
// case "24":
// dvr_viewer.flSetViewDiv(25);
// break;
// }
open_all(dvr_camcnt);
}
else
{
dvr_viewer = $("#viewer")[0];
setTimeout(goto_open_all, 1000);
}
}
function open_one(index)
{
if($("#chn_status_" + index)[0].parentNode.style.fontSize=="16px" || $("#chn_status_" + index)[0].parentNode.style.fontSize=="")
{
// dvr_viewer.flSetDomain(index, "http://" + window.location.host + "/");
// dvr_viewer.flConnectVideo(index, dvr_type == "main" ? 1 : 0);
dvr_viewer.SetPoster(index, "/cgi-bin/snapshot.cgi?chn=" + index + "&u=" + dvr_usr + "&p=" + dvr_pwd + "&q=0&d=1&rand=" + Math.random());
dvr_viewer.ConnectRTMP(index, "rtmp://" + location.host, "ch" + index + "_" + (dvr_type=="main"?"0":"1") + ".264");
$("#chn_status_" + index)[0].parentNode.style.color="#ffffff";
$("#chn_status_" + index)[0].parentNode.style.fontSize="17px";
for(var i = 0; i < dvr_camcnt; i++)
{
if($("#chn_status_" + i)[0].parentNode.style.fontSize != "17px")
{
$("#pb_disconn_all")[0].parentNode.style.color="#ffffff";
$("#pb_conn_all")[0].parentNode.style.color="#ffffff";
return;
}
}
$("#pb_disconn_all")[0].parentNode.style.color="#ffffff";
$("#pb_conn_all")[0].parentNode.style.color="#000000";
return;
}
}
function open_all(_count)
{
for(var i = 0; i < _count; i++)
{
open_one(i);
}
}
function close_one(index)
{
if($("#chn_status_" + index)[0].parentNode.style.fontSize=="17px")
{
// dvr_viewer.flDisconnectVideo(index);
dvr_viewer.Disconnect(index);
$("#chn_status_" + index)[0].parentNode.style.fontSize="16px";
$("#chn_status_" + index)[0].parentNode.style.color="#000000";
$("#pb_disconn_all")[0].parentNode.style.color="#000000";
for(var i = 0; i < dvr_camcnt; i++)
{
if($("#chn_status_" + i)[0].parentNode.style.fontSize == "17px")
{
$("#pb_disconn_all")[0].parentNode.style.color="#ffffff";
$("#pb_conn_all")[0].parentNode.style.color="#ffffff";
return;
}
}
$("#pb_disconn_all")[0].parentNode.style.color="#000000";
$("#pb_conn_all")[0].parentNode.style.color="#ffffff";
return;
}
}
function close_all()
{
for(var i = 0; i < dvr_camcnt; i++)
{
close_one(i);
}
}
function toggle_one(index)
{
if($("#chn_status_" + index)[0].parentNode.style.fontSize == "16px" || $("#chn_status_" + index)[0].parentNode.style.fontSize == "")
{
open_one(index);
}
else
{
close_one(index);
}
}
As you can see there, the RTMP link should be rtmp://host/ch#_1.264 (Host is the local IP or remote domain/IP and # would be the camera channel number; also, I need the sub stream so it would be 1.264 and no 0.264). However, that doesn't seem to work.
Any ideas on what I might be missing here? Thanks in advance.