def add_labeled_videos(
    dataset,
    samples,
    sample_parser,
    label_field=None,
    tags=None,
    expand_schema=True,
    dynamic=False,
    generator=False,
    progress=None,
):
    """Adds the given labeled videos to the dataset.

    This operation will iterate over all provided samples, but the videos will
    not be read/decoded/etc.

    See :ref:`this guide <custom-sample-parser>` for more details about
    adding labeled videos to a dataset by defining your own
    :class:`LabeledVideoSampleParser`.

    Args:
        dataset: a :class:`fiftyone.core.dataset.Dataset`
        samples: an iterable of samples that can be parsed by ``sample_parser``
        sample_parser: a :class:`LabeledVideoSampleParser` instance to use to
            parse the samples
        label_field (None): controls the field(s) in which imported labels are
            stored. If the parser produces a single
            :class:`fiftyone.core.labels.Label` instance per sample/frame, this
            argument specifies the name of the field to use; the default is
            ``"ground_truth"``. If the parser produces a dictionary of labels
            per sample/frame, this argument can be either a string prefix to
            prepend to each label key or a dict mapping label keys to field
            names; the default in this case is to directly use the keys of the
            imported label dictionaries as field names
        tags (None): an optional tag or iterable of tags to attach to each
            sample
        expand_schema (True): whether to dynamically add new sample fields
            encountered to the dataset schema. If False, an error is raised
            if a sample's schema is not a subset of the dataset schema
        dynamic (False): whether to declare dynamic attributes of embedded
            document fields that are encountered
        generator (False): whether to yield ID batches as a generator as
            samples are added to the dataset
        progress (None): whether to render a progress bar (True/False), use the
            default value ``fiftyone.config.show_progress_bars`` (None), or a
            progress callback function to invoke instead

    Returns:
        a list of IDs of the samples that were added to the dataset
    """
    if not isinstance(sample_parser, LabeledVideoSampleParser):
        raise ValueError(
            "`sample_parser` must be a subclass of %s; found %s"
            % (
                etau.get_class_name(LabeledVideoSampleParser),
                etau.get_class_name(sample_parser),
            )
        )

    if isinstance(label_field, dict):
        label_key = lambda k: label_field.get(k, k)
    elif label_field is not None:
        label_key = lambda k: label_field + "_" + k
    else:
        label_field = "ground_truth"
        label_key = lambda k: k

    if etau.is_str(tags):
        tags = [tags]
    elif tags is not None:
        tags = list(tags)

    def parse_sample(sample):
        sample_parser.with_sample(sample)

        video_path = sample_parser.get_video_path()

        if sample_parser.has_video_metadata:
            metadata = sample_parser.get_video_metadata()
        else:
            metadata = None

        label = sample_parser.get_label()
        frames = sample_parser.get_frame_labels()

        sample = Sample(filepath=video_path, metadata=metadata, tags=tags)

        if isinstance(label, dict):
            sample.update_fields({label_key(k): v for k, v in label.items()})
        elif label is not None:
            sample[label_field] = label

        if frames is not None:
            frame_labels = {}

            for frame_number, _label in frames.items():
                if isinstance(_label, dict):
                    frame_labels[frame_number] = {
                        label_key(field_name): label
                        for field_name, label in _label.items()
                    }
                elif _label is not None:
                    frame_labels[frame_number] = {label_field: _label}

            sample.frames.merge(frame_labels)

        return sample

    _samples = map(parse_sample, samples)
    return dataset.add_samples(
        _samples,
        expand_schema=expand_schema,
        dynamic=dynamic,
        generator=generator,
        progress=progress,
        num_samples=samples,
    )
Adds the given labeled videos to the dataset.

    This operation will iterate over all provided samples, but the videos will
    not be read/decoded/etc.

    See :ref:`this guide <custom-sample-parser>` for more details about
    adding labeled videos to a dataset by defining your own
    :class:`LabeledVideoSampleParser`.

    Args:
        dataset: a :class:`fiftyone.core.dataset.Dataset`
        samples: an iterable of samples that can be parsed by ``sample_parser``
        sample_parser: a :class:`LabeledVideoSampleParser` instance to use to
            parse the samples
        label_field (None): controls the field(s) in which imported labels are
            stored. If the parser produces a single
            :class:`fiftyone.core.labels.Label` instance per sample/frame, this
            argument specifies the name of the field to use; the default is
            ``"ground_truth"``. If the parser produces a dictionary of labels
            per sample/frame, this argument can be either a string prefix to
            prepend to each label key or a dict mapping label keys to field
            names; the default in this case is to directly use the keys of the
            imported label dictionaries as field names
        tags (None): an optional tag or iterable of tags to attach to each
            sample
        expand_schema (True): whether to dynamically add new sample fields
            encountered to the dataset schema. If False, an error is raised
            if a sample's schema is not a subset of the dataset schema
        dynamic (False): whether to declare dynamic attributes of embedded
            document fields that are encountered
        generator (False): whether to yield ID batches as a generator as
            samples are added to the dataset
        progress (None): whether to render a progress bar (True/False), use the
            default value ``fiftyone.config.show_progress_bars`` (None), or a
            progress callback function to invoke instead

    Returns:
        a list of IDs of the samples that were added to the dataset
    
fiftyone/utils/data/parsers.py