Unable to use QWebView to view ip camera feeds?



  • Hello all,

    i'm a beginner in programming. I came across Qt Project as it can support various systems.

    I tried using QWebView in my GUI and tested sites like Google and YouTube. Both websites are working fine.
    However, my aim of the project is to receive the feeds from IP camera(mjpeg).

    @ui->webCam->load(QUrl("http://192.168.1.23:50001/videofeed"));
    ui->webCam->show();@

    I tried the code as shown above, but the results is shown below.

    --Ba4oTvQMY8ew04N8dcnM Content-Type: image/jpeg ÿØÿàJFIFÿÛC (1#%(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egcÿÛC//cB8BccccccccccccccccccccccccccccccccccccccccccccccccccÿÀð@"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ?±Ò“RÖ&À)àqL§ƒÅ0Šn)ÆšEÒçÜÑցÎi@¦Ž)ÚSíIKE0ƒE” ):“­¥¦h¥4†€–’ŒÐ(¤ šm-!4†£jy¦51=0ŠúÓ4¦ÍHi>´€aRÒBi)i¦i†œi¦€iŒ¹© !Ñ攥%´‚Ú˜‚šiM%4Òf† p(—4‚@¢Š)€QŠP( â—¥¤&€šM úP0h=( ¤¥4ÚQE“´iâ¢<šÓH¦dS HÇ°¨È DmQÔ­ÅDMÒh&›Ö šCKI@4Šu5 i¦Š oŠwJhâ”sHc§Š‹¥H¼Ðâšiôc4ÄCŠB´ÜP1)E.1@ IFhi ¤Í%4„ÑIšZ))hRQEŒQGZÚZ(†Š)ˆi¦O4Ö4€ŒÔliìj3Å#4Âiæ˜i€Ê(4ibÒæšh ¤ÇsNÅ4õ ëF)h<ÒtRÓzÓñHbSÒš)GÀ˜t¥Å1ZŸLBbšE<Óh„QšqÓHbQIFhQšJJ-RPÑEQE€ÑÚƒILú ZJ(è))(„Ó =©”ÃL"¤5P"3íL"¤Å0ÐdSI§ša B ”RbŠC@ HhÍ(éH ÕìQKšC¤ÍÍÀU5(5Ó³M“4”Ðihi u¥4ŒŒSjFÂ)CIKŠ1@Ä¥¢ŠQI@ (£4„Ð ¤¢‚h(¢Š4ÑE! 4†ƒHzP!Í4Ó© #ja§µ7 a+S ÒŠ:š ¦ŸzZC@ E%nn§šŽž8#Iš â’˜ 4üÔc­=hâœ)´áLw RÐiZ~) ##ÓRL"ÆÑš)(¹£4”Pš)(QE(¢š%! š 4ÓM8Óh†šiÔÓ@ "˜iÆšhƨHÔÃ@ ¦šu6 E%-!¦ÓñM4µNš:RHc‰¥£Í(4 §Qæ€hu4ñP«T¡©€áJ)£4ÀZJ3EÓ >“†FE4Ô„TfÂŠJ(i3IK@“©¥ 4”RS¤ÍñI@„¤&”Óh)(ëHM1j3O4ÓHDmL4òi„f€HiM4Ð!(¤4PæšzÒö¤ ŒàRf›ÞŽ´†(äÓ…b‚h&€ÔÂrh U¹©¸ªÀ✁–•©ÙªÂJp’Àœp¨ƒSÃñ@R”€ñFi€˜¦0§ÓH¤2#IRM"ÆÑE ’Š;PM¥Í4ÐFh¤¦!¦ƒÒƒHM!¦ÒæÐ!)¬)Ý8¦š0ÓO4ãL&€E0óO4Ú4ÒRÓq@ÖŠ1Ekb”RÒRM¥&’€)§Kši4‡ŠMÝi ¦HcÃbœ%ÅB[Š…ž—„ù©VZËY©Rj.;ªù§†ªÍÅXI3T˜¬XÎMµ?4ÄƧgµ!ë@ÈȤ§°¦š‘ˆ}) /zC@ IEfž(Å!¦!¦Ó0óÅ JZCÒ€˜M; ¦Ð!¦˜iæ˜Gz4Ó§ÓM0ÑÒ–šy šL⊠lša4óQšC4™âŒRJPx¤<Ð8-FE0‚MXÛÅ4¥+?Âjß•“A@)¦SƒƒVEBÆ*¾*ÌRÕ1Á§«bšI&jPÜUߊ°š¤ÄXÝJ D§4ðsÅP‡u¤"–Ði¦ži†Ä4”J/Zi4¹Å0šJhâ—9¤ AM4¤ÒP!½i )⓵4ñM=)Çši¦!†’œi¦€E6žÔÚm´™ ¢)¤SéâM¥ÇÃÅ!ˆ)Úa 6(\ÑQ¥/@bC#ã4Žõ]ß4‡¨‹æ£fæ4Ž$ö¤1í-kÛhr2î“9=©n4rƒ#4X.Œ¥fQE8©8uÁëQÒ©Á¦È ¶õRdV¬¨$JÈž3™ìi›|H´¦ŸU¢|ŠœD¹ÎeéPŠzšÝǺ‡R ê¶<·Á¨î"ÆF(ìpÌ$´Z:•™Ë(¬ÃÁ¬ö4Z“¥¢SRT€uŠCLBSM)¦šNô‡­š@¥&h4(¤£µ&hM2”ô¤è(;Ð;Ò´¸ šn)ÇÚ›Ú€Ži¤w§œ aæ€/ 75j±mv'¥Iq3±jÎݦp£ñ®ªÎ݈¦—f"@ÄsZb©Y¯…ES9Å¢’ŠZ(¢˜SŠ†ê"’œF ¨»3I‰Êš´®É¥¾·Ï̽köèÃlq÷ºS5äçØÓ[…-ŒÕ…Mqypdx\egcÿÛC//cB8BccccccccccccccccccccccccccccccccccccccccccccccccccÿÀð@"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…

    *Chrome, Safari, Firefox are all able to view http://192.168.1.23:50001/videofeed

    I tried using QMediaPlayer too, but there is error when opening up the url.

    So am i on the right track using QWebView? or should i use some other widget? or can QWebView support mjpg? (plugins or ?)

    Thank you.



  • An MJPEG stream over HTTP is a series of JPEG images separated by a MIME-style boundary (See "M-JPEG_over_HTTP [Wikipedia]":http://tinyurl.com/cqleg2c). Qt has no M-JPEG decoder image plugin. You need to pull the stream apart at the boundaries and deal with the individual JPEG images.

    What you have shown is a Content-Type header followed by a valid looking JPEG file payload (treated as text). The gibberish before "Content-Type" is probably the preceding boundary marker, making this the second or later image.

    See also: http://qt-project.org/forums/viewthread/15617



  • Thanks Chris.. I saw this post regarding qimagegrabber too. Do you have any idea how to use it?



  • No, never used it. It does have an example. Quick scan of the code doesn't make it obvious how it handles the multi-part data.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.