Index of every page on this site: llms.txt
All skills
Run it yourself

Compress local videos with FFmpeg, compare codec/CRF quality, audit embedded videos on a website, or scan and optimize videos across a website's source project.

Use this Skill: https://skilld.dev/gh/pixel-point/skills/compress-video

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescompression.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Compression

  1. Inspect the source

Check that FFmpeg, FFprobe, and the required encoders are available.

Inspect duration, dimensions, rotation, pixel format, and audio streams:

ffprobe -v error -show_format -show_streams -of json INPUT

Read avg_frame_rate, falling back to r_frame_rate if invalid. Retain rational frame rates throughout calculations.

  1. Configure the outputs

By default, create two compressed versions of the source video:

  • video-vp9.webm: VP9 video in a WebM container.
  • video-h265.mp4: H.265 video in an MP4 container.

Use these CRF values by default for compression unless the user requests different values:

  • VP9: 42.
  • H.265: 30.
  • AV1: 42 (when AV1 is requested).

Honor explicitly requested codecs and apply requested CRF overrides to the commands below.

Use this command structure, replacing placeholders:

ffmpeg -hide_banner -nostdin -n -i INPUT -map 0:v:0 \
  VIDEO_FLAGS FILTER_FLAGS AUDIO_FLAGS OUTPUT

Choose fresh output paths if files already exist.

VP9/WebM — video-vp9.webm

-c:v libvpx-vp9 -b:v 0 -crf 42 -deadline best -pix_fmt yuv420p

Audio removed:

-an

Audio kept:

-map 0:a:0 -c:a libopus

H.265/MP4 — video-h265.mp4

-c:v libx265 -crf 30 -preset veryslow -tag:v hvc1
-movflags faststart -pix_fmt yuv420p

Audio removed:

-an

Audio kept:

-map 0:a:0 -c:a aac

Apply exactly one audio branch per output. When keeping audio, use the encoder’s default audio bitrate.

  1. Decide whether to keep audio

Honor explicit preferences:

  • Remove: use -an.
  • Keep: retain the first audio stream, including silence. Report an error if no audio stream exists.

Otherwise, analyze every audio stream over its full duration. Apply this filter separately to each stream:

astats=metadata=1:reset=0,ametadata=mode=print:key=lavfi.astats.Overall.Peak_level:file=-:direct=1

Read the maximum reported peak across all streams:

  • No audio streams, or maximum peak <= -50 dBFS: use -an.
  • Any peak > -50 dBFS: keep the first audio stream.

Treat -inf as silence. Failed or incomplete analysis is an error, not evidence of silence.

  1. Handle dimensions

Preserve source resolution and display orientation by default.

Normalize odd dimensions:

  • If width is odd, use scale=WIDTH_MINUS_ONE:-2.
  • Otherwise, if height is odd, use scale=-2:HEIGHT_MINUS_ONE.
  • If both dimensions are even, no normalization filter is needed.

Apply requested cropping before resizing. Preserve aspect ratio when resizing and upscale only when explicitly requested. Combine video filters into one -vf chain.

  1. Handle frame rate

Preserve frame rate at or below 30 fps.

Above 30 fps, ask whether to preserve motion or cap the frame rate. Recommend capping for ordinary web playback. Reuse any preference already provided.

For a requested cap, let f be the source frame rate:

  • If 30 < f < 50, use fps=30.
  • If f >= 50, calculate d=max(2,floor(f/30+0.5)). Use fps=f/d when that is <=30; otherwise use fps=30.

Retain exact rational rates: 60000/1001 becomes 30000/1001. Append the frame-rate filter after crop and scale filters. When preserving cadence, omit the frame-rate filter.

  1. Handle optional AV1 and 10-bit output

Add AV1 only when explicitly requested.

AV1/WebM — video-av1.webm

-c:v libsvtav1 -b:v 0 -crf 42 -preset 6 -pix_fmt yuv420p

Use -an when removing audio, or -map 0:a:0 -c:a libopus when keeping it.

Default to 8-bit output, including for 10-bit sources. When explicitly asked for 10-bit, replace yuv420p with yuv420p10le for every output and verify the result with FFprobe. Never silently substitute 8-bit for a 10-bit request.

  1. Verify and deliver

Wait for every encode to finish. Verify output codecs, dimensions, frame rate, pixel format, audio presence, and successful decoding.

Report:

  • Output paths.
  • Original and output file sizes.
  • Percentage savings for each output.
  • The actual commands used.

Create an HTML snippet using relative paths. Include an explicit codecs parameter only for AV1.

Derive the AV1 codec string from the encoded file’s profile, level, tier, and bit depth. Append ,opus only when audio is present. For example, av01.0.05M.08,opus applies only when those values match the encoded file.

<video controls preload="metadata">
  <source src="./video-av1.webm" type='video/webm; codecs="AV1_CODECS"'>
  <source src="./video-vp9.webm" type="video/webm">
  <source src="./video-h265.mp4" type="video/mp4">
</video>

Include the AV1 source only when that output was created. Replace AV1_CODECS with the actual codec declaration and adapt filenames to the actual outputs.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning14d3 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    The skill provides automated video compression and website optimization using FFmpeg. It includes capabilities to audit websites, run project startup commands, and modify source code. Security risks are primarily associated with the execution of arbitrary shell commands found in project documentation and the ingestion of untrusted data from external websites or video metadata.

  • Socket14d

    No alerts

  • Snyk15d

    Risk: MEDIUM · 1 issue

Signed by skilld at aa10534. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 weeks ago

README badge

README badge for pixel-point/skills