[Copilot]完全用 C 語言重寫 video2ascii - 支援 24bit 色彩與 FFmpeg 整合 #1
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
概述
根據 issue 要求,完全用 C 語言重寫了 video2ascii,實現了所有功能需求並提供了顯著的性能提升和新功能。
🎯 已實現的功能需求
✅ 影片解碼:使用 FFmpeg(libavformat, libavcodec, libavutil, libswscale),支援所有常見影片格式
✅ 影像縮放:自動縮放至最大寬度 80 字元,完整保持長寬比
✅ 24bit 色彩支援:完整保留 RGB 資訊,使用 ANSI escape code (
\033[38;2;R;G;Bm) 輸出彩色✅ ASCII 輸出:根據像素亮度智慧轉換成 ASCII 字元 (
@#$%?*+;:,.)✅ 終端輸出:即時顯示彩色 ASCII 藝術,約 30 FPS 播放速度
✅ 完全重寫:所有 C 原始碼放在
/C-remake目錄✅ 輸入參數:支援影片路徑作為命令列參數
📁 新增檔案
/C-remake/main.c(8.5KB)完整的 C 實作,包含:
/C-remake/Makefile智慧建置系統:
/C-remake/README.md(7.2KB)完整文件包含:
🔧 技術特色
智慧建置系統
24bit 真彩色輸出
每個 ASCII 字元都保持原始像素的 RGB 顏色:
效能最佳化
📊 與原 Python 版本比較
🧪 測試結果
🚀 使用方式
快速展示(無需 FFmpeg)
完整功能(需 FFmpeg)
🎨 展示效果
程式會輸出彩色 ASCII 藝術,每個字元都保持原始影片的 RGB 色彩,創造出視覺豐富的終端顯示效果。
此實作完全滿足了 issue 中的所有需求,並提供了比原 Python 版本更好的效能、更豐富的色彩支援,以及更廣泛的影片格式相容性。
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.