Skip to content

GoPro 360 videos processing: more flexible Exiftool crop parameters #200

@PanierAvide

Description

@PanierAvide

Short Description

In the GoPro 360 video processing module, an Exiftool command is used for setting crop parameters on the resulting equirectangular image : https://github.com/mapilio/mapilio-kit/blob/main/mapilio_kit/components/geotagging/gps_from_gopro360.py#L220

This command indicates that the resulting image is 4096 x 1344px, I have a series of GoPro Max 360 videos that are working through the whole process, but ends up being 4096 x 2048px (which is what we can expect from equirectangular images, 2x longer than their height).

Feature Use case

To make this tool more adaptable, we could use a nice exiftool feature that allows to compute these parameters on the go, depending of real image size. It expects image to always be 360°, but sets top/bottom crop depending on how much pixels are missing from a classic equirectangular image (width/2).

Here's the alternative version of this command:

    cmd = f"exiftool -CameraElevationAngle=360 " \
          f"-make=GoPro " \
          f"-model=Max " \
          f"-ProjectionType=equirectangular " \
          f"-UsePanoramaViewer=True " \
          f"'-CroppedAreaImageWidthPixels<$ImageWidth' " \
          f"'-CroppedAreaImageHeightPixels<$ImageHeight' " \
          f"'-FullPanoWidthPixels<$ImageWidth' " \
          f"'-FullPanoHeightPixels<$ImageHeight' " \
          f"-CroppedAreaLeftPixels=0 " \
          f"'-CroppedAreaTopPixels<${{Imagewidth;$_=($_/2-$self->GetValue(""ImageHeight""))/2}}' " \
          f"{frames_folder}"

Additional

I'm making an issue instead of a PR, as I have only one example of these 360 videos at my disposal. I don't know until which point these can be of various different formats. The offered command though should adapt to any original ratio that may come. I can offer a real PR if the change is OK for you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions