How modelscope/funclip works
Project type and purpose
• FunClip is a Python‑based, locally deployed video clipping tool with both a GUI (Gradio web service) and a command‑line interface (CLI).
• It orchestrates speech recognition (ASR), optional large‑language‑model (LLM) inference, subtitle generation, and video processing to let users clip segments from input videos.
File structure
• Top level:
• launch.py (Gradio server entrypoint)
• videoclipper.py (CLI entrypoint with “stage” flags)
• requirements.txt, configs, fonts, docs, tests
• funclip/llm: adapters for various LLM APIs (OpenAI, Qwen, g4f) and demo prompts
• funclip/utils: helper modules (arg parsing, subtitle handling, translation, theme config)
• funclip/introduction.py: UI content injector
• funclip/launch.py: UI wiring (Gradio components → backend functions)
• funclip/videoclipper.py: two‑stage pipeline (stage 1 = ASR → generate SRT; stage 2 = clipping via ffmpeg/moviepy, ImageMagick)
Additional README insights
• Core flow:
1. User uploads video
2. FunASR Paraformer models perform ASR with timestamps (and optional speaker diarization)
3. Gradio UI displays transcript; user picks text spans or triggers LLM to generate timestamps
4. Video is clipped via ffmpeg / MoviePy; subtitle SRTs are generated
• CLI does the same in “recognize” and “clip” stages
• Optional dependencies: ffmpeg, ImageMagick, custom font
Key reminders
• Both interactive (Gradio) and batch (CLI) flows
• Fallback paths (user‑selected transcript vs. LLM‑generated timestamps)
• Detail intermediate artifacts (raw audio, JSON result, SRT, final MP4)
• Don’t over‑complicate—show each logical component once with its major interfaces