2020-06-08 03:29:51 +03:00
|
|
|
# ffmpeg -f lavfi -i sine -t 10ms test.mp3
|
2021-09-16 01:46:25 +03:00
|
|
|
# test alt //
|
|
|
|
$ fq -d mp3 '.headers[].frames[0].flags.unsync // 123' /test.mp3
|
|
|
|
123
|
|
|
|
$ fq -d mp3 '.headers[].frames[0].size // 123' /test.mp3
|
2021-09-16 23:40:03 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-09-16 01:46:25 +03:00
|
|
|
0x00| 00 00| ..|.headers[0].frames[0].size: 15
|
|
|
|
0x10|00 0f |.. |
|
2021-08-09 16:55:49 +03:00
|
|
|
# test each in decoded order
|
2021-08-13 17:40:28 +03:00
|
|
|
$ fq -d mp3 '.headers[0][]' /test.mp3
|
2021-09-16 23:40:03 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-11-05 17:04:26 +03:00
|
|
|
0x0|49 44 33 |ID3 |.headers[0].magic: "ID3" (valid)
|
2021-09-16 23:40:03 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-08-09 16:55:49 +03:00
|
|
|
0x0| 04 | . |.headers[0].version: 4
|
2021-09-16 23:40:03 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-08-09 16:55:49 +03:00
|
|
|
0x0| 00 | . |.headers[0].revision: 0
|
2021-12-08 18:20:37 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.headers[0].flags{}:
|
2021-08-09 16:55:49 +03:00
|
|
|
0x0| 00 | . | unsynchronisation: false
|
|
|
|
0x0| 00 | . | extended_header: false
|
|
|
|
0x0| 00 | . | experimental_indicator: false
|
|
|
|
0x0| 00 | . | unused: 0
|
2021-09-16 23:40:03 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-08-09 16:55:49 +03:00
|
|
|
0x0| 00 00 00 23 | ...# |.headers[0].size: 35
|
2021-12-08 18:20:37 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.headers[0].frames[0:1]:
|
|
|
|
0x00| 54 53 53 45 00 00| TSSE..| [0]{}:
|
2021-08-09 16:55:49 +03:00
|
|
|
0x10|00 0f 00 00 03 4c 61 76 66 35 38 2e 34 35 2e 31|.....Lavf58.45.1|
|
|
|
|
0x20|30 30 00 |00. |
|
2021-09-16 23:40:03 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-11-05 17:04:26 +03:00
|
|
|
0x20| 00 00 00 00 00 00 00 00 00 00 | .......... |.headers[0].padding: raw bits (all zero)
|
2021-09-28 00:06:46 +03:00
|
|
|
# TODO: proper buffer_root test
|
|
|
|
$ fq -d mp3 -i . /test.mp3
|
2021-11-19 13:44:23 +03:00
|
|
|
mp3> .frames[0].header.mpeg_version | (topath | path_to_expr), tovalue, toactual, tosym, todescription
|
|
|
|
".frames[0].header.mpeg_version"
|
|
|
|
"1"
|
|
|
|
3
|
|
|
|
"1"
|
|
|
|
"MPEG Version 1"
|
|
|
|
mp3> .frames[0].header.bitrate | (topath | path_to_expr), tovalue, toactual, tosym, todescription
|
|
|
|
".frames[0].header.bitrate"
|
|
|
|
56000
|
|
|
|
4
|
|
|
|
56000
|
|
|
|
null
|
|
|
|
mp3> . | (root, buffer_root, format_root, parent | try topath | path_to_expr catch .), [parents | topath | path_to_expr]
|
2021-09-28 00:06:46 +03:00
|
|
|
"."
|
|
|
|
"."
|
|
|
|
"."
|
2021-11-19 13:44:23 +03:00
|
|
|
"expected a decode value but got: null (null)"
|
2021-09-28 00:06:46 +03:00
|
|
|
[]
|
2021-11-19 13:44:23 +03:00
|
|
|
mp3> .headers[0].magic | (root, buffer_root, format_root, parent | topath | path_to_expr), [parents | topath | path_to_expr]
|
2021-10-07 14:35:48 +03:00
|
|
|
"."
|
|
|
|
"."
|
|
|
|
".headers[0]"
|
|
|
|
".headers[0]"
|
|
|
|
[
|
|
|
|
".headers[0]",
|
|
|
|
".headers",
|
|
|
|
"."
|
|
|
|
]
|
2021-11-19 13:44:23 +03:00
|
|
|
mp3> .frames[0].side_info.granules[1] | (root, buffer_root, format_root, parent | topath | path_to_expr), [parents | topath | path_to_expr]
|
2021-09-28 00:06:46 +03:00
|
|
|
"."
|
|
|
|
"."
|
|
|
|
".frames[0]"
|
|
|
|
".frames[0].side_info.granules"
|
|
|
|
[
|
|
|
|
".frames[0].side_info.granules",
|
|
|
|
".frames[0].side_info",
|
|
|
|
".frames[0]",
|
|
|
|
".frames",
|
|
|
|
"."
|
|
|
|
]
|
|
|
|
mp3> 123 | root
|
|
|
|
error: expected a decode value but got: number (123)
|
|
|
|
mp3> 123 | buffer_root
|
|
|
|
error: expected a decode value but got: number (123)
|
|
|
|
mp3> 123 | format_root
|
|
|
|
error: expected a decode value but got: number (123)
|
|
|
|
mp3> 123 | parent
|
|
|
|
error: expected a decode value but got: number (123)
|
|
|
|
mp3> 123 | parents
|
|
|
|
error: expected a decode value but got: number (123)
|
|
|
|
mp3> ^D
|
|
|
|
$ fq -d mp3 -i . /test.mp3
|
2021-10-07 14:35:48 +03:00
|
|
|
mp3> . as $c | ("headers", 0, "abc") as $n | $n, try ($c | has($n)) catch .
|
|
|
|
"headers"
|
|
|
|
true
|
|
|
|
0
|
|
|
|
"cannot check whether object has a key: 0"
|
|
|
|
"abc"
|
|
|
|
false
|
|
|
|
mp3> .headers as $c | (0, "abc") as $n | $n, try ($c | has($n)) catch .
|
|
|
|
0
|
|
|
|
true
|
|
|
|
"abc"
|
|
|
|
"cannot check whether array has a key: abc"
|
|
|
|
mp3> .headers[0].magic as $c | (0, "abc") as $n | $n, try ($c | has($n)) catch .
|
|
|
|
0
|
|
|
|
"has cannot be applied to: string"
|
|
|
|
"abc"
|
|
|
|
"has cannot be applied to: string"
|
2021-11-03 19:19:33 +03:00
|
|
|
mp3> . as $c | ("_start", "_stop", "_len", "_name", "_root", "_buffer_root", "_format_root", "_parent", "_sym", "_description", "_path", "_bits", "_bytes", "_error", "_unknown", "_format", "_abc") as $n | $n, try ($c | has($n)) catch .
|
2021-10-07 14:35:48 +03:00
|
|
|
"_start"
|
|
|
|
true
|
|
|
|
"_stop"
|
|
|
|
true
|
|
|
|
"_len"
|
|
|
|
true
|
|
|
|
"_name"
|
|
|
|
true
|
|
|
|
"_root"
|
|
|
|
true
|
|
|
|
"_buffer_root"
|
|
|
|
true
|
|
|
|
"_format_root"
|
|
|
|
true
|
|
|
|
"_parent"
|
|
|
|
true
|
2021-11-03 19:19:33 +03:00
|
|
|
"_sym"
|
2021-10-07 14:35:48 +03:00
|
|
|
true
|
|
|
|
"_description"
|
|
|
|
true
|
|
|
|
"_path"
|
|
|
|
true
|
|
|
|
"_bits"
|
|
|
|
true
|
|
|
|
"_bytes"
|
|
|
|
true
|
|
|
|
"_error"
|
|
|
|
true
|
|
|
|
"_unknown"
|
|
|
|
true
|
|
|
|
"_format"
|
|
|
|
true
|
|
|
|
"_abc"
|
|
|
|
"expected a extkey but got: _abc"
|
2021-11-03 19:19:33 +03:00
|
|
|
mp3> .headers as $c | ("_start", "_stop", "_len", "_name", "_root", "_buffer_root", "_format_root", "_parent", "_sym", "_description", "_path", "_bits", "_bytes", "_error", "_unknown", "_format", "_abc") as $n | $n, try ($c | has($n)) catch .
|
2021-10-07 14:35:48 +03:00
|
|
|
"_start"
|
|
|
|
true
|
|
|
|
"_stop"
|
|
|
|
true
|
|
|
|
"_len"
|
|
|
|
true
|
|
|
|
"_name"
|
|
|
|
true
|
|
|
|
"_root"
|
|
|
|
true
|
|
|
|
"_buffer_root"
|
|
|
|
true
|
|
|
|
"_format_root"
|
|
|
|
true
|
|
|
|
"_parent"
|
|
|
|
true
|
2021-11-03 19:19:33 +03:00
|
|
|
"_sym"
|
2021-10-07 14:35:48 +03:00
|
|
|
true
|
|
|
|
"_description"
|
|
|
|
true
|
|
|
|
"_path"
|
|
|
|
true
|
|
|
|
"_bits"
|
|
|
|
true
|
|
|
|
"_bytes"
|
|
|
|
true
|
|
|
|
"_error"
|
|
|
|
true
|
|
|
|
"_unknown"
|
|
|
|
true
|
|
|
|
"_format"
|
|
|
|
true
|
|
|
|
"_abc"
|
|
|
|
"expected a extkey but got: _abc"
|
2021-11-03 19:19:33 +03:00
|
|
|
mp3> .headers[0].magic as $c | ("_start", "_stop", "_len", "_name", "_root", "_buffer_root", "_format_root", "_parent", "_sym", "_description", "_path", "_bits", "_bytes", "_error", "_unknown", "_format", "_abc") as $n | $n, try ($c | has($n)) catch .
|
2021-10-07 14:35:48 +03:00
|
|
|
"_start"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_stop"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_len"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_name"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_root"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_buffer_root"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_format_root"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_parent"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-11-03 19:19:33 +03:00
|
|
|
"_sym"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_description"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_path"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_bits"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_bytes"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_error"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_unknown"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_format"
|
2021-09-28 00:06:46 +03:00
|
|
|
true
|
2021-10-07 14:35:48 +03:00
|
|
|
"_abc"
|
|
|
|
"expected a extkey but got: _abc"
|
2021-09-28 00:06:46 +03:00
|
|
|
mp3> ^D
|
|
|
|
$ fq -d mp3 -i . /test.mp3
|
|
|
|
mp3> ._start
|
|
|
|
0
|
|
|
|
mp3> ._stop
|
|
|
|
5152
|
|
|
|
mp3> ._len
|
|
|
|
5152
|
|
|
|
mp3> ._name
|
|
|
|
""
|
|
|
|
mp3> ._root
|
2021-12-08 18:20:37 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: /test.mp3 (mp3)
|
|
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
2021-09-28 00:06:46 +03:00
|
|
|
* |until 0x2c.7 (45) | |
|
2021-12-08 18:20:37 +03:00
|
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
2021-09-28 00:06:46 +03:00
|
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
|
|
* |until 0x283.7 (end) (599) | |
|
2021-12-08 18:20:37 +03:00
|
|
|
| | | footers[0:0]:
|
2021-09-28 00:06:46 +03:00
|
|
|
mp3> ._buffer_root
|
2021-12-08 18:20:37 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: /test.mp3 (mp3)
|
|
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
2021-09-28 00:06:46 +03:00
|
|
|
* |until 0x2c.7 (45) | |
|
2021-12-08 18:20:37 +03:00
|
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
2021-09-28 00:06:46 +03:00
|
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
|
|
* |until 0x283.7 (end) (599) | |
|
2021-12-08 18:20:37 +03:00
|
|
|
| | | footers[0:0]:
|
2021-09-28 00:06:46 +03:00
|
|
|
mp3> ._format_root
|
2021-12-08 18:20:37 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: /test.mp3 (mp3)
|
|
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
2021-09-28 00:06:46 +03:00
|
|
|
* |until 0x2c.7 (45) | |
|
2021-12-08 18:20:37 +03:00
|
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
2021-09-28 00:06:46 +03:00
|
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
|
|
* |until 0x283.7 (end) (599) | |
|
2021-12-08 18:20:37 +03:00
|
|
|
| | | footers[0:0]:
|
2021-09-28 00:06:46 +03:00
|
|
|
mp3> ._parent
|
|
|
|
null
|
2021-11-03 19:19:33 +03:00
|
|
|
mp3> ._sym
|
2021-11-05 19:24:49 +03:00
|
|
|
null
|
2021-11-19 13:54:34 +03:00
|
|
|
mp3> todescription
|
2021-09-28 00:06:46 +03:00
|
|
|
"/test.mp3"
|
2021-11-19 13:44:23 +03:00
|
|
|
mp3> topath
|
2021-09-28 00:06:46 +03:00
|
|
|
[]
|
|
|
|
mp3> ._bits
|
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-11-05 17:04:26 +03:00
|
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..|.: raw bits 0x0-0x283.7 (644)
|
2021-09-28 00:06:46 +03:00
|
|
|
* |until 0x283.7 (end) (644) | |
|
|
|
|
mp3> ._bytes
|
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-11-05 17:04:26 +03:00
|
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..|.: raw bits 0x0-0x283.7 (644)
|
2021-09-28 00:06:46 +03:00
|
|
|
* |until 0x283.7 (end) (644) | |
|
|
|
|
mp3> ._error
|
|
|
|
null
|
|
|
|
mp3> ._unknown
|
|
|
|
false
|
|
|
|
mp3> ._format
|
|
|
|
"mp3"
|
|
|
|
mp3> ._abc
|
|
|
|
error: expected a extkey but got: _abc
|
2021-12-10 20:18:48 +03:00
|
|
|
mp3> fgrep("toc") | arrays[10]._index
|
|
|
|
10
|
|
|
|
mp3> .headers._index
|
|
|
|
error: expected a extkey but got: _index
|
|
|
|
mp3> ._index
|
|
|
|
error: expected a extkey but got: _index
|
2021-10-05 23:26:05 +03:00
|
|
|
mp3> ^D
|