code: def test_merge_samples_video(basedir):
      videos_dir = os.path.join(basedir, "merge_samples_video")
      label = "vehicle"
  
      dataset = foz.load_zoo_dataset("quickstart-video").clone()
  
      dataset1 = dataset.clone()
      dataset2 = dataset.clone()
      dataset3 = dataset.clone()
  
      # Give `dataset2` new field names
      dataset2.rename_frame_field("detections", "det")
  
      # Give `dataset3` new video locations
      inpaths = dataset3.values("filepath")
      outpaths = [
          os.path.join(videos_dir, os.path.basename(f)) for f in inpaths
      ]
      for inpath, outpath in zip(inpaths, outpaths):
          etau.copy_file(inpath, outpath)
  
      dataset3.set_values("filepath", outpaths)
  
      # Only merge `vehicle` labels
      view2 = dataset2.filter_labels("frames.det", F("label") == label)
      view3 = dataset3.filter_labels(
          "frames.detections", F("label") == label
      )
  
      # Perform the merges
      dataset.merge_samples(view2)
      dataset.merge_samples(view3)
  
      # Check that schema is correct
      schema = dataset.get_frame_field_schema()
  
      assert "detections" in schema
      assert "det" in schema
  
      #
      # `dataset` should contain:
      #   `view2` counts in its `det` field
      #   `dataset1` + `view3` counts in its `detections` field
      #
  
      dataset_counts = dataset.count_values(
          "frames.detections.detections.label"
      )
      dataset1_counts = dataset1.count_values(
          "frames.detections.detections.label"
      )
      view3_counts = view3.count_values(
          "frames.detections.detections.label"
      )
  
      assert dataset_counts[label] == (
          dataset1_counts[label] + view3_counts[label]
      )
  
      dataset_counts = dataset.count_values(
          "frames.det.detections.label"
      )
      view2_counts = view2.count_values("frames.det.detections.label")
  
      assert dataset_counts[label] == view2_counts[label]
  
file_path: fiftyone/tests/intensive/merge_tests.py
imports: import os
  import pytest
  import eta.core.utils
  import fiftyone
  import fiftyone.zoo
  from fiftyone import ViewField
label_desc: Use image node_id 4 for calling a global function with example usage: test_merge_samples_video(basedir) without return types