Skip to content

fix: crop padded rows from downloaded h264 streams - #1980

Closed
AminBlg wants to merge 2 commits into
pystardust:masterfrom
AminBlg:fix/crop-padded-rows
Closed

AminBlg wants to merge 2 commits into
pystardust:masterfrom
AminBlg:fix/crop-padded-rows

Conversation

@AminBlg

@AminBlg AminBlg commented Oct 29, 2026

Copy link
Copy Markdown

Pull Request Template

Type of change

  • Bug fix
  • Feature
  • Documentation update

Description

Fixes #1979.

Checklist

  • any anime playing
  • bumped version

  • next, prev, replay and select work
  • -c history and continue work
  • -d downloads work
  • -e (select episode) aka -r (range selection) works
  • -S select index works
  • -q quality works
  • -s syncplay works
  • -v vlc works
  • --dub and regular (sub) mode both work
  • --nextep-countdown countdown to next ep works

  • -h help info is up to date
  • Readme is up to date
  • Man page is up to date

Additional Testcases

(these do not block a merge)

  • --skip ani-skip works
  • --no-detach no detach works
  • --exit-after-play auto exit after playing works

Copy Pasta

./ani-cli -V
./ani-cli -S 1 -e 1 -d flcl
./ani-cli -S 1 -e 1 -q worst -v flcl
./ani-cli -c -s --dub

The provider stores 1080p as 1088 rows, 720p as 736 and 360p as 384,
without a crop in the SPS, so downloads show a green bar at the bottom.
download() now probes the chosen variant with ffprobe, retried up to 3
times, and adds h264_metadata=crop_bottom with the difference to the
ffmpeg copy. Streams that are not h264 or are already the label height
are copied as before.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@port19x

port19x commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Can you demonstrate this affecting any other anime than cyberpunk edgerunners? I'd prefer not to merge this workaround if this is just a oneoff

The crop now applies to any h264 or hevc variant that decodes 1 to 31
rows taller than its quality label, which is the most an encoder pads
to reach a 16 or 32 row multiple. hevc uses hevc_metadata. Variants 32
or more rows taller are real pictures and download unchanged: the 360p
label on many hianime uploads is a 480-row picture.

The probe now runs before the yt-dlp branch, and a padded variant goes
to the ffmpeg branch, which can crop. Labels without a "p" suffix, such
as "1080", are read too. ffprobe is retried only when it gives no
answer, so clean streams cost one probe.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@AminBlg

AminBlg commented Nov 4, 2026

Copy link
Copy Markdown
Author

Thinking about it more, this should be fixed on hianime's side, not in ani-cli. It's their new encoder that skipped the crop, and only on uploads from around Oct 20 plus one on Oct 25, so a workaround here would mostly sit unused. I'm closing this PR.

If you have a way to reach the hianime folks, it'd be worth asking them to re-encode these: Cyberpunk: Edgerunners 2 (all 10 eps), Nia Liston ep 3, Shiotaiou no Satou-san ep 3, Choujun! Choujou-senpai ep 3, Battle Spirits [Re] Zekkai No Ku ep 3 and Kanata kara ep 4. I used Claude Code to check about 115 shows and everything else looks fine.

@AminBlg AminBlg closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Green bar at the bottom of downloads (Cyberpunk: Edgerunners 2)

2 participants