https://github.com/savonet/ocaml-metadata
Library to read metadata from files in various formats.
https://github.com/savonet/ocaml-metadata
library metadata ocaml
Last synced: 6 months ago
JSON representation
Library to read metadata from files in various formats.
- Host: GitHub
- URL: https://github.com/savonet/ocaml-metadata
- Owner: savonet
- License: gpl-3.0
- Created: 2022-09-08T14:05:14.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T11:41:33.000Z (about 1 year ago)
- Last Synced: 2025-04-07T12:32:19.947Z (about 1 year ago)
- Topics: library, metadata, ocaml
- Language: OCaml
- Homepage: http://www.liquidsoap.info/ocaml-metadata/
- Size: 902 KB
- Stars: 10
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
The metadata library
====================
A pure OCaml library to read metadata from various formats. For now, are
supported:
- audio formats: ID3v1 and ID3v2 (for mp3), ogg/vorbis, ogg/opus, flac and wav
- image formats: jpeg and png
- video formats: mp4 and avi
- text formats: pdf
Usage
-----
Basic usage is
```ocaml
let () =
let metadata = Metadata.parse_file "test.mp3" in
List.iter (fun (k,v) -> Printf.printf "- %s: %s\n" k v) metadata
```
In the above example, the function `Metadata.parse_file` takes a file name as
argument and returns an association list describing its metadata. It consists of
pairs of strings being the name of the metadata and its value.
Installing
----------
The preferred way is via opam:
```bash
opam install metadata
```
Other libraries
---------------
- [ocaml-taglib](https://github.com/savonet/ocaml-taglib): for tags from audio
files (mp3, ogg, etc.)