• dan@upvote.au
    link
    fedilink
    arrow-up
    13
    arrow-down
    1
    ·
    2 days ago

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

    • khannie@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 days 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.

  • quilan@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    2 days 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.

  • Glitchvid@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    2 days 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.

  • bjornsno@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    2 days ago

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

  • verstra@programming.dev
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    2 days ago

    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
      link
      fedilink
      arrow-up
      3
      ·
      2 days 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.