mirror of
https://github.com/wader/fq.git
synced 2024-12-29 16:42:06 +03:00
44 lines
2.5 KiB
Plaintext
44 lines
2.5 KiB
Plaintext
/test.mp3:
|
|
$ fq -d mp3 '.headers[0].magic._bits[8:16] | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0| 44 | D |.: none 0x1-0x1.7 (1)
|
|
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|44 49| |DI| |.: none 0x0-0x1.7 (2)
|
|
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | tobits | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|44 49| |DI| |.: none 0x0-0x1.7 (2)
|
|
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | tobytes | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|44 49| |DI| |.: none 0x0-0x1.7 (2)
|
|
$ fq -n '"12" | tobytes | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|31 32| |12| |.: none 0x0-0x1.7 (2)
|
|
$ fq -n '"12" | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|31 32| |12| |.: none 0x0-0x1.7 (2)
|
|
$ fq -n '["12", "3"] | tobytes | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|31 32 33| |123| |.: none 0x0-0x2.7 (3)
|
|
$ fq -n '["12", "3"] | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|31 32 33| |123| |.: none 0x0-0x2.7 (3)
|
|
$ fq -n '[("11" | hex), ("22" | hex)] | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|11 22| |."| |.: none 0x0-0x1.7 (2)
|
|
# TODO: bug, hexdump uses io.Copy which is byte oritneted
|
|
$ fq -n '[("12" | hex | .bits[4:]), ("34" | hex | .bits[0:4])] | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0|20| | | |.: none 0x0-0x0.7 (1)
|
|
$ fq -d mp3 '.frames[]._bits[0:12] | tonumber' /test.mp3
|
|
4095
|
|
4095
|
|
4095
|
|
$ fq -d mp3 '.headers[0].magic._bits[0:24] | tostring' /test.mp3
|
|
"ID3"
|
|
$ fq -d mp3 '.frames[0].padding | ("", "md5", "base64", "snippet") as $f | tovalue({bits_format: $f})' /test.mp3
|
|
"<5>AAAAAAA="
|
|
"ca9c491ac66b2c62500882e93f3719a8"
|
|
"AAAAAAA="
|
|
"<5>AAAAAAA="
|