Parse user metadata

Aperta
#356 1 commento 3 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript, typescript
Ambito
data

Direzione di ricerca

This is a usage question about walking MP4 udta/ilst boxes: the sample calls mp4boxFile.getBoxes("ilst") and then dumps the raw payload with TextDecoder, and asks whether ilst is the only box holding user metadata such as comments. Start in the box-parsing sources (the udta/meta/ilst box definitions and getBoxes) to see whether ilst children are exposed as parsed boxes or only as raw data, and test with a file that carries a comment atom. Done means a documented, correct way to read comment metadata, or a small parser improvement, rather than manual byte decoding.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

question

I’m trying to get the users metadata of a video (comment notably). I tried to do something like that:

<!DOCTYPE html>
<html>
  <head>
    <title>MP4 Metadata Extraction</title>
  </head>
  <body>
    <input type="file" id="fileInput" accept=".mp4">
    <div id="metadataDisplay"></div>

    <script src="mp4box.all.js"></script>
    <script>
      document.getElementById("fileInput").addEventListener("change", function (e) {
        const file = e.target.files[0];
        if (file) {
          const reader = new FileReader();

          reader.onload = function (e) {
            const arrayBuffer = e.target.result;

            // Initialize mp4box
            const mp4boxFile = MP4Box.createFile();
            mp4boxFile.onReady = (info) => {
              console.log("READY");
              console.log(info);
            };
            mp4boxFile.onError = () => {
              console.log("Error");
            };
            // Create a Blob from the ArrayBuffer
            /* const blob = new Blob([arrayBuffer]);
             */
            console.log("created blob");

            // Read the Blob using mp4box
            arrayBuffer.fileStart = 0;
            mp4boxFile.appendBuffer(arrayBuffer);

            // Get metadata, ilst is inside udta, and seems to be the one with comments (maybe others could as well?)
            /* const udtaBoxes = mp4boxFile.getBoxes("udta"); */
            const ilstBoxes = mp4boxFile.getBoxes("ilst");

            const decoder = new TextDecoder('utf-8');
            ilstBoxes.forEach( (ilstBox) => {
              console.log(decoder.decode(ilstBox.data));
            });
          };
          reader.readAsArrayBuffer(file);
        }
      });
    </script>
  </body>
</html>

and I’m close enough to get the content, but I’m not sure how to parse it further, and I’m not sure if this is the only box that can contain user content. Is there a simpler way to get user metadata, like comments?

Lingua principale
TypeScript
Stelle
2.5k
Fork
390
Merge medio
1g 17h
PR unite (30g)
8

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di gpac/mp4box.js

Tutte le issue di gpac/mp4box.js

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.