2024-01-08 15:27:10 +03:00
|
|
|
<svg width="126ch" height="50em" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
2021-10-10 03:17:29 +03:00
|
|
|
<style>
|
2024-01-08 15:27:10 +03:00
|
|
|
* {
|
|
|
|
font-family: Courier, monospace;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
2023-12-08 12:39:06 +03:00
|
|
|
tspan, text {
|
2024-01-08 15:27:10 +03:00
|
|
|
font-variant-ligatures: none;
|
|
|
|
dominant-baseline: central;
|
2021-10-10 03:17:29 +03:00
|
|
|
white-space: pre;
|
|
|
|
fill: #bbbbbb;
|
|
|
|
}
|
2024-02-10 03:35:54 +03:00
|
|
|
.bg {
|
|
|
|
stroke-width: "0.5px";
|
|
|
|
}
|
|
|
|
.bold {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.underline {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
<!-- Foreground ANSI colors -->
|
|
|
|
.fa2 { fill: #00bb00; }
|
|
|
|
.fa3 { fill: #bbbb00; }
|
|
|
|
.fa6 { fill: #00bbbb; }
|
|
|
|
.fa8 { fill: #555555; }
|
|
|
|
.fa12 { fill: #5555ff; }
|
|
|
|
.fa15 { fill: #ffffff; }
|
2021-10-10 03:17:29 +03:00
|
|
|
</style>
|
2021-10-12 02:25:13 +03:00
|
|
|
<rect width="100%" height="100%" x="0" y="0" style="fill: #000000"/>
|
2024-03-17 15:45:30 +03:00
|
|
|
<text x="0ch" y="0.5em"><tspan class="fa15"># Overview of mp3 file</tspan></text>
|
|
|
|
<text x="0ch" y="1.5em"><tspan>$ fq . file.mp3</tspan></text>
|
|
|
|
<text x="0ch" y="2.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.{}: file.mp3 (mp3)</tspan></text>
|
|
|
|
<text x="0ch" y="3.5em"><tspan class="fa3">0x000</tspan><tspan>│49 44 33 </tspan><tspan class="bold">04 </tspan><tspan class="fa8">00 00 00 00 </tspan><tspan class="bold">15 </tspan><tspan>39 54 53 53 45 </tspan><tspan class="fa8">00 00</tspan><tspan>│ID3</tspan><tspan class="bold">.</tspan><tspan class="fa8">....</tspan><tspan class="bold">.</tspan><tspan>9TSSE</tspan><tspan class="fa8">..</tspan><tspan>│ </tspan><tspan class="fa12">headers</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">1</tspan><tspan>]:</tspan></text>
|
|
|
|
<text x="0ch" y="4.5em"><tspan class="fa3">* </tspan><tspan>│until 0xac2.7 (2755) │ │</tspan></text>
|
|
|
|
<text x="0ch" y="5.5em"><tspan class="fa3">0xac0</tspan><tspan>│ </tspan><tspan class="bold">ff fb </tspan><tspan>40 </tspan><tspan class="bold">c0 </tspan><tspan class="fa8">00 00 00 00 00 00 00 00 00</tspan><tspan>│ </tspan><tspan class="bold">..</tspan><tspan>@</tspan><tspan class="bold">.</tspan><tspan class="fa8">.........</tspan><tspan>│ </tspan><tspan class="fa12">frames</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">3</tspan><tspan>]:</tspan></text>
|
|
|
|
<text x="0ch" y="6.5em"><tspan class="fa3">0xad0</tspan><tspan>│</tspan><tspan class="fa8">00 00 00 00 00 00 00 00 </tspan><tspan>49 6e 66 6f </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">0f</tspan><tspan>│</tspan><tspan class="fa8">........</tspan><tspan>Info</tspan><tspan class="fa8">...</tspan><tspan class="bold">.</tspan><tspan>│</tspan></text>
|
|
|
|
<text x="0ch" y="7.5em"><tspan class="fa3">* </tspan><tspan>│until 0xd19.7 (end) (599) │ │</tspan></text>
|
|
|
|
<text x="0ch" y="8.5em"><tspan> │ │ │ </tspan><tspan class="fa12">footers</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">0</tspan><tspan>]:</tspan></text>
|
|
|
|
<text x="0ch" y="10.5em"><tspan class="fa15"># Show header of first ID3v2 tag inside mp3 file</tspan></text>
|
|
|
|
<text x="0ch" y="11.5em"><tspan>$ fq '.headers[0].header' file.mp3</tspan></text>
|
|
|
|
<text x="0ch" y="12.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.</tspan><tspan class="fa12">headers</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>].</tspan><tspan class="fa12">header</tspan><tspan>{}:</tspan></text>
|
|
|
|
<text x="0ch" y="13.5em"><tspan class="fa3">0x0</tspan><tspan>│49 44 33 │ID3 │ </tspan><tspan class="fa12">magic</tspan><tspan>: </tspan><tspan class="fa2">"ID3" </tspan><tspan>(valid)</tspan></text>
|
|
|
|
<text x="0ch" y="14.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="bold">04 </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">version</tspan><tspan>: </tspan><tspan class="fa6">4 </tspan><tspan>(valid)</tspan></text>
|
|
|
|
<text x="0ch" y="15.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan>│ </tspan><tspan class="fa8">. </tspan><tspan>│ </tspan><tspan class="fa12">revision</tspan><tspan>: </tspan><tspan class="fa6">0</tspan></text>
|
|
|
|
<text x="0ch" y="16.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan>│ </tspan><tspan class="fa8">. </tspan><tspan>│ </tspan><tspan class="fa12">flags</tspan><tspan>{}:</tspan></text>
|
|
|
|
<text x="0ch" y="17.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="fa8">00 00 </tspan><tspan class="bold">15 </tspan><tspan>39 │ </tspan><tspan class="fa8">..</tspan><tspan class="bold">.</tspan><tspan>9 │ </tspan><tspan class="fa12">size</tspan><tspan>: </tspan><tspan class="fa6">2745</tspan></text>
|
|
|
|
<text x="0ch" y="19.5em"><tspan class="fa15"># Show encoder software used</tspan></text>
|
|
|
|
<text x="0ch" y="20.5em"><tspan>$ fq -r '.frames[0].tag.encoder | tovalue' file.mp3</tspan></text>
|
|
|
|
<text x="0ch" y="21.5em"><tspan>Lavc58.13</tspan></text>
|
|
|
|
<text x="0ch" y="23.5em"><tspan class="fa15"># Decode at two offsets as mp3_frame and show bitrate</tspan></text>
|
|
|
|
<text x="0ch" y="24.5em"><tspan>$ fq -d bytes '.[0xb79,0xc49:] | mp3_frame.header.bitrate' file.mp3</tspan></text>
|
|
|
|
<text x="0ch" y="25.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│</tspan></text>
|
|
|
|
<text x="0ch" y="26.5em"><tspan class="fa3">0xb70</tspan><tspan>│ 50 │ P │.</tspan><tspan class="fa12">header</tspan><tspan>.</tspan><tspan class="fa12">bitrate</tspan><tspan>: </tspan><tspan class="fa6">64000 </tspan><tspan>(</tspan><tspan class="fa6">5</tspan><tspan>)</tspan></text>
|
|
|
|
<text x="0ch" y="27.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│</tspan></text>
|
|
|
|
<text x="0ch" y="28.5em"><tspan class="fa3">0xc40</tspan><tspan>│ 52 │ R │.</tspan><tspan class="fa12">header</tspan><tspan>.</tspan><tspan class="fa12">bitrate</tspan><tspan>: </tspan><tspan class="fa6">64000 </tspan><tspan>(</tspan><tspan class="fa6">5</tspan><tspan>)</tspan></text>
|
|
|
|
<text x="0ch" y="30.5em"><tspan class="fa15"># Extract PNG file</tspan></text>
|
|
|
|
<text x="0ch" y="31.5em"><tspan>$ fq '.headers[].frames[] | select(.id == "APIC")?.picture | tobits' file.mp3 >file.png</tspan></text>
|
|
|
|
<text x="0ch" y="32.5em"><tspan>$ file file.png</tspan></text>
|
|
|
|
<text x="0ch" y="33.5em"><tspan>file.png: PNG image data, 320 x 240, 8-bit/color RGB, non-interlaced</tspan></text>
|
|
|
|
<text x="0ch" y="35.5em"><tspan class="fa15"># Resolution of embedded PNG cover art as YAML</tspan></text>
|
|
|
|
<text x="0ch" y="36.5em"><tspan>$ fq -r '.headers[0].frames[] | grep_by(.id == "APIC") | grep_by(.type == "IHDR") | {res: {width, height}} | to_yaml' file.mp3</tspan></text>
|
|
|
|
<text x="0ch" y="37.5em"><tspan>res:</tspan></text>
|
|
|
|
<text x="0ch" y="38.5em"><tspan> height: 240</tspan></text>
|
|
|
|
<text x="0ch" y="39.5em"><tspan> width: 320</tspan></text>
|
|
|
|
<text x="0ch" y="41.5em"><tspan class="fa15"># Add query parameter to URL</tspan></text>
|
|
|
|
<text x="0ch" y="42.5em"><tspan>$ echo 'http://host?a=b' | fq -Rr 'from_url | .query.b = "a b c" | to_url'</tspan></text>
|
|
|
|
<text x="0ch" y="43.5em"><tspan>http://host?a=b&b=a+b+c</tspan></text>
|
|
|
|
<text x="0ch" y="45.5em"><tspan class="fa15"># Extract JSON and base64 encoded query parameter p</tspan></text>
|
|
|
|
<text x="0ch" y="46.5em"><tspan>$ echo 'https://host?p=eyJhIjoiaGVsbG8ifQ%3D%3D' | fq -R 'from_url.query.p | from_base64 | fromjson'</tspan></text>
|
|
|
|
<text x="0ch" y="47.5em"><tspan>{</tspan></text>
|
|
|
|
<text x="0ch" y="48.5em"><tspan> </tspan><tspan class="fa12">"a"</tspan><tspan>: </tspan><tspan class="fa2">"hello"</tspan></text>
|
|
|
|
<text x="0ch" y="49.5em"><tspan>}</tspan></text>
|
2021-10-10 03:17:29 +03:00
|
|
|
</svg>
|