Extract compress image from memo field - compression

Dbf file in which the memo field contains the #SIXPIC# entry and a dbt file that contains binary data with #SIXPIC# tags
for example:
0000000000: 00 1A 0B 0C CE 9F 01 00 │ 49 49 2A 00 C0 9A 01 00 →♂♀Ο›☺ II* ��☺
0000000010: FF FF C0 04 00 40 FF FC │ A6 C9 0C F1 53 4F FF 80 ���♦ #����♀�SO��
0000000020: 08 00 80 29 B5 51 9B 17 │ FF FF 6A 23 F9 4D 96 08 ◘ �)�Q�↨��j#�M�◘
0000000030: 53 85 35 39 6D 12 85 09 │ D8 40 CC 81 85 2A A2 41 S�59m↕�○�#́›�*�A
0000000040: 10 20 D8 57 A0 F4 E5 7A │ F3 F9 78 B5 F4 02 FF 0B ► �W���z��x��☻�♂
0000000050: E5 70 C3 2D 07 F0 FC 8A │ 04 E9 FC 2F BB 84 1F FF �p�-•���♦��/��▼�
0000000060: 50 01 00 10 2B E8 19 45 │ AE E1 A4 4D 80 83 9A C3 P☺ ►+�↓E���M���Ò
0000000070: 92 03 99 08 0A 55 02 91 │ 40 9E FE 17 DF 4F FF AA ›♥�◘◙U☻�#��↨�O��
...
0000019F50: 00 00 21 03 00 00 68 02 │ 00 00 2E 02 00 00 FF 01 !♥ h☻ .☻ �☺
0000019F60: 00 00 13 02 00 00 F7 01 │ 00 00 06 02 00 00 D9 01 ‼☻ �☺ ♠☻ �☺
0000019F70: 00 00 7C 01 00 00 1B 01 │ 00 00 2A 01 00 00 17 01 |☺ ←☺ *☺ ↨☺
0000019F80: 00 00 ED 00 00 00 DF 00 │ 00 00 04 01 00 00 8C 01 � � ♦☺ �☺
0000019F90: 00 00 76 01 00 00 09 01 │ 00 00 E9 00 00 00 E9 00 v☺ ○☺ � �
0000019FA0: 00 00 83 00 00 00 77 00 │ 00 00 78 00 00 00 8C 00 � w x �
0000019FB0: 00 00 47 00 00 00 15 00 │ 00 00 88 00 00 00 06 00 G § � ♠
0000019FC0: 00 00 05 00 00 00 00 00 │ 80 25 00 00 20 00 00 00 ♣ �%
0000019FD0: 80 25 00 00 20 00 1A 01 │ 73 80 84 30 C1 B0 C1 40 �% →☺s��0���#
0000019FE0: 39 E0 E4 80 84 80 A7 69 │ 03 48 EA 1A 47 40 68 24 9�䀄››��i♥H�→G#h$
0000019FF0: 04 35 83 59 38 52 70 68 │ ♦5�Y8Rph
How to get an image from this code?

Related

Decoding video packets received from TCPReplay using C++/Qt

I have a PCAP file having the encoded video data. I am using TCPReplay to broadcast this PCAP data to my server where I have written a QT UDP socket program to receive these packets successfully and stored their data in a QByteArray.
Here I am using PCAP file and TCPReplay as a simulator. In reality these packets will be received from another process/server.
Problem:
I would like to decode these received packets.
How can I decode these packets in C++/Qt ?
What data structure to use? Do I need to involve any FFMPEG or Gstreamer APIs?
I am completely new to video decoding so please elaborate answer with some sample code.
These are my incoming bytes:
00 0C 29 02 E2 F7 04 91 62 CA 68 51 08 00 45 00 05 BA 00 00 00 00 80 11 5F F4 0A 00 02 0F C0 A8 08 88 C3 51 C3 51 05 A6 00 00 54 50 54 82 00 00 40 01 01 01 05 88 91 5A FB 3B 37 90 CD C7 11 35 56 03 20 20 02 0B E2 00 0A 80 08 00 09 80 08 00 08 64 64 64 06 00 00 00 00 00 00 00 00 00 00 00 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 F8 02 00 00 00 00 00 00 04 00 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 FF FF 64 64 64 64 64 64 AC E1 00 00 00 00 00 66 00 01 5C 80 FF 80 80 FF 00 01 80 80 FF 80 80 FF 00 02 5C 33 00 00 00 00 00 01 64 64 64 64 64 64 03 EB 00 FF 00 00 FF 00 00 04 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 0D 00 00 66 5C 80 FF 00 01 80 80 B6 33 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 64 64 64 64 64 64 03 DC 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 03 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 0E 00 00 00 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 64 64 64 64 64 64 03 DC 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 03 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 01 1D 48 DB 80 80 FF 00 01 80 80 FF 80 80 FF 00 01 80 80 FF 80 80 B6 00 01 33 00 3A 48 6E FF 00 01 80 80 FF 6E 48 3A 00 01 00 00 3A 48 6E FF 00 01 80 80 FF 6E 48 3A 00 01 00 00 66 5C 80 FF 00 01 80 80 FF 80 80 FF 00 01 80 80 FF 5C 33 00 00 01 00 00 66 5C 80 FF 00 01 80 80 FF 80 80 FF 00 02 80 80 B6 5C 5C FF 00 01 80 80 FF 80 80 FF 00 01 80 80 B6 33 00 00 00 01 00 00 66 5C 80 FF 00 01 80 80 FF 80 80 FF 00 01 80 80 FF 80 5C 66 00 01 00 00 00 00 33 B6 00 01 80 80 FF 80 80 FF 00 01 80 80 FF 80 6E 90 00 01 1D 00 00 00 00 00 00 01 64 64 64 64 64 64 03 D5 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 03 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 00 00 66 00 01 5C 80 FF 80 80 FF 00 01 80 80 FF 80 80 FF 00 01 80 80 FF 80 5C 66 00 01 64 64 64 64 64 64 00 02 1D 48 DB 80 80 FF 00 01 6E 48 3A 00 1D 90 00 01 6E 80 FF 80 6E 90 00 01 1D 1D 90 6E 80 FF 00 01 80 80 B6 33 00 3A 00 01 48 6E FF 80 80 FF 00 01 6E 48 3A 00 00 66 00 01 5C 80 FF 80 80 DB 00 01 48 1D 66 5C 80 FF 00 01 80 80 FF 5C 33 00 00 01 00 00 66 5C 80 FF 00 01 80 80 B6 33 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 3A 00 01 48 6E FF 80 80 DB 00 01 48 1D 00 00 00 00 00 01 33 5C FF 80 80 FF 00 01 6E 48 66 48 6E FF 00 01 80 80 DB 48 1D 00 00 01 33 5C FF 80 80 FF 00 01 6E 48 3A 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 02 05 17 00 01 64 64 64 64 64 64 03 C9 00 FF 00 00 00 00 00 01 FF FF 00 FF FF 00 00 02 FF FF 00 00 00 00 00 01 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 01 00 00 3A 48 6E FF 00 01 80 80 FF 80 80 FF 00 02 6E 48 3A 00 00 3A 00 01 48 6E FF 80 80 FF 00 01 80 80 FF 80 80 FF 00 01 80 5C 66 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 1D 48 DB 80 80 FF 00 01 6E 48 90 5C 80 FF 00 01 80 80 B6 33 00 00 00 01 00 00 66 5C 80 FF 00 01 80 80 B6 33 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 66 00 01 5C 80 FF 80 80 FF 00 01 80 80 FF 80 80 FF 00 02 80 5C 66 33 5C FF 00 01 80 80 FF 80 80 FF 00 01 80 6E 90 1D 00 00 00 01 64 64 64 64 64 64 00 0C 00 00 00 02 05 17 00 01 02 04 13 00 01 05 00 01 64 64 64 64 64 64 03 C8 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 03 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 00 00 00 00 00 3A 00 01 48 6E FF 80 80 FF 00 01 5C 33 00 00 00 00 00 01 1D 48 DB 80 80 FF 00 01 6E 48 3A 00 00 00 00 01 1D 48 DB 80 80 FF 00 01 80 80 FF 80 80 DB 00 01 48 1D 00 00 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 1D 48 DB 80 80 FF 00 01 6E 48 90 5C 80 FF 00 01 80 80 B6 33 00 00 00 01 00 00 66 5C 80 FF 00 01 80 80 B6 33 00 66 00 01 5C 80 FF 80 80 B6 00 01 33 00 00 00 1D 90 00 01 6E 80 FF 80 80 B6 00 01 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 02 00 00 00 00 33 B6 00 01 80 80 FF 80 80 FF 00 01 80 5C 66 00 00 00 00 01 64 64 64 64 64 64 00 0B 00 00 00 02 05 17 00 01 E5 E6 E8 02 04 13 00 01 64 64 64 64 64 64 03 C8 00 FF 00 00 00 00 00 01 64 64 64 64 64 64 00 03
Below is a hex view copied from Wireshark:
0000 00 0c 29 02 e2 f7 04 91 62 ca 68 51 08 00 45 00 ..).....b.hQ..E.
0010 05 ba 00 00 00 00 80 11 5f f4 0a 00 02 0f c0 a8 ........_.......
0020 08 88 c3 51 c3 51 05 a6 00 00 54 50 54 82 00 00 ...Q.Q....TPT...
0030 40 01 01 01 05 88 91 5a fb 3b 37 90 cd c7 11 35 #......Z.;7....5
0040 56 03 20 20 02 0b e2 00 0a 80 08 00 09 80 08 00 V. ............
0050 08 64 64 64 06 00 00 00 00 00 00 00 00 00 00 00 .ddd............
0060 64 64 64 64 64 64 ff ff 64 64 64 64 64 64 ff ff dddddd..dddddd..
0070 64 64 64 64 64 64 f8 02 00 00 00 00 00 00 04 00 dddddd..........
0080 64 64 64 64 64 64 ff ff 64 64 64 64 64 64 ff ff dddddd..dddddd..
0090 64 64 64 64 64 64 ff ff 64 64 64 64 64 64 ff ff dddddd..dddddd..
00a0 64 64 64 64 64 64 ff ff 64 64 64 64 64 64 ff ff dddddd..dddddd..
00b0 64 64 64 64 64 64 ac e1 00 00 00 00 00 66 00 01 dddddd.......f..
00c0 5c 80 ff 80 80 ff 00 01 80 80 ff 80 80 ff 00 02 \...............
00d0 5c 33 00 00 00 00 00 01 64 64 64 64 64 64 03 eb \3......dddddd..
00e0 00 ff 00 00 ff 00 00 04 00 ff 00 00 00 00 00 01 ................
00f0 64 64 64 64 64 64 00 0b 00 00 00 00 00 66 00 01 dddddd.......f..
0100 5c 80 ff 80 80 b6 00 01 33 00 00 00 00 00 00 01 \.......3.......
0110 64 64 64 64 64 64 00 0d 00 00 66 5c 80 ff 00 01 dddddd....f\....
0120 80 80 b6 33 00 66 00 01 5c 80 ff 80 80 b6 00 01 ...3.f..\.......
0130 33 00 00 00 00 00 00 01 64 64 64 64 64 64 03 dc 3.......dddddd..
0140 00 ff 00 00 00 00 00 01 64 64 64 64 64 64 00 03 ........dddddd..
0150 00 ff 00 00 00 00 00 01 64 64 64 64 64 64 00 0b ........dddddd..
0160 00 00 00 00 00 66 00 01 5c 80 ff 80 80 b6 00 01 .....f..\.......
0170 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 0e 3.......dddddd..
0180 00 00 00 00 00 66 00 01 5c 80 ff 80 80 b6 00 01 .....f..\.......
0190 33 00 00 00 00 00 00 01 64 64 64 64 64 64 03 dc 3.......dddddd..
01a0 00 ff 00 00 00 00 00 01 64 64 64 64 64 64 00 03 ........dddddd..
01b0 00 ff 00 00 00 00 00 01 64 64 64 64 64 64 00 0b ........dddddd..
01c0 00 00 00 00 00 66 00 01 5c 80 ff 80 80 b6 00 01 .....f..\.......
01d0 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 01 3.......dddddd..
01e0 1d 48 db 80 80 ff 00 01 80 80 ff 80 80 ff 00 01 .H..............
01f0 80 80 ff 80 80 b6 00 01 33 00 3a 48 6e ff 00 01 ........3.:Hn...
0200 80 80 ff 6e 48 3a 00 01 00 00 3a 48 6e ff 00 01 ...nH:....:Hn...
0210 80 80 ff 6e 48 3a 00 01 00 00 66 5c 80 ff 00 01 ...nH:....f\....
0220 80 80 ff 80 80 ff 00 01 80 80 ff 5c 33 00 00 01 ...........\3...
0230 00 00 66 5c 80 ff 00 01 80 80 ff 80 80 ff 00 02 ..f\............
0240 80 80 b6 5c 5c ff 00 01 80 80 ff 80 80 ff 00 01 ...\\...........
0250 80 80 b6 33 00 00 00 01 00 00 66 5c 80 ff 00 01 ...3......f\....
0260 80 80 ff 80 80 ff 00 01 80 80 ff 80 5c 66 00 01 ............\f..
0270 00 00 00 00 33 b6 00 01 80 80 ff 80 80 ff 00 01 ....3...........
0280 80 80 ff 80 6e 90 00 01 1d 00 00 00 00 00 00 01 ....n...........
0290 64 64 64 64 64 64 03 d5 00 ff 00 00 00 00 00 01 dddddd..........
02a0 64 64 64 64 64 64 00 03 00 ff 00 00 00 00 00 01 dddddd..........
02b0 64 64 64 64 64 64 00 0b 00 00 00 00 00 66 00 01 dddddd.......f..
02c0 5c 80 ff 80 80 ff 00 01 80 80 ff 80 80 ff 00 01 \...............
02d0 80 80 ff 80 5c 66 00 01 64 64 64 64 64 64 00 02 ....\f..dddddd..
02e0 1d 48 db 80 80 ff 00 01 6e 48 3a 00 1d 90 00 01 .H......nH:.....
02f0 6e 80 ff 80 6e 90 00 01 1d 1d 90 6e 80 ff 00 01 n...n......n....
0300 80 80 b6 33 00 3a 00 01 48 6e ff 80 80 ff 00 01 ...3.:..Hn......
0310 6e 48 3a 00 00 66 00 01 5c 80 ff 80 80 db 00 01 nH:..f..\.......
0320 48 1d 66 5c 80 ff 00 01 80 80 ff 5c 33 00 00 01 H.f\.......\3...
0330 00 00 66 5c 80 ff 00 01 80 80 b6 33 00 66 00 01 ..f\.......3.f..
0340 5c 80 ff 80 80 b6 00 01 33 00 00 00 00 3a 00 01 \.......3....:..
0350 48 6e ff 80 80 db 00 01 48 1d 00 00 00 00 00 01 Hn......H.......
0360 33 5c ff 80 80 ff 00 01 6e 48 66 48 6e ff 00 01 3\......nHfHn...
0370 80 80 db 48 1d 00 00 01 33 5c ff 80 80 ff 00 01 ...H....3\......
0380 6e 48 3a 00 00 00 00 01 64 64 64 64 64 64 00 0b nH:.....dddddd..
0390 00 00 00 02 05 17 00 01 64 64 64 64 64 64 03 c9 ........dddddd..
03a0 00 ff 00 00 00 00 00 01 ff ff 00 ff ff 00 00 02 ................
03b0 ff ff 00 00 00 00 00 01 00 ff 00 00 00 00 00 01 ................
03c0 64 64 64 64 64 64 00 0b 00 00 00 00 00 66 00 01 dddddd.......f..
03d0 5c 80 ff 80 80 b6 00 01 33 00 00 00 00 00 00 01 \.......3.......
03e0 64 64 64 64 64 64 00 01 00 00 3a 48 6e ff 00 01 dddddd....:Hn...
03f0 80 80 ff 80 80 ff 00 02 6e 48 3a 00 00 3a 00 01 ........nH:..:..
0400 48 6e ff 80 80 ff 00 01 80 80 ff 80 80 ff 00 01 Hn..............
0410 80 5c 66 00 00 66 00 01 5c 80 ff 80 80 b6 00 01 .\f..f..\.......
0420 33 00 00 00 00 00 00 01 1d 48 db 80 80 ff 00 01 3........H......
0430 6e 48 90 5c 80 ff 00 01 80 80 b6 33 00 00 00 01 nH.\.......3....
0440 00 00 66 5c 80 ff 00 01 80 80 b6 33 00 66 00 01 ..f\.......3.f..
0450 5c 80 ff 80 80 b6 00 01 33 00 00 00 00 66 00 01 \.......3....f..
0460 5c 80 ff 80 80 ff 00 01 80 80 ff 80 80 ff 00 02 \...............
0470 80 5c 66 33 5c ff 00 01 80 80 ff 80 80 ff 00 01 .\f3\...........
0480 80 6e 90 1d 00 00 00 01 64 64 64 64 64 64 00 0c .n......dddddd..
0490 00 00 00 02 05 17 00 01 02 04 13 00 01 05 00 01 ................
04a0 64 64 64 64 64 64 03 c8 00 ff 00 00 00 00 00 01 dddddd..........
04b0 64 64 64 64 64 64 00 03 00 ff 00 00 00 00 00 01 dddddd..........
04c0 64 64 64 64 64 64 00 0b 00 00 00 00 00 66 00 01 dddddd.......f..
04d0 5c 80 ff 80 80 b6 00 01 33 00 00 00 00 00 00 01 \.......3.......
04e0 00 00 00 00 00 3a 00 01 48 6e ff 80 80 ff 00 01 .....:..Hn......
04f0 5c 33 00 00 00 00 00 01 1d 48 db 80 80 ff 00 01 \3.......H......
0500 6e 48 3a 00 00 00 00 01 1d 48 db 80 80 ff 00 01 nH:......H......
0510 80 80 ff 80 80 db 00 01 48 1d 00 00 00 66 00 01 ........H....f..
0520 5c 80 ff 80 80 b6 00 01 33 00 00 00 00 00 00 01 \.......3.......
0530 1d 48 db 80 80 ff 00 01 6e 48 90 5c 80 ff 00 01 .H......nH.\....
0540 80 80 b6 33 00 00 00 01 00 00 66 5c 80 ff 00 01 ...3......f\....
0550 80 80 b6 33 00 66 00 01 5c 80 ff 80 80 b6 00 01 ...3.f..\.......
0560 33 00 00 00 1d 90 00 01 6e 80 ff 80 80 b6 00 01 3.......n.......
0570 33 00 00 00 00 00 00 01 64 64 64 64 64 64 00 02 3.......dddddd..
0580 00 00 00 00 33 b6 00 01 80 80 ff 80 80 ff 00 01 ....3...........
0590 80 5c 66 00 00 00 00 01 64 64 64 64 64 64 00 0b .\f.....dddddd..
05a0 00 00 00 02 05 17 00 01 e5 e6 e8 02 04 13 00 01 ................
05b0 64 64 64 64 64 64 03 c8 00 ff 00 00 00 00 00 01 dddddd..........
05c0 64 64 64 64 64 64 00 03 dddddd..

Formatting a file using regex

Spent some time trying to format a file with roughly 5,000 hex values, however with no luck. For example
1b 00 10 50 a3 bb 0e b7 ff ff 00 00 00 00 09 00
01 02 00 01 00 85 03 0e 00 00 00 55 0e 04 66 03
2a 38 32 80 00 0e 00 2f c2
1b 00 10 50 a3 bb 0e b7 ff ff 00 00 00 00 09 00
01 02 00 01 00 85 03 2b 00 00 00 55 2b 04 58 28
2a 39 32 80 00 01 00 12 57 4d 32 34 30 20 41 43
20 56 65 72 2e 41 00 00 23 06 00 0a 23 06 00 0a
01 00 00 c0 14 56
1b 00 30 a6 59 b8 0e b7 ff ff 00 00 00 00 09 00
00 02 00 01 00 04 03 0d 00 00 00 55 0d 04 33 2a
03 3a 32 40 00 0e be 40
1b 00 f0 01 f1 b6 0e b7 ff ff 00 00 00 00 09 00
00 02 00 01 00 04 03 0e 00 00 00 55 0e 04 66 2a
00 3b 32 40 00 01 05 c9 b1
and so on..
I need to format in the following matter:
1b 00 10 50 a3 bb 0e b7 ff ff 00 00 00 00 09 00 01 02 00 01 00 85 03 0e 00 00 00 55 0e 04 66 03 2a 38 32 80 00 0e 00 2f c2
1b 00 10 50 a3 bb 0e b7 ff ff 00 00 00 00 09 00 01 02 00 01 00 85 03 2b 00 00 00 55 2b 04 58 28 2a 39 32 80 00 01 00 12 57 4d 32 34 30 20 41 43 20 56 65 72 2e 41 00 00 23 06 00 0a 23 06 00 0a 01 00 00 c0 14 56
1b 00 30 a6 59 b8 0e b7 ff ff 00 00 00 00 09 00 00 02 00 01 00 04 03 0d 00 00 00 55 0d 04 33 2a 03 3a 32 40 00 0e be 40
1b 00 f0 01 f1 b6 0e b7 ff ff 00 00 00 00 09 00 00 02 00 01 00 04 03 0e 00 00 00 55 0e 04 66 2a 00 3b 32 40 00 01 05 c9 b1
Basically put each hex block into one line still separated by space. For the life of me, i cannot figure out the regular expression to format this for me. I have tried different expressions but everything i tried either removes the line that separates hex blocks or grabs a last character of the line instead of the actual \n.
Maybe there is a better way of formatting files other than using regex
Please try regex: (?!\n\n)\n
Demo

Create a 44-byte header with ffmpeg

I made a program using ffmpeg libraries that converts an audio file to a wav file. Except the only problem is that it doesn't create a 44-byte header. When input the file into Kaldi Speech Recognition, it produces the error:
ERROR (online2-wav-nnet2-latgen-faster:Read4ByteTag():wave-reader.cc:74) WaveData: expected 4-byte chunk-name, got read errror
I ran the file thru shntool and it reports a 78-byte header. Is there anyway I can get the standard 44-byte header using ffmpeg libraries?
FFmpeg inserts some metadata about the encoder into the header file. Here is the hexdump of the header before the fix:
00000000 52 49 46 46 06 90 00 00 57 41 56 45 66 6d 74 20 |RIFF....WAVEfmt |
00000010 10 00 00 00 01 00 01 00 40 1f 00 00 80 3e 00 00 |........#....>..|
00000020 02 00 10 00 4c 49 53 54 1a 00 00 00 49 4e 46 4f |....LIST....INFO|
00000030 49 53 46 54 0e 00 00 00 4c 61 76 66 35 36 2e 33 |ISFT....Lavf56.3|
00000040 36 2e 31 30 30 00 64 61 74 61 c0 8f 00 00 00 00 |6.100.data......|
as you can see Lavf56.36.100 is the encoder in the header. Here is the portion of code that I used to get rid of it.
std::cout<<"------------------BEFORE-----------------------"<<std::endl;
std::cout<< av_dict_count ( (*ofmt_ctx)->metadata) <<std::endl;
std::cout<<"-------------------------------------------"<<std::endl;
if(av_dict_set(&(*ofmt_ctx)->metadata,"ISFT",NULL, AV_DICT_IGNORE_SUFFIX)){
std::cerr<<"Nope it, didn't work :("<<std::endl;
}
ret = avformat_write_header(*ofmt_ctx,&(*ofmt_ctx)->metadata );
if (ret < 0) {
std::cout<<"-------------------------------------------"<<std::endl;
av_log(NULL, AV_LOG_ERROR, "Error occurred when writing header to file\n");
return ret;
}
std::cout<<"------------------AFTER-----------------------"<<std::endl;
std::cout<< av_dict_count ( (*ofmt_ctx)->metadata) <<std::endl;
std::cout<<"-------------------------------------------"<<std::endl;
Here is the hexdump afterwards:
00000000 52 49 46 46 e4 8f 00 00 57 41 56 45 66 6d 74 20 |RIFF....WAVEfmt |
00000010 10 00 00 00 01 00 01 00 40 1f 00 00 80 3e 00 00 |........#....>..|
00000020 02 00 10 00 64 61 74 61 c0 8f 00 00 00 00 00 00 |....data........|
00000030 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 |................|
shntool now report 44-bytes
(NOTE:ofmt_ctx was a ** in this function that I made, hence why referencing the metadata dictionary as &(*ofmt_ctx)->metadata)

how to read a file from hex editor and find equivalent ASCII values in c++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i have a file in hex looking like below
9C CB CB 8D 13 75 D2 11 91 58 00 C0 4F 79 56 A4
60 00 00 00 92 02 00 00 40 1F 00 00 80 14 00 00
A4 08 00 00 90 02 00 00 A0 09 01 00 40 AE 00 00
E4 27 00 00 90 02 00 00 A0 09 01 00 FC 7A 00 00
84 31 01 00 CF 01 00 00 A0 09 01 00 14 A7 00 00
24 3B 02 00 75 02 00 00 A0 09 01 00 50 8D 00 00
C4 44 03 00 14 02 00 00 A0 09 01 00 20 35 00 00
64 4E 04 00 C8 00 00 00 90 02 00 00 E8 03 00 00
00 00 00 00 00 08 00 00 CA 01 00 00 A4 00 00 00
first sixteen bytes (9C CB CB 8D 13 75 D2 11 91 58 00 C0 4F 79 56 A4) are showing header of my file.
This will convert the hexadecimal input to characters, and print them out (though the numbers 80 and greater won't actually be ASCII, since they're outside the range defined by ASCII):
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
int main() {
std::transform(std::istream_iterator<std::string>(std::cin),
std::istream_iterator<std::string>(),
std::ostream_iterator<char>(std::cout),
[](std::string const &in) {
return (char) strtol(in.c_str(), NULL, 16);
});
}
I'm not sure how much good that'll do for you, but it seems to be what you're asking, and without more information on what you really want, it's about as good as I think anybody can probably do.

What is the ds:0023:003a3000=?? stuff on the end of a drwatson FAULT?

I have the following entry in a Dr Watson log. What is the significance of the "ds:0023:003a3000=??" part of the entry to the right of the FAULT line?
*----> State Dump for Thread Id 0xdfc <----*
eax=00000000 ebx=00390320 ecx=0854ff48 edx=09e44bfc esi=00012ce1 edi=0854ff61
eip=00465c51 esp=0854ff30 ebp=00000000 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010246
function: sysman
00465c37 49 dec ecx
00465c38 eb02 jmp sysman+0x65c3c (00465c3c)
00465c3a 33c9 xor ecx,ecx
00465c3c 8d542428 lea edx,[esp+0x28]
00465c40 52 push edx
00465c41 51 push ecx
00465c42 8d4c2418 lea ecx,[esp+0x18]
00465c46 e8d5c0fcff call sysman+0x31d20 (00431d20)
00465c4b 33c0 xor eax,eax
00465c4d 8d4c2418 lea ecx,[esp+0x18]
FAULT ->00465c51 8a441eff mov al,[esi+ebx-0x1] ds:0023:003a3000=??
00465c55 50 push eax
00465c56 6864074900 push 0x490764
00465c5b 51 push ecx
00465c5c e8cfd0fcff call sysman+0x32d30 (00432d30)
00465c61 8d542424 lea edx,[esp+0x24]
00465c65 68689f4800 push 0x489f68
00465c6a 8d44242c lea eax,[esp+0x2c]
00465c6e 52 push edx
00465c6f 50 push eax
00465c70 e83bc3fcff call sysman+0x31fb0 (00431fb0)
*----> Stack Back Trace <----*
ChildEBP RetAddr Args to Child
00000000 00000000 00000000 00000000 00000000 sysman+0x65c51
*----> Raw Stack Dump <----*
000000000854ff30 58 01 55 08 75 07 c8 09 - 00 00 00 00 18 6d c7 01 X.U.u........m..
000000000854ff40 fc 4b e4 09 04 bd 47 00 - 04 bd 47 00 fc 0c c9 01 .K....G...G.....
000000000854ff50 ac ca ae 09 64 5f c4 01 - 20 37 37 30 32 34 3a 20 ....d_.. 77024:
000000000854ff60 00 b3 42 00 a8 ff 54 08 - 90 a6 47 00 02 00 00 00 ..B...T...G.....
000000000854ff70 8b c5 42 00 b8 ff 54 08 - 2e 03 39 00 28 99 cb 01 ..B...T...9.(...
000000000854ff80 ff ff ff ff 00 00 00 00 - 00 00 00 00 20 1e cb 01 ............ ...
000000000854ff90 a6 f7 ba 77 06 00 00 00 - c9 f7 ba 77 e1 6b d9 09 ...w.......w.k..
000000000854ffa0 06 00 00 00 1f 00 00 00 - 68 00 55 08 c1 a0 47 00 ........h.U...G.
000000000854ffb0 00 00 00 00 58 c4 42 00 - c9 a5 ca 09 d1 fb 38 0a ....X.B.......8.
000000000854ffc0 27 00 00 00 e1 6b d9 09 - ef f2 41 00 c9 a5 ca 09 '....k....A.....
000000000854ffd0 01 59 cc 01 38 00 55 08 - ec 00 55 08 00 00 00 00 .Y..8.U...U.....
000000000854ffe0 e0 00 55 08 ff ff ff ff - 89 00 00 00 01 00 01 01 ..U.............
000000000854fff0 c8 ff 54 08 b8 ff 54 08 - 77 00 55 08 29 a5 ca 09 ..T...T.w.U.)...
0000000008550000 51 00 00 00 5f 00 00 00 - 00 9f 82 7c 61 36 ca 01 Q..._......|a6..
0000000008550010 25 00 00 00 3f 00 00 00 - 00 ce bb 77 91 b7 c7 01 %...?......w....
0000000008550020 19 00 00 00 1f 00 00 00 - 00 ff ff ff d9 28 cc 01 .............(..
0000000008550030 0b 00 00 00 1f 00 00 00 - 00 00 55 08 d1 fb 38 0a ..........U...8.
0000000008550040 27 00 00 00 3f 00 00 00 - 00 20 ba 77 00 00 00 00 '...?.... .w....
0000000008550050 00 00 00 00 00 00 00 00 - 20 b7 c7 01 00 00 00 00 ........ .......
0000000008550060 00 00 00 00 00 00 00 00 - b4 00 55 08 1b 90 47 00 ..........U...G.`
To summarize:
You get a register dump here:
eax=00000000 ebx=00390320 ecx=0854ff48 edx=09e44bfc esi=00012ce1 edi=0854ff61
eip=00465c51 esp=0854ff30 ebp=00000000 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010246
The eip indicates the instruction that failed:
FAULT ->00465c51 8a441eff mov al,[esi+ebx-0x1] ds:0023:003a3000=??
The stuff at the end is the address that failed to read, which is the "usual" data segment of 23, and address 3A3000, whcih is composed of esi and ebx minus 1: 390320+12ce1-1. To me, that looks like an index gone bad - 3a3000 would be the first address of a new "page" in memory, so that's why it's failing at that point. 77025 bytes into an array is quite a long way, but it is of course possible that it's something else that is wrong.