Yealink Forums
T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - Printable Version

+- Yealink Forums (http://forum.yealink.com/forum)
+-- Forum: IP Phone Series (/forumdisplay.php?fid=4)
+--- Forum: Phone specific topic (/forumdisplay.php?fid=12)
+--- Thread: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key (/showthread.php?tid=40689)

Pages: 1 2


T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - smartpc - 03-13-2017 10:41 AM

We have a Installation with Vivotek IP Cams in front of the Office Door. If somebody rings the doorbell it would be good if it could be possible to use the Yealink T46G so see who is there.

So is it possible with yealink IP phones to show a streaming picture or video stream of an ip cam? I know with snom or Auerswald IP phones its possible without a hassle.


regards,
tobias


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - complex1 - 03-13-2017 04:30 PM

(03-13-2017 10:41 AM)smartpc Wrote:  We have a Installation with Vivotek IP Cams in front of the Office Door. If somebody rings the doorbell it would be good if it could be possible to use the Yealink T46G so see who is there.

So is it possible with yealink IP phones to show a streaming picture or video stream of an ip cam? I know with snom or Auerswald IP phones its possible without a hassle.


regards,
tobias

Hi Tobias,

I don’t think the T46G has this kind of feature on board.
Did you read this in the datasheet or does it mention something about this possibility?
Maybe the Yealink SIP VP-T49G is a better solution for you?

If I may ask:
Which Standalone Snom Deskphone series support this feature but not in combination with snom.io? Not the Snom D3x5 or D7x5 serie?


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - jolouis - 03-13-2017 07:50 PM

Nope this is another one of those "hmmm should have been done but wasnt" things. We tried a number of different ways to approach this and came to the conclusions your only choices with Yealink were:
1) Use a T49 and do a SIP video call to a SIP-friendly IP camera/door phone
2) Wire up a DSS key to launch an XML browser to the server, and have the server run a script that grabs a single frame from the camera, re-sizes it to what the phone expects, and then displays it. Not ideal in any way, but better than nothing.
3) Give up and sell the customer a $50 7"Android tablet to put beside their phone with the manufacturer's viewer software installed.

I'm sure Yealink could easily implement at least low frame rate MJPEG on T48/T46 and maybe even T29s, but my guess is demand for it is low or they want you to just buy T49s. In the end we went with option #3 because it was by far the easiset and most cost effective, as users ended up wanting to have their video feeds running while talking on the phone and while sitting idle, without that interfering with caller display/etc.


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - smartpc - 03-14-2017 08:30 AM

(03-13-2017 04:30 PM)complex1 Wrote:  
(03-13-2017 10:41 AM)smartpc Wrote:  We have a Installation with Vivotek IP Cams in front of the Office Door. If somebody rings the doorbell it would be good if it could be possible to use the Yealink T46G so see who is there.

So is it possible with yealink IP phones to show a streaming picture or video stream of an ip cam? I know with snom or Auerswald IP phones its possible without a hassle.


regards,
tobias

Hi Tobias,

I don’t think the T46G has this kind of feature on board.
Did you read this in the datasheet or does it mention something about this possibility?
Maybe the Yealink SIP VP-T49G is a better solution for you?

If I may ask:
Which Standalone Snom Deskphone series support this feature but not in combination with snom.io? Not the Snom D3x5 or D7x5 serie?

Hi,

@complex1: snom has a Wiki Link for this: http://wiki.snom.com/Category:HowTo:Video_Streaming

The snom phones supporting this are:
snom820
snom821
snom870
snom760
snomD765
snomD375

Gigaset IP Phones does also support this. At least the DE700 IP.

So hopefully the T46G support ist too. I guess this shoudn't be so hard. Isn't it possible with the XML Browser Function?

@jolouis: Great info. I think, option 2 would be my plan because i have a Webserver in the LAN which can handle this. But i guess in Future i will sell SIP Doorbells to my customers so this Problem should be obsolete.

But anyway option 2 is good for having a fast look at the camera in the server room for example.

Have you ever done option 2 in a test to tell if it runs reliable? if so can you tell me how to setup the xml file for the xml browser function?

regards,
tobias


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - jolouis - 03-14-2017 03:18 PM

@Tobias: Yup it works if you just want to take a quick peak at things and are not after actual video.

Basically I took the sample "display full screen image" XML browser file from the Yealink docs. Instead of an actual image file I pointed the URL to a PHP script. The PHP script grabbed a frame from the IP camera using the camera's snapshot API (we were using a Hikvision that has this feature), runs a quick resize on it, and then outputs it as a JPEG for the XML browser to display. We did find that the XML document itself needed to be generated by PHP also as the URL needed to have a random query string, otherwise the phone cached the image and always just displayed the same thing.

So it works, but not ideal by any means. If Yealink were to at least support MJPEG in their XML browser, or heck even let their XML browser grab the first frame of an MJPEG file and then give up, it would make this task much easier.


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - smartpc - 03-14-2017 07:52 PM

(03-14-2017 03:18 PM)jolouis Wrote:  @Tobias: Yup it works if you just want to take a quick peak at things and are not after actual video.

Basically I took the sample "display full screen image" XML browser file from the Yealink docs. Instead of an actual image file I pointed the URL to a PHP script. The PHP script grabbed a frame from the IP camera using the camera's snapshot API (we were using a Hikvision that has this feature), runs a quick resize on it, and then outputs it as a JPEG for the XML browser to display. We did find that the XML document itself needed to be generated by PHP also as the URL needed to have a random query string, otherwise the phone cached the image and always just displayed the same thing.

So it works, but not ideal by any means. If Yealink were to at least support MJPEG in their XML browser, or heck even let their XML browser grab the first frame of an MJPEG file and then give up, it would make this task much easier.

Yeah, hopefully Yealink will update their Firmware with some useful Addon Functions like this soon.

Could you tell me the code you used for that? Im not that experienced in coding php so testing this fuction would be much easier with modifying your code than create it from scratch.

thanx in advance.
cheers


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - Karl_Yealink - 03-16-2017 09:35 AM

(03-14-2017 07:52 PM)smartpc Wrote:  
(03-14-2017 03:18 PM)jolouis Wrote:  @Tobias: Yup it works if you just want to take a quick peak at things and are not after actual video.

Basically I took the sample "display full screen image" XML browser file from the Yealink docs. Instead of an actual image file I pointed the URL to a PHP script. The PHP script grabbed a frame from the IP camera using the camera's snapshot API (we were using a Hikvision that has this feature), runs a quick resize on it, and then outputs it as a JPEG for the XML browser to display. We did find that the XML document itself needed to be generated by PHP also as the URL needed to have a random query string, otherwise the phone cached the image and always just displayed the same thing.

So it works, but not ideal by any means. If Yealink were to at least support MJPEG in their XML browser, or heck even let their XML browser grab the first frame of an MJPEG file and then give up, it would make this task much easier.

Yeah, hopefully Yealink will update their Firmware with some useful Addon Functions like this soon.

Could you tell me the code you used for that? Im not that experienced in coding php so testing this fuction would be much easier with modifying your code than create it from scratch.

thanx in advance.
cheers
You will get more info about XML from the guide below.
Link: http://download.support.yealink.com/download?path=upload%2Fattachment%2F2017-3-13%2F3%2F343a1a4a-8879-4b1c-9665-4677991362e1%2FYealink_SIP-T2_Series_T19%28P%29%20E2_T4_Series_CP860_IP_Phones_XML_Browser_Developer%27s_Gu​ide_V81_40.pdf

For now, my suggestion is using XML browser, I will give suggestion to our PM.
Hope they will consider and develop in future.


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - dialog-se - 04-07-2017 06:43 AM

(03-13-2017 07:50 PM)jolouis Wrote:  2) Wire up a DSS key to launch an XML browser to the server, and have the server run a script that grabs a single frame from the camera, re-sizes it to what the phone expects, and then displays it. Not ideal in any way, but better than nothing.
3) Give up [...]

That's almost exactly how we tried to do it.
Also the HD camera would not let you grab single jpeg frames over http, but insists in making you use rtsp (actually makes sense regarding bandwith), so we grabbed a single frame from the rtsp stream using a Python script on a Windows VM that calls ffmpeg...

It turned out that the whole process from pressing the DSS button to actually seeing the picture would take almost 10 seconds, and most of that was not caused by ffmpeg having to connect to the camera first (also it didn't look nice as the screen would flash multiple times)

So we abandoned this, however just in case the XML might be useful for someone, here's the script I wrote back then:

Code:
from http.server import HTTPServer, BaseHTTPRequestHandler
import string, subprocess

rtspURL = "rtsp://192.168.0.149:554/ucast/11"

yealink_xml = """<?xml version="1.0" encoding="ISO-8859-1"?>
<YealinkIPPhoneImageScreen Beep="no" Timeout="5" LockIn="no" mode="regular">
    <Image verticalAlign="middle" horizontalAlign="middle">http://192.168.0.120/doorcam.jpg</Image>
</YealinkIPPhoneImageScreen>"""

class DoorCamHTTPRequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        if(self.path == "/doorcam.jpg"):
            resultimage = subprocess.check_output("ffmpeg.exe -i " + rtspURL + " -f image2 -vframes 1 -")
            
            self.send_response(200)
            self.send_header('Content-type','image/jpg')
            self.send_header('Connection','close')
            self.send_header('Content-Length', len(resultimage))
            self.end_headers()
            self.wfile.write(resultimage);
        else:
            self.send_response(200)
            self.send_header('Content-type','text/xml')
            self.send_header('Connection','close')
            self.send_header('Content-Length', len(yealink_xml.encode()))
            self.end_headers()
            self.wfile.write(yealink_xml.encode());

print("starting http server")
server_address = ('', 80)
# todo: ThreadingMixIn
httpd = HTTPServer(server_address, DoorCamHTTPRequestHandler)
httpd.serve_forever()

192.168.0.120 being the Windows machine this ran on, .149 the camera.
I think you should add some resize / crop depending on the resolution of your camera image.


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - dialog-se - 04-07-2017 07:07 AM

(03-13-2017 07:50 PM)jolouis Wrote:  2) Wire up a DSS key to launch an XML browser to the server, and have the server run a script that grabs a single frame from the camera, re-sizes it to what the phone expects, and then displays it. Not ideal in any way, but better than nothing.
3) Give up [...]

That's almost exactly how we tried to do it.
Also the HD camera would not let you grab single jpeg frames over http, but insists in making you use rtsp (actually makes sense regarding bandwith), so we grabbed a single frame from the rtsp stream using a Python script on a Windows VM that calls ffmpeg...

It turned out that the whole process from pressing the DSS button to actually seeing the picture would take almost 10 seconds, and most of that was not caused by ffmpeg having to connect to the camera first (also it didn't look nice as the screen would flash multiple times)

So we abandoned this, however just in case the XML might be useful for someone, here's the script I wrote back then:

Code:
from http.server import HTTPServer, BaseHTTPRequestHandler
import string, subprocess

rtspURL = "rtsp://CAMERA_HOST:554/ucast/11"

yealink_xml = """<?xml version="1.0" encoding="ISO-8859-1"?>
<YealinkIPPhoneImageScreen Beep="no" Timeout="5" LockIn="no" mode="regular">
    <Image verticalAlign="middle" horizontalAlign="middle">HOST_WHERE_THIS_RUNS/doorcam.jpg</Image>
</YealinkIPPhoneImageScreen>"""

class DoorCamHTTPRequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        if(self.path == "/doorcam.jpg"):
            resultimage = subprocess.check_output("ffmpeg.exe -i " + rtspURL + " -f image2 -vframes 1 -")
            
            self.send_response(200)
            self.send_header('Content-type','image/jpg')
            self.send_header('Connection','close')
            self.send_header('Content-Length', len(resultimage))
            self.end_headers()
            self.wfile.write(resultimage);
        else:
            self.send_response(200)
            self.send_header('Content-type','text/xml')
            self.send_header('Connection','close')
            self.send_header('Content-Length', len(yealink_xml.encode()))
            self.end_headers()
            self.wfile.write(yealink_xml.encode());

print("starting http server")
server_address = ('', 80)
# todo: ThreadingMixIn
httpd = HTTPServer(server_address, DoorCamHTTPRequestHandler)
httpd.serve_forever()

192.168.0.120 being the Windows machine this ran on, .149 the camera.
I think you should add some resize / crop depending on the resolution of your camera image.

// edit: Akismet apparently did not allow me to include http links


RE: T46G - Display IP Cam Picture or MJPG Video Stream via DSS Key - jolouis - 04-07-2017 01:29 PM

(04-07-2017 07:07 AM)dialog-se Wrote:  That's almost exactly how we tried to do it....

It turned out that the whole process from pressing the DSS button to actually seeing the picture would take almost 10 seconds, and most of that was not caused by ffmpeg having to connect to the camera first (also it didn't look nice as the screen would flash multiple times)

Not suggesting this is a proper solution at all, but in our test we solved the delay problem by basically turning the script into a small daemon and leaving it running on the background of our Asterisk box (linux server). Same sort of idea as you had, except it was on a loop to grab a new frame every second or two, resize it and save it to the same file in a tmp ram drive directory over and over. That way the Yealink XML just had to pull in the already generated file which was no slower than loading any other image.

(We actually reduced the overhead even more because the Hikvision camera we were using supported multiple output streams, so we were able to configure a lower resolution one for this specific application, which meant it took almost no processing power to leave our "interpretter script" running all the time).

Native MJPEG support (or at least grabbing and just displaying the first frame of an MJPEG stream) would be much easier of course, but I wouldn't be surprised if there'd still be a delay incurred during stream start up...