this post was submitted on 01 Jan 2026
59 points (98.4% liked)

Programming

24153 readers
352 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
top 10 comments
sorted by: hot top controversial new old
[–] Glitchvid@lemmy.world 1 points 4 hours ago* (last edited 4 hours ago)

I typically just specify the height of the video and let the browser figure out the width and aspect ratio. The most annoying layout shift is the vertical kind anyway, so that solves it to my satisfaction.

That said, I also use the poster feature of the video tag and set preload to none, this produces vastly faster page loading, as images are a fast-path compared to browsers loading a video chunk and then decoding it just to display a cover image. I have a set of scripts that generate the poster images for me, I just specify the frame number I want to use in the video and ffmpeg produces an avif.

[–] quilan@lemmy.world 4 points 9 hours ago

I used to develop code for reading barcodes, and dealing with pixel aspect ratio was always annoying. It was one of those cases where 99.9% of images were square, but that tail always made for weird cases that had to be accounted for. Good times.

[–] MonkderVierte@lemmy.zip 11 points 12 hours ago

I opened one of the problematic videos in QuickTime Player

A blast from the past.

[–] onlinepersona@programming.dev 4 points 12 hours ago* (last edited 12 hours ago) (1 children)

I was expecting circular pixels which is what they are on CRTs. Was not expecting non-square rectangles. wtf?

[–] sukhmel@programming.dev 5 points 11 hours ago

I thought about pixels on rotating line, like this:

a compact disc-sized display that uses a single line of 40 LEDs, and rotates using a CD motor to fill a circular space with an image

[–] dan@upvote.au 10 points 15 hours ago (1 children)

Huh, interesting. TIL videos can have non-square pixels.

[–] khannie@lemmy.world 4 points 10 hours ago

I think the pixels themselves are still square, they just get scaled by the player to display, a bit like looking at a 1080p video on a 4k screen.

I remember this being a thing a long long time ago when TV rips were more common and would display janky on playback unless you forced the aspect ratio but I haven't come across it in forever.

[–] verstra@programming.dev 1 points 9 hours ago (1 children)

Does anyone know why anyone would want to encode their video using PAR != 1? Reducing the file size, by storing less pixels in one dimension, but not the other?

[–] verstra@programming.dev 3 points 9 hours ago

Wikipedia to the rescue:

However, some formats (ex., HDV, DVCPRO HD) use non-square pixels internally for image storage, as a way to reduce the amount of data that must be processed, thus limiting the necessary transfer rates and maintaining compatibility with existing interfaces.

Actual displays do not generally have non-square pixels, though digital sensors might;

TLDR; some formats use non-square pixels for reducing file size, some digital sensors has non-square pixels.

[–] bjornsno@programming.dev 3 points 12 hours ago

Cool! Surely there is a library for ffmpeg that can get the PAR without having to resort to subprocesses though.