You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求支持Windows/Linux的视频(MP4/AVI/MPEG2)颜色数量统计软件

Hey there! Let's break down some solid tools that can help you count distinct colors in MP4, AVI, and MPEG-2 videos for palette comparison, covering both Windows and Linux systems:

Cross-Platform Tools (Windows + Linux)

These work seamlessly on both systems, giving you flexibility no matter your setup.

FFmpeg + Python Script

FFmpeg is the Swiss Army knife of video processing, and pairing it with a quick Python script gives you full control over color counting:

  1. First, extract frames from your video (adjust the frame rate based on how accurate you need the count to be):
    ffmpeg -i input.mp4 -vf fps=1 frames/%04d.png
    
    This pulls 1 frame per second into a frames folder. Use -vf select='eq(n,0)' instead if you only want the first frame for a quick sample.
  2. Next, use this Python script (requires the Pillow library) to tally up all unique colors across the frames:
    from PIL import Image
    import os
    
    unique_colors = set()
    frame_folder = "frames"
    
    for file in os.listdir(frame_folder):
        if file.endswith(".png"):
            img = Image.open(os.path.join(frame_folder, file))
            unique_colors.update(img.getdata())
    
    print(f"Total distinct colors found: {len(unique_colors)}")
    
    Install Pillow with pip install pillow if you don't have it already.

DaVinci Resolve

If you're looking for a professional, GUI-based option, DaVinci Resolve is free and cross-platform. While it doesn't spit out a raw color count, it lets you visualize video palettes, compare color distributions across clips, and export palette swatches—perfect for side-by-side palette comparison work.

Windows-Specific Tools

IrfanView + Plugins Pack

IrfanView is a lightweight, free image/video viewer that's great for quick palette analysis:

  1. Install IrfanView and the full Plugins Pack (make sure to enable video and color-related plugins during setup).
  2. Open your video file—IrfanView will load the first frame automatically.
  3. Head to Image > Palette > Generate Palette to create a palette from the frame. For multiple frames, use File > Batch Conversion/Rename to extract frames as images first, then run the palette generator on the batch.
Linux-Specific Tools

ImageMagick + MPlayer

For a command-line Linux workflow, this combo gets the job done efficiently:

  1. Extract frames from your video with MPlayer (adjust -frames to control how many frames you analyze):
    mplayer input.mpeg2 -vo png:outdir=frames -frames 100
    
  2. Use ImageMagick to count all unique colors across the extracted frames:
    convert frames/*.png -unique-colors txt:- | wc -l
    
    Subtract 1 from the final number to exclude the header line in the output, and you'll have your distinct color count.

All these options cover different workflows—whether you want quick GUI results or flexible command-line control. Let me know if you need help tweaking any of these methods!

内容的提问来源于stack exchange,提问作者celsowm

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:30:58