def _get_per_sample_frames_bytes(self):
        """Returns a dictionary mapping sample IDs to total frame document
        sizes (in bytes) for each sample in the video collection.
        """
        if not self._contains_videos():
            return None

        pipeline = [
            {"$unwind": "$frames"},
            {"$replaceRoot": {"newRoot": "$frames"}},
            {
                "$group": {
                    "_id": "$_sample_id",
                    "size_bytes": {"$sum": {"$bsonSize": "$$ROOT"}},
                }
            },
        ]

        results = self._aggregate(pipeline=pipeline, attach_frames=True)
        return {str(r["_id"]): r["size_bytes"] for r in results}
Returns a dictionary mapping sample IDs to total frame document
        sizes (in bytes) for each sample in the video collection.
        
fiftyone/core/collections.py