meta-pytorch / meta-pytorch/torchcodec

More robust metadata serialization

Open
#97 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue refactor
Dominant language
Python
Stars
1.2k
Forks
125
Avg merge
22h 47m
Merged PRs (30d)
54

Description

To serialize the container/stream metadata to go from C++ to Python, we manually create a JSON string in the C++ code and parse that in Python to get a dict.

We should try to find a more robust way to do that. There are a few alternatives, but ultimately we are limited to what custom ops allow us to return. Some potential alternatives:

  • use a proper JSON library (in C++)
  • pack all the info into tensors.
  • If we're OK to drop the compile/export support for metadata, we could just bind the C++ structs to Python with pybind11.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the metadata construction in src/torchcodec/decoders/_core/VideoDecoderOps.cpp around line 196 and its parsing in src/torchcodec/decoders/_core/_metadata.py around line 81. Compare a C++ JSON library, tensor packing, and pybind11 bindings against the custom-op and compile/export constraints described in the issue. Done means metadata crosses the C++/Python boundary robustly with the required support preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.