All Products
Search
Document Center

CloudFlow:CloudFlow:Build an elastic and highly available audio and video processing system based on CloudFlow

Last Updated:Mar 11, 2026

Audio and video transcoding consumes significant compute resources in media pipelines. CloudFlow and Function Compute together provide an elastic, highly available processing system that scales automatically, removes infrastructure management overhead, and reduces deployment effort from weeks to days.

Use cases

Dedicated cloud-based transcoding services handle most scenarios. A custom serverless pipeline is a better fit when you need:

  • Elastic video processing -- An existing FFmpeg-based service runs on virtual machines or containers and needs millisecond-level auto scaling without infrastructure management.

  • Batch processing at scale -- Hundreds of 1080p videos (each over 4 GB) are regularly generated every Friday and must be processed within a few hours.

  • Custom processing logic -- Beyond transcoding, the pipeline needs to log transcoding details to a database, prefetch popular videos to Alibaba Cloud CDN (CDN) points of presence (PoPs), add watermarks, generate GIF thumbnails, or adjust transcoding parameters -- without disrupting existing services.

  • Direct access to source files -- Video files in File Storage NAS (NAS) or on Elastic Compute Service (ECS) disks are processed in place, without migrating them to Object Storage Service (OSS).

  • Custom audio processing -- Convert audio formats, set custom sample rates, or apply noise reduction.

  • Cost-effective lightweight processing -- Simple operations like generating a GIF from the first few frames of a video or querying the duration of a media file.

How it works

Conventional self-managed architecture

A traditional approach uses ECS instances, OSS, and CDN to store, process, and deliver media files. You provision servers, install FFmpeg, build a processing pipeline, and manage scaling, monitoring, and deployments yourself.

Conventional self-managed architecture

Serverless architecture with CloudFlow

CloudFlow orchestrates Function Compute functions into a video processing workflow that handles the full pipeline -- from upload trigger to final output.

Serverless architecture with CloudFlow

When a user uploads an .mp4 video to an OSS bucket, an OSS event trigger starts a CloudFlow execution. The workflow runs three stages:

  1. Segment -- Splits the video into smaller chunks at specified time intervals.

  2. Transcode -- Processes each segment in parallel into one or more target formats (for example, MP4 or FLV).

  3. Merge -- Reassembles the transcoded segments into complete output files.

This architecture provides three capabilities:

  • Parallel multi-format transcoding -- A single source video is transcoded to multiple formats simultaneously. Custom processing steps such as watermarking or database updates can run at any stage.

  • Automatic scaling -- When multiple files arrive at once, Function Compute scales out to process them in parallel.

  • Large video optimization -- Oversized videos are segmented, transcoded in parallel, and merged. Shorter segment intervals speed up transcoding for larger files.

Note

Video segmentation splits the video stream into multiple segments at specified time intervals and records segment information in an index file.

Serverless vs. self-managed comparison

Engineering efficiency

DimensionServerless solutionSelf-managed architecture
InfrastructureNone.Provision and manage servers, load balancers, and storage.
Development focusBusiness logic only. Serverless Devs handles orchestration and deployment.Business logic plus runtime environment setup: software installation, service configuration, and security updates.
Parallel and distributed processingCloudFlow orchestrates parallel processing across videos and distributed processing within a single large video. Stability and monitoring are built in.Requires custom development for parallelism and a separate monitoring system.
Learning curveProgramming language skills and FFmpeg knowledge.Additional expertise in Kubernetes, ECS, networking, and infrastructure management.
Time to production~3 person-days: 2 for development and debugging, 1 for stress testing.30+ person-days: hardware procurement, environment configuration, system development, testing, monitoring, alerting, and canary release.

Scaling and operations

DimensionServerless solutionSelf-managed architecture
Auto scalingFunction Compute scales in milliseconds to absorb traffic surges, with no O&M overhead.Requires Server Load Balancer (SLB). Scaling is slower than Function Compute.
Monitoring and alertingFine-grained metrics for flow executions (CloudFlow) and function executions (Function Compute). Latency and logs are queryable per invocation.Limited to infrastructure-level metrics (auto scaling groups or containers).

Prerequisites

Before you begin, make sure that you have:

Deploy the video processing workflow

CloudFlow orchestrates multiple functions into a video processing pipeline. Serverless Devs handles the deployment.

  1. Open the multimedia-process-flow template.

  2. In the Development & Experience section, click Deploy to go to the Function Compute application center.

  3. On the Create Application page, configure the following parameters, then click Create and Deploy Default Environment.

    Note

    If the Failed to obtain the role message appears, ask the Alibaba Cloud account owner to attach the AliRAMReadOnlyAccess and AliyunFCFullAccess policies to your RAM user. For more information, see Grant permissions to a RAM user by using an Alibaba Cloud account.

    Basic Configurations

    ParameterDefaultDescription
    Deployment Type--Select Directly Deploy.
    Role Name--If this is your first time creating an application with an Alibaba Cloud account, click Authorize Now to go to the Role Templates page, create the AliyunFCServerlessDevsRole service-linked role, and click Confirm Authorization Policy. Authorization If you are using a RAM user, copy the authorization link shown on the page and send it to the Alibaba Cloud account owner for authorization. After authorization completes, click Authorized. RAM user authorization

    Advanced Settings

    ParameterDefaultDescription
    Region--The region where the application is deployed.
    Workflow RAM Role ARN--The service role used to run the workflow. Create a service role in advance and attach the AliyunFCInvocationAccess policy.
    Role Service Function ComputeAliyunFCDefaultRoleThe service role that allows Function Compute to access other cloud services.
    Object Storage Bucket Name--Name of a bucket in the same region as the workflow and functions.
    PrefixsrcThe directory prefix for source videos.
    The directory in which the transcoded video is saveddstThe output directory for transcoded videos.
    OSS trigger RAM role ARNAliyunOSSEventNotificationRoleThe role used for OSS event notifications. If this is your first deployment, click Create Role to create and authorize this role.
  4. Wait 1--2 minutes for the deployment to complete. The system creates five functions and the multimedia-process-flow-3oih workflow: View the results in the Function Compute console and the CloudFlow console.

    FunctionPurpose
    oss-trigger-workflowTriggers workflow execution when a new video is uploaded to the specified OSS directory.
    splitSegments the video in the working directory based on the configured segment length.
    transcodeTranscodes each segment into the specified output format.
    mergeConcatenates transcoded segments into a complete output file.
    after-processCleans up the working directory.

Verify deployment

  1. Log on to the CloudFlow console. Select the target region in the top navigation bar.

  2. On the workflows page, click the multimedia-process-flow-3oih workflow.

  3. On the Execution Records tab, click Started Execution.

  4. In the Execute Workflow panel, set Execution Name and Input of Execution, then click OK. Example input:

    {
      "oss_bucket_name": "buckettestfnf",
      "video_key": "source/test.mov",
      "output_prefix": "outputs",
      "segment_time_seconds": 15,
      "dst_formats": [
        "mp4",
        "flv"
      ]
    }
  5. Check the execution result. On the Execution Details page, open the Basic Information tab. Execution Succeeded under Execution Status confirms a successful run.

  6. Verify the output files. In the OSS console, navigate to the target bucket and the /outputs directory. Confirm that the transcoded video files are present.

    Transcoded output files in OSS

FAQ

How do I add custom processing steps like database logging or CDN prefetching?

Add steps at any point in the workflow -- preprocessing before transcoding starts, or post-processing after it finishes. For details on the base deployment, see Deploy the video processing workflow.

How do I add features without disrupting existing services?

CloudFlow invokes each function independently, so updating one function does not affect the others. For safe rollouts, use function versions and aliases to run canary releases. See Manage versions.

Do I need the full workflow for simple tasks like generating a GIF or querying media duration?

No. A single Function Compute function running FFmpeg commands is enough for lightweight operations. See the fc-oss-ffmpeg sample project.

Can I process files stored in NAS or on ECS disks without migrating to OSS?

Yes. Mount a NAS file system to Function Compute and read files directly from the mount point. See Configure a NAS file system.