> ## Documentation Index
> Fetch the complete documentation index at: https://docs.videodb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Compile Search Results

> Compile video search results into a single playable stream

Compile search results or a list of videos/scenes into a single playable stream. Useful for creating compilations from search queries or combining specific video segments.

<CodeGroup>
  ```python Python theme={null}
  import videodb

  conn = videodb.connect(api_key="your_api_key")
  coll = conn.get_collection()

  # Search for videos
  search_results = coll.search(query="action scenes")

  # Compile search results into a stream
  stream_url = search_results.compile()

  print(f"Compiled stream: {stream_url}")
  ```

  ```javascript Node.js theme={null}
  import { connect } from 'videodb';

  const conn = await connect({ apiKey: 'your_api_key' });
  const coll = await conn.getCollection();

  // Search for videos
  const searchResults = await coll.search({ query: 'action scenes' });

  // Compile search results into a stream
  const streamUrl = await searchResults.compile();

  console.log(`Compiled stream: ${streamUrl}`);
  ```
</CodeGroup>

<Note>
  * Compile is useful for creating highlight reels or compilations from search results
  * Each timeline entry needs video ID and time range (start, end in seconds)
  * Returns a playable stream URL
  * Compile automatically stitches segments together in order
</Note>

<CardGroup cols={2}>
  <Card title="Create Timeline v2" icon="plus" href="/api-reference/timeline/create_timeline_v2">
    Advanced composition with multiple tracks
  </Card>

  <Card title="Search Collections" icon="search" href="/api-reference/collections/search_collections">
    Find videos to compile
  </Card>
</CardGroup>


## OpenAPI

````yaml POST /compile/
openapi: 3.0.3
info:
  title: VideoDB Server API
  description: >
    VideoDB Server API for video, audio, and image processing with AI
    capabilities.

    This API provides comprehensive video management, search, indexing, and
    AI-powered features.
  version: 1.0.0
  contact:
    name: VideoDB Support
    url: https://videodb.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.videodb.io
    description: Production server
  - url: https://staging-api.videodb.io
    description: Staging server
security:
  - ApiKeyAuth: []
tags:
  - name: Authentication
    description: User authentication and API key management
  - name: Collections
    description: Collection management operations
  - name: Videos
    description: Video upload, processing, and management
  - name: Audio
    description: Audio management operations
  - name: Images
    description: Image management operations
  - name: Search
    description: Content search and indexing
  - name: AI Generation
    description: AI-powered content generation
  - name: Billing
    description: Billing and usage management
  - name: RTStream
    description: Real-time streaming operations
  - name: Utilities
    description: Utility endpoints
  - name: Meeting
    description: Meeting recording and management
  - name: Capture
    description: Capture session management for recording streams
  - name: Editor
    description: Timeline editor operations
  - name: Transcode
    description: Media transcoding operations
  - name: Assets
    description: Cross-collection asset listing
paths:
  /compile/:
    post:
      summary: Compile media content
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - inputs
              properties:
                inputs:
                  type: array
                  items:
                    type: object
                    properties:
                      media_id:
                        type: string
                        example: m-12345
                      start_time:
                        type: number
                        example: 10
                      end_time:
                        type: number
                        example: 30
                output_format:
                  type: string
                  enum:
                    - mp4
                    - webm
                    - hls
                  example: mp4
                callback_url:
                  type: string
                  example: https://webhook.example.com/callback
      responses:
        '200':
          description: Compilation started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AsyncResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        status:
          type: string
          enum:
            - processing
            - done
            - failed
          example: processing
        data:
          type: object
          properties:
            id:
              type: string
              example: job-123
            output_url:
              type: string
              example: https://api.videodb.io/async-response/job-123
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-access-token
      description: API key for authentication (sk-xxx format)

````