[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XBMSWJME1887G2K2A48YY2":3,"skill-same:01M6XBMSWJME1887G2K2A48YY2":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":28,"linkOnly":29,"markdownContent":30,"markdownBody":31,"frontMatter":32,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":13,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":38,"install":39,"resources":52},"01M6XBMSWJME1887G2K2A48YY2","ffmpeg-graceful-degradation",null,"Graceful degradation workflow for ffmpeg encoding failures with progressive fallback strategies","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fffmpeg-graceful-degradation\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27],"ffmpeg","degradation","ffmpeg graceful degradation","graceful degradation","workflow","encoding","fallback","strategies","with","for","2026-11-10 10:12:30",false,"---\nname: ffmpeg-graceful-degradation\ndescription: Graceful degradation workflow for ffmpeg encoding failures with progressive fallback strategies\n---\n\n# FFmpeg Graceful Degradation\n\nWhen processing videos with ffmpeg, encoding failures are common due to codec availability, library version mismatches, or system configuration issues. This skill provides a systematic fallback strategy to ensure video processing completes successfully.\n\n## Overview\n\nThe pattern involves: (1) probing encoder availability upfront, (2) testing on a short clip before batch processing, (3) progressive fallback through copy mode, alternative codecs, and finally moviepy, (4) using moviepy as a reliable bundled alternative.\n\n## Step 1: Probe Encoder Availability\n\nBefore any encoding work, check what encoders are available:\n\n```bash\nffmpeg -encoders | grep -E \"libx264|libopenh264|mpeg4\"\n```\n\nExpected output shows which encoders are present:\n- `libx264` - Preferred H.264 encoder (may be missing)\n- `libopenh264` - Alternative H.264 (often has library issues)\n- `mpeg4` - Universal fallback (always available)\n\n## Step 2: Test Encoding on Single Short Clip\n\nNever start batch processing without validation. Extract and test a short segment:\n\n```bash\n# Extract 5-second test clip\nffmpeg -y -i input.mp4 -ss 0 -t 5 -c copy test_clip.mp4\n\n# Attempt encode with preferred codec\nffmpeg -y -i test_clip.mp4 -c:v libx264 -preset fast test_output.mp4\n```\n\nCheck the exit code and output for errors. Common failures:\n- `libopenh264.so: wrong ELF class`\n- `Encoder libx264 not found`\n- Library version mismatches\n\n## Step 3: Progressive Fallback Strategy\n\nIf the preferred encoder fails, try these fallbacks in order:\n\n### Fallback A: Copy Mode (No Re-encoding)\n```bash\nffmpeg -y -i input.mp4 -c:v copy -c:a copy output.mp4\n```\nFast, lossless, but doesn't change codec\u002Fformat.\n\n### Fallback B: MPEG4 Codec\n```bash\nffmpeg -y -i input.mp4 -c:v mpeg4 -q:v 3 -c:a copy output.mp4\n```\nUniversal compatibility, larger file sizes, always available.\n\n### Fallback C: Install MoviePy (Bundles Working FFmpeg)\n```bash\npip install moviepy\n```\n\nThen use Python instead of raw ffmpeg:\n```python\nfrom moviepy.editor import VideoFileClip, concatenate_videoclips\n\n# Single clip processing\nclip = VideoFileClip(\"input.mp4\")\nclip.write_videofile(\"output.mp4\", codec=\"libx264\")\n\n# Concatenate multiple clips\nclips = [VideoFileClip(f) for f in clip_files]\nfinal = concatenate_videoclips(clips)\nfinal.write_videofile(\"output.mp4\", codec=\"libx264\")\n```\n\nMoviePy bundles its own ffmpeg binary, avoiding system library issues.\n\n## Step 4: Implementation Pattern\n\nHere's a complete graceful degradation workflow:\n\n```python\nimport subprocess\nimport os\n\ndef safe_video_encode(input_path, output_path, clips=None):\n    \"\"\"\n    Encode video with graceful degradation fallbacks.\n    \n    Args:\n        input_path: Single input file path, or\n        clips: List of clip paths for concatenation\n    \n    Returns:\n        True if successful, False otherwise\n    \"\"\"\n    \n    # Step 1: Check encoder availability\n    result = subprocess.run(\n        [\"ffmpeg\", \"-encoders\"],\n        capture_output=True, text=True\n    )\n    has_libx264 = \"libx264\" in result.stdout\n    has_mpeg4 = \"mpeg4\" in result.stdout\n    \n    # Step 2: If concatenating, prepare clips with moviepy\n    if clips:\n        try:\n            from moviepy.editor import VideoFileClip, concatenate_videoclips\n            loaded_clips = [VideoFileClip(c) for c in clips]\n            final = concatenate_videoclips(loaded_clips)\n            final.write_videofile(output_path, codec=\"libx264\", logger=None)\n            return True\n        except Exception as e:\n            print(f\"MoviePy failed: {e}\")\n    \n    # Step 3: Try ffmpeg with progressive fallbacks\n    encoders_to_try = []\n    if has_libx264:\n        encoders_to_try.append(\"libx264\")\n    encoders_to_try.append(\"mpeg4\")  # Always available\n    \n    for codec in encoders_to_try:\n        cmd = [\n            \"ffmpeg\", \"-y\",\n            \"-i\", input_path,\n            \"-c:v\", codec,\n            \"-c:a\", \"copy\",\n            output_path\n        ]\n        result = subprocess.run(cmd, capture_output=True, text=True)\n        if result.returncode == 0:\n            return True\n    \n    # Step 4: Last resort - copy mode\n    cmd = [\"ffmpeg\", \"-y\", \"-i\", input_path, \"-c\", \"copy\", output_path]\n    result = subprocess.run(cmd, capture_output=True, text=True)\n    return result.returncode == 0\n```\n\n## Decision Flow\n\n```\nStart\n  │\n  ▼\nCheck encoders (ffmpeg -encoders)\n  │\n  ├─ libx264 available? ──Yes──► Try libx264\n  │         │                       │\n  │         No                      └─► Success? ──Yes──► Done\n  │         │                                      │\n  │         ▼                                      No\n  │    Test short clip                             │\n  │         │                                      ▼\n  │         ▼                               Try -c:v copy\n  │    Encode fails? ──Yes──► Check libopenh264    │\n  │         │                       │              │\n  │         No                      Broken         ▼\n  │         │                       │         Try mpeg4\n  │         ▼                       ▼              │\n  │      Done                  Install moviepy     │\n  │                              │                 │\n  │                              ▼                 │\n  │                         Use VideoFileClip ◄────┘\n  │                         concatenate_videoclips\n  │                              │\n  │                              ▼\n  │                            Done\n  │\n  ▼\nEnd\n```\n\n## Key Principles\n\n1. **Test first, batch later** - Always validate on a short clip\n2. **Fail fast, fallback gracefully** - Don't waste time on doomed encodings\n3. **MoviePy as safety net** - Its bundled ffmpeg avoids system issues\n4. **Copy mode preserves content** - Even if quality isn't ideal\n\n## Common Error Patterns\n\n| Error Message | Cause | Solution |\n|--------------|-------|----------|\n| `libopenh264.so: wrong ELF class` | Library architecture mismatch | Use moviepy or mpeg4 |\n| `Encoder libx264 not found` | FFmpeg built without x264 | Use mpeg4 fallback |\n| `Broken pipe` | Process killed mid-operation | Try copy mode first |\n| `Invalid data found` | Corrupt or incompatible input | Re-extract source |\n\n## When to Use This Skill\n\n- Processing user-uploaded videos (unknown codecs\u002Fformats)\n- Running in containers with limited codec support\n- Batch processing where failure would be costly\n- Cross-platform deployments with varying ffmpeg builds","# FFmpeg Graceful Degradation\n\nWhen processing videos with ffmpeg, encoding failures are common due to codec availability, library version mismatches, or system configuration issues. This skill provides a systematic fallback strategy to ensure video processing completes successfully.\n\n## Overview\n\nThe pattern involves: (1) probing encoder availability upfront, (2) testing on a short clip before batch processing, (3) progressive fallback through copy mode, alternative codecs, and finally moviepy, (4) using moviepy as a reliable bundled alternative.\n\n## Step 1: Probe Encoder Availability\n\nBefore any encoding work, check what encoders are available:\n\n```bash\nffmpeg -encoders | grep -E \"libx264|libopenh264|mpeg4\"\n```\n\nExpected output shows which encoders are present:\n- `libx264` - Preferred H.264 encoder (may be missing)\n- `libopenh264` - Alternative H.264 (often has library issues)\n- `mpeg4` - Universal fallback (always available)\n\n## Step 2: Test Encoding on Single Short Clip\n\nNever start batch processing without validation. Extract and test a short segment:\n\n```bash\n# Extract 5-second test clip\nffmpeg -y -i input.mp4 -ss 0 -t 5 -c copy test_clip.mp4\n\n# Attempt encode with preferred codec\nffmpeg -y -i test_clip.mp4 -c:v libx264 -preset fast test_output.mp4\n```\n\nCheck the exit code and output for errors. Common failures:\n- `libopenh264.so: wrong ELF class`\n- `Encoder libx264 not found`\n- Library version mismatches\n\n## Step 3: Progressive Fallback Strategy\n\nIf the preferred encoder fails, try these fallbacks in order:\n\n### Fallback A: Copy Mode (No Re-encoding)\n```bash\nffmpeg -y -i input.mp4 -c:v copy -c:a copy output.mp4\n```\nFast, lossless, but doesn't change codec\u002Fformat.\n\n### Fallback B: MPEG4 Codec\n```bash\nffmpeg -y -i input.mp4 -c:v mpeg4 -q:v 3 -c:a copy output.mp4\n```\nUniversal compatibility, larger file sizes, always available.\n\n### Fallback C: Install MoviePy (Bundles Working FFmpeg)\n```bash\npip install moviepy\n```\n\nThen use Python instead of raw ffmpeg:\n```python\nfrom moviepy.editor import VideoFileClip, concatenate_videoclips\n\n# Single clip processing\nclip = VideoFileClip(\"input.mp4\")\nclip.write_videofile(\"output.mp4\", codec=\"libx264\")\n\n# Concatenate multiple clips\nclips = [VideoFileClip(f) for f in clip_files]\nfinal = concatenate_videoclips(clips)\nfinal.write_videofile(\"output.mp4\", codec=\"libx264\")\n```\n\nMoviePy bundles its own ffmpeg binary, avoiding system library issues.\n\n## Step 4: Implementation Pattern\n\nHere's a complete graceful degradation workflow:\n\n```python\nimport subprocess\nimport os\n\ndef safe_video_encode(input_path, output_path, clips=None):\n    \"\"\"\n    Encode video with graceful degradation fallbacks.\n    \n    Args:\n        input_path: Single input file path, or\n        clips: List of clip paths for concatenation\n    \n    Returns:\n        True if successful, False otherwise\n    \"\"\"\n    \n    # Step 1: Check encoder availability\n    result = subprocess.run(\n        [\"ffmpeg\", \"-encoders\"],\n        capture_output=True, text=True\n    )\n    has_libx264 = \"libx264\" in result.stdout\n    has_mpeg4 = \"mpeg4\" in result.stdout\n    \n    # Step 2: If concatenating, prepare clips with moviepy\n    if clips:\n        try:\n            from moviepy.editor import VideoFileClip, concatenate_videoclips\n            loaded_clips = [VideoFileClip(c) for c in clips]\n            final = concatenate_videoclips(loaded_clips)\n            final.write_videofile(output_path, codec=\"libx264\", logger=None)\n            return True\n        except Exception as e:\n            print(f\"MoviePy failed: {e}\")\n    \n    # Step 3: Try ffmpeg with progressive fallbacks\n    encoders_to_try = []\n    if has_libx264:\n        encoders_to_try.append(\"libx264\")\n    encoders_to_try.append(\"mpeg4\")  # Always available\n    \n    for codec in encoders_to_try:\n        cmd = [\n            \"ffmpeg\", \"-y\",\n            \"-i\", input_path,\n            \"-c:v\", codec,\n            \"-c:a\", \"copy\",\n            output_path\n        ]\n        result = subprocess.run(cmd, capture_output=True, text=True)\n        if result.returncode == 0:\n            return True\n    \n    # Step 4: Last resort - copy mode\n    cmd = [\"ffmpeg\", \"-y\", \"-i\", input_path, \"-c\", \"copy\", output_path]\n    result = subprocess.run(cmd, capture_output=True, text=True)\n    return result.returncode == 0\n```\n\n## Decision Flow\n\n```\nStart\n  │\n  ▼\nCheck encoders (ffmpeg -encoders)\n  │\n  ├─ libx264 available? ──Yes──► Try libx264\n  │         │                       │\n  │         No                      └─► Success? ──Yes──► Done\n  │         │                                      │\n  │         ▼                                      No\n  │    Test short clip                             │\n  │         │                                      ▼\n  │         ▼                               Try -c:v copy\n  │    Encode fails? ──Yes──► Check libopenh264    │\n  │         │                       │              │\n  │         No                      Broken         ▼\n  │         │                       │         Try mpeg4\n  │         ▼                       ▼              │\n  │      Done                  Install moviepy     │\n  │                              │                 │\n  │                              ▼                 │\n  │                         Use VideoFileClip ◄────┘\n  │                         concatenate_videoclips\n  │                              │\n  │                              ▼\n  │                            Done\n  │\n  ▼\nEnd\n```\n\n## Key Principles\n\n1. **Test first, batch later** - Always validate on a short clip\n2. **Fail fast, fallback gracefully** - Don't waste time on doomed encodings\n3. **MoviePy as safety net** - Its bundled ffmpeg avoids system issues\n4. **Copy mode preserves content** - Even if quality isn't ideal\n\n## Common Error Patterns\n\n| Error Message | Cause | Solution |\n|--------------|-------|----------|\n| `libopenh264.so: wrong ELF class` | Library architecture mismatch | Use moviepy or mpeg4 |\n| `Encoder libx264 not found` | FFmpeg built without x264 | Use mpeg4 fallback |\n| `Broken pipe` | Process killed mid-operation | Try copy mode first |\n| `Invalid data found` | Corrupt or incompatible input | Re-extract source |\n\n## When to Use This Skill\n\n- Processing user-uploaded videos (unknown codecs\u002Fformats)\n- Running in containers with limited codec support\n- Batch processing where failure would be costly\n- Cross-platform deployments with varying ffmpeg builds",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","gdpval_bench\u002Fskills\u002Fffmpeg-graceful-degradation","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill ffmpeg-graceful-degradation",{"tool":45,"command":46},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill ffmpeg-graceful-degradation",{"tool":48,"command":49},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill ffmpeg-graceful-degradation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fffmpeg-graceful-degradation\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},".skill_id","OTHER","其他",41,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fffmpeg-graceful-degradation\u002F.skill_id",[60,84,100,109,139,155],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":28},"01M6XCCXD3NCM2YKR3WNGBASPC","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[67,68,69,70,71,72,73,74,27,75,76,77,78,79,80,81,82,83],"check","write","write special chars ts check","typescript","filters","characters","Existing","type-checking","errors","script","output","type","files","only","template","file","python",{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":28},"01M6XCCT7E3J922Q345PBGSHPN","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[91,92,68,82,93,83,94,95,96,97,98,81,99,26,72,27,76],"readback","write special chars readback","helper","post","via","scripts","cleanup","read","verification",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":28},"01M6XCCMQX1R8B6FECWB3P63T7","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[107,68,72,108,76,95,81,82,83,27],"write special chars heredoc","shell",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":120,"publishedAt":28},"01M6XCCG41M994JJEX6VN52PEP","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[115],{"categoryNo":116,"categoryName":117,"taxonomyType":118,"taxonomyTypeDesc":119},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[121,122,123,124,125,70,126,127,128,129,130,27,131,132,133,134,135,136,137,138],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","source","extracting","panel","patterns","edge functions","integrations","open","api","data",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":145,"publishedAt":28},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[146,147,148,149,27,150,26,151,152,153,154],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":161,"publishedAt":28},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[162,163,164,165,166,167,82,168,169,170],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]