0

So I've setup a nodejs environment to run some code on my local machine.

I'm using the datagram module to listen to a particular port number and udp address.

See below for my code.

import dgram from 'node:dgram';

//USER INPUT.  be sure to update the addresses below.  furthermore, use your computer's backdoor ip address to the MPU for LOCAL_IP_ADDRESS
const LOCAL_IP_ADDRESS = '10.3.1.24'
const MULTICAST_ADDRESS = '239.192.60.12'
const MULTICAST_PORT_NUMBER = 60012


const client = dgram.createSocket('udp4');
client.on('error', (err) => {
    console.log(`client error:\n${err.stack}`);
    client.close();
});

client.on('message', (msg, rinfo) => {
    console.log(`client got: ${msg} from ${rinfo.address}:${rinfo.port}`);
});

client.on('listening', () => {
    const address = client.address();
    console.log(`client listening ${address.address}:${address.port}`);
});

client.bind(MULTICAST_PORT_NUMBER, LOCAL_IP_ADDRESS, function () {
    client.addMembership(MULTICAST_ADDRESS, LOCAL_IP_ADDRESS);
});

That multicast-address:port has a video feed on a distant end being severed on the network. On my local machine I can play that video feed via VLC just fine.

I think my question is with the following function.

client.on('message', (msg, rinfo) => {
    console.log(`client got: ${msg} from ${rinfo.address}:${rinfo.port}`);
});

As I run this script its printing something totally unintelligible to my console. See below:

client got: GA9���������������������������������������������������������������������������������X�☼�U6�J��b*�^��g��c�♦K�+7��◄�J►Q►�,(�\C��3�7*���D�T�^GA|/�����u§+♀{�˽�◄�/�&8P▬�♀������GA���e◄=�[m�%;�xn���z∟�}��y�+↕�~�♣!MMP+�a�G�►♦>Kr���Sv.▬�΄o*�Ch+���\▼*T*��☺�n��a��U6�[��R�
�A'�km��J��~[m�|◄�l���‼Q64[������N‼p�K♥�X2#��>�"e⭶ݹTy��hLK�s(���Y�����@��m��q�]��wwAU6ww+�~‼^�h�
��mGA∟�}�ۿ�Vt6��&��▼ɡ)T�A���C▲♦ �l���ܬ_�U:�Kvؼ��n�v���=��⌂C����ջ~]♫e☼��u\XeZ����ݦ�m�M������⌂������efܬ�o����{¶��◄�j�8$*�n▲��|��~���nU+�vۄ�tEcr����X�]�ZX�記�:*'�,Kgφ♦J�§�T§GA↔��|e☼�e�4�tDڧ�▬/�؊�a�Z�§►��.۷�+=�[�M�    ���x uܪP���C*�↓♀_BA5▲e��7�����ɶ�k�5♂�tO����⌂���T5�Vcb☻�-�*�▼�y����0>G��C►��n�P�ҩoA\�_+↕�,7w��nl�CE�\��{���}��J�♂$7→�Ψw‼ɶ�j����{�g���GA▲�s��C�z�↓K‼��S� �|����px]B���♫↕/����?��m���"�~�'&�ဠ��q�-��a�~�‼��a���▼��↔�A5   �e☼�������^~�iTʥ♀_W��PH%q+      �♠�jl,▼���M☺6�y�>��v4‼Q��∟�v7�����Ll~��c☻@M8��1����;���xd~�♀�l����S][�����ML�'�☼�⌂�A5"��↕▲A*→�☼Z+~‼Q�⌂}��h��☼���~F=�G/→◄§ from 172.26.21.41:36392
client got: GA►.^]9��2�Wir��,@#qv�E4T↕‼�F*\� �►.m��-♦�\lq.9T�按��r�|�|e7�▲e6�↔�P�♣∟�-��▬&&&�e��ݳ���1�����☻♫)�↓y��SA��G ��E☼4&��ʆ��m�иC�D���     L��A/5�x►�幃(�↑+/|a1�'3$Pە�z�=}◄�۾Y♥☺B���GA◄���.��c��Ib��\���i5qv�ߗ�*�,E�‼*���↕l^↕�►y�5t♥3♠‼�↕_�ܻ#▲d_§��☻�;���▬\�P�↕↓3�Y�c،↑#p▼�ل_Q�+�i-�g�P�
x��g�����2�u�80��&E4Я���6       m3�@i��1�\��~%O�C▲�D�n���S:���► ,�ƇR�A����V30^Km�0GA↕▼��+����↓►3c♫��b♠^‼�∟f♫<�j��♠��J�vM&‼����R���U�N►�08bO↑$���&��7:F���J�P�ix�Q�����;��bt:�����↨i�¶↨�OZ�◄1#I�q�./%♥�q����ͮZGA‼◄�☻�����♀↕�♣pI��9|�eF��r��j��@�[��[��▬�§؍M�♀6����n6$�'�%�1���7�d��ၯ4�<e�    �
Rg��ZeS�k�i§�.���.\��.��2(�\V�M�4=���♂j5�R☺�0h���
�+���NT↔�☼�.Φ�Y)}�CZ¶�⌂�~↓'�p��ri)��ش�F◄%'��d►/j��↔N�܁♂�♀
Q�O�mPƑ?◄ǐ�4o]�m�9!�p�\v�%da☺�0�♀=⌂���jۗ�lΣ@Hm#�GA§y‼@7d�B♠)⌂IqY�-B/�∟��2����↔�ɞ��u���♀,ZGg��◄▼
↓t��c�i��∟�=��↑5↔�‼\�e1k��ʫ���M��<����`���]→a�ԑh↑�X�^�oP�4��T!̩�♀�=g3∟:dJm�ђ^B��↕��kɦ�-ۓ♀§�����
hFk�(�HȄj↑▲�Ԥr�GL���7H"��;�GA▬ކ‼3��↕�yҴ�vН��l��e\V�▼V��&        �����☺9V��↓\Ve♀♠�2`�h��rUp�Fe���Ϝ♫>!☺� -A���Q�?���☻�►→Ҙ�q�j↕��⌂��♂_-↑����→��������������∟0�‼v��U޷0���ē�C<}K>wmδMyV�2h�4A♦��{�Q=@▬��㦉sU�lo from 172.26.21.41:36392
client got: GA↨▼�↔%R��↨��J�?ͱ▼u�<!m¶y§$�Ѵ�/.��~�↑M��§E5Ϟ�nMo�����}�G‼�㫫�$��"#F���a��^�͸͉�R��m*
_��f~9�y��l);���͟%��y;���Y���oͅ�\�,►ꦎ�j��↨��-u����☼���:\-��ށ�!�9��tQ틭�5���we�‼h�⌂�rї��GA↑w!-↑�
#�z�-[��-►F�♀���∟Jk▼��:�^ZY)䬲��٢♫k�[m�r�˾����m��∟w�u���v�3m�h�N�B]♦⌂M$/5β/�[F7�ݒ�☻M�‼♫‼w�)���y�⌂jtl�^♂�Yl)Tۗ�RW�`�‼���z����3��♠0�h;���:������-���☺זA‼��⌂�|'��C#GA↓-ꐋH����_��♫)�l �q1▼V∟���U
l♀%�▲v<�����/→W�
�&ڠ���J��ѡۙb�et�䏡��‼�3���(���]Uo~:C�1�N)sS�→�♣�♠
&� C♂s﯋��R�     ↓����6 ҵ��Q{i��}�2ֳ�↓GA→H�▼�h`jK�i��-�w�U[4��;�T��↔F�a9i��Z������3�4����G⌂yɛ�m#
S�8d5��
Q��e�↕%^�ZS��u§��►T�Q��.�)R�0ӮF��s��]↑�e��t�M��?؀?^��→���&�[[���$♂6O���▲�gZ;��YQ~"df����&�/Í߮K�
�o�7�V͏x`�^�,GGA◄$♠�oI�☺�����►I�&�X�_�J��       �̋�=3��d�♥♫�O���&7i�n�i→ҋl��▼#��H☼�u�4�[m��v��♦
7���9����h�Hэz→��P�c�'F�a��O‼v�����     J�����j�[�f�[���U�v�q�X��g↓�♣↓pM͔��↨���4↑OӞ�Ut;�}���♠}�
n�^►�GGA∟N
����q��↔6~K��4ӵ◄&D��A▼a�N�6�����KDV�C↨�i�a��ӷ�ͻ�}��������^|�!��Z�i[5�l��\U���%&��f�,�l��\��� ��u����ѣ^�?.@�Y��\k�X�J8~]�?6�n#�p�K��$�N|�㺾k6e��M���M�y5��՝��☼���<�R�↨� ��p�x+�;4�M→6���F�_��myg�ӊ�%��R���-�E♀i�.kf�→e�♣�ɜ��M-1tsS�2�r�*�W˟-"��͖�,�_���]�� from 172.26.21.41:36392
client got: GA▲�↔�N�G�  �;↨a��aU↑d�g���o�I���%�Zh��垆�uqY�>H�W�|g?s_�kJ��0OCE↔�L����a§W��     Z>��$���斦sZ����lf���‼%6��}�~K����Od�♫���g�bU�]q�dU,Y���k?%��►�?☼4������→3�����N�E��l��▼aGA▼#*�TW��►��_�OGA►�kL�w��e��ߞ►��k>�Q�^�%/K��↨f?��(��)e�4i����r♠☼}>2*�-5F�⌂5ҷ��q�Z�U���u����mV9�:�k6�dGA↕���V��&w�d�I_↨i��☼�5��l��gO�4z�@��+�⌂���?��m+▲4��FZ/��c∟Wu�����O�z˒�_�9����4׈ݹ���E��-T�MsS>▼��8W�(�[���▼��}����\‼�☺��ˆ♥����aޙ�♠ʞ�§r.���§◄◄��K�Z‼�>�▲�<��G=♀↓d↓��&Z��io�?��iGA‼�C◄چ��E�Ʋi��˓F�}}�O�/%�˅p7↑�7X^rS�→�Fd�<}���jL�.��→�g☼4�☻^�q�◄�g���‼$��cyl��_↓�G��zГB�_◄����♠�n��1��HE�t��<T��k�<�|�5K�J�Y↑��i��n�{D�♂�"���H'&y`���↓}�����w���|�B�RZY;�$�U�Uw4'�GA¶���/� b∟o‼���K(v���▲L<0?���‼��&�4�g)���ɉ♠�      �$���4=]z��� _�6�I`��xK�N�☺��������i��0C4↨§��?�xf��(���▼L�`�f\�x����˞���Q���↔�_�|���e�t�       �ˈ�}���⌂�*�h5⌂�6�c"Ɗ:ģ�ڴC%◄�⌂������%Q-�щx�Ɯ from 172.26.21.41:36392    
?y�p�S\K������7]�h��!�8�)7�nz#�§wҭ��,]�md���▬��2S�t�|��ˢh˝y��►>�K-��k;�vf�►↔Z☼§�X�F1��E�v8��R2♂Vk�Q<��i��H�o↑LxC@��hf�������o��↓��h1��:�^��L�_�뿏�T�q�c�k�:cL�%�dp▼]k92�hB��◄�♦fu��&-�}���h�~◄��p�(;��Vl�yWi4K�(�zL��y_f����4�"���▼��1+��3�^&�S�}2��⌂��2R2�N�r�g��������j�D���L���M%�d�g���♣q�O�����OM<��
�↨��    ��ط��o|Dl�      �vڱ��☻BQ�♀S♥☺T�}��L_��3GA↑%�    sk�q(♥��i�Sg�٥)�▼����d�%⌂$�↕♠(U�w����_♣�AT��#��V♦Ԭ�~��Q.K☻→�@�↨�P�o�2"�5/▼��˖(ݦs��nx�jP↨g@e]�  ���m�I{�6�����Vn��p�����0�{|�↔NG�/!��j���♥rԞ�8��☺�����5��TV☼▬D_        �4�7▼�2Ea��GA↓�O��►�Č�,�7���↑m�\����'�hl�a.kMٮZ6��y:M?��4�Y�\�L�������0�>*�Q[⌂�zM2F��G|�e@NJ�y��O�o���栮�6ۥT�i=4��Q��;��y��mK�"|⌂�{�.'▼�▼��j�Hŝ�~⌂�a§��~嶐��c��uG�#YgI]ҳk#↕�♂�a∟�ELV�K0�#��s���*���↑�↔�u�����]]�ԼԳ��z+ڹ9uw|ܡ�b�z���m��g&���|�◄��↓��5\♂]�g���6�e�;M^�f6&|������*��
��▬�C�q��~�l˛����♣�^{�r�o���JMX���ʤ1�0њ�⌂��Jw�"�i4T��Q�%&�→0'�j�♥�-�1�→h��fξ◄�(D��W��S�♣��ܫ)3��ɸ^�|�j��→►��[o�%ݒ→��7�v�N�o\ثE���%w�B��ؼE� from 172.26.21.41:36392
client got: GA∟d^wH�!2�↕m�/5���6g�¶*g@�\↕o'r^hD�o�/�#����!��]r���\���^mn�H�y�9��►��c�ꝵy`חj��ں�-e�e����IdϚͤm.
�7%�q�+#��\�L��ή�♥]���Q��]�^�↓-o㧋y^�↕e�↔29��♣I�Er1=�♫�kۺ�>��֑�����v2�p�:�o�G A↔�~↕��}$¶SSm��˾
.H���'t7I���x▼�v 2Bj�=�u��i!�'?�������[���z�;4��♦NG@��N�6�0�♥▼ŗh��►�z&���[Run7�§ߗ<��\�a��!♫:ؾ��\�O�T
�Z���/�%�?z$d���→5�^�$����K���O�Uɥ_t�/%uGA▲�j��R[I"j��v�§Q     �������@hd��y���R҆~7b�;��th@�→O
�&▬�▬�r▲���$�ȯ/��E��}�4���♣2↑�Ժ�-=.�d��JJ�X��Y�M��u1�a��6w}ھ¶q�6˭���6&��Ԝ��GA▼���6��H���.N�B�]2ӳN�6���<F�U♀
K���ٙ↕��$��▲♦�+☻n���6h^"�<�}�\Wg�Jn��   3N�'�▬������dT�͌ۆ��♀'��͡�=�JϒqQ�ͨ籎���☺2»�|N����D���&��
'       ���GA►�����¶���Ӯ◄�V!k��S����qYL"��#♠♫��↨���k���Δ↕6�♠�=��q↔�q�H?��M�Ir�i♣q^mӥ�;�h�氤dn‼
"�1}Q��©�]٨☺[��?SI♦�U��ƚb`�<����x�ʇ�87�⌂�N^\��q2�dv�x��r~GA◄|ݲruUˤ�r�QCq�:C�sJu�&b�w��>]�ua䍋�ڼ��      o��ʪ�`P��F+����9↕��<o�1��|AM{�→�p޽��3�◄΀��⌂����S�W#☺ڰM���FX��N�Y��◄�&k�~N<��IJ�B$AX:�◄����♦z�↕��S�I���♦cB����_�g5#♥/��⌂-~��BT�פGA↕�7C▼�nI�↓��-^3���������h>/��u♂����&�G_0g���_�        
ad����_�}�§�w�W⌂���ɺ���q.j↓^�♠�,V5'-���V�N☼�uDF��&U*�3Z/�L�Q�%��=#��u��盾]>▼d�♦¶↨�H����↓�b�↑i�>�?��望����ޤ��rF�-|T�j��k� from 172.26.21.41:36392

What is that? Is that machine code of the video? I'm not expecting to view the video in the console (: Im just curious as to what is being printed to the console and how do I go about converting that into something human readable.

Thanks Pat!

  • 2
    Well, what do you expect? `msg` literally is a chunk of the video data. – Sebastian Simon Nov 09 '22 at 17:27
  • 1
    A video is binary data so it is not a string in some encoding e.g. UTF-8 or ASCII or whatever which you can print nicely. So what you see there is your computer trying to interpret some 0's and 1's as a string which does not give you useable output. You can have a look at how the video file is encoded and have a look at it with a hex editor if you're interested. – Mushroomator Nov 09 '22 at 17:30
  • so its just raw video data printed out to the console? I'm sorry I'm very much a rookie, just trying to wrap my head around this. – jonespm1.dev Nov 09 '22 at 17:35
  • @jonespm1.dev Yes. Open any video file in a hex editor. You’ll see the same stuff, essentially. – Sebastian Simon Nov 09 '22 at 17:37
  • @Mushroomator thank you sir! Now i know where to start looking. – jonespm1.dev Nov 09 '22 at 17:37
  • 1
    Looks like a MPEG Transport Stream to me. The `G` every 188 bytes is the give away - it's the 0x47 sync byte at the start of each transport packet. See https://en.wikipedia.org/wiki/MPEG_transport_stream. – Anonymous Coward Nov 10 '22 at 16:54

0 Answers0