Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global: extract thumbnail with new settings #5944

Conversation

jakubjezek001
Copy link
Member

@jakubjezek001 jakubjezek001 commented Nov 22, 2023

Changelog Description

Settings are now configurable for the following:

  • target size of thumbnail - source or constrained to specific
  • where should be frame taken from in sequence or video file
  • if thumbnail should be integrated or not
  • background color for letter boxes
  • added AYON settings

Additional info

image

Testing notes OpenPype:

  1. It can be tested in TrayPublisher in Render family.
  2. Try it on some sequence bigger then 1920x1080 (since we want to test that it was reformated to the format)
  3. publish and if the thubmail is published check the size of it.
  4. you can enable project_settings/global/publish/ExtractThumbnail/integrate_thumbnail so the thumbnail is integrated and then check it in file browser under the published version representations.
  5. change the size target project_settings/global/publish/ExtractThumbnail/target_size/type to source and check the size of published thubmail that is the same as the source resolution.

Testing notes AYON:

  1. make sure the latest core plugin version is deployed to your server (0.1.4)
  2. notice there are new settings as screenshot shows
    image
  3. I am assuming you will be testing it on FullHD resolution sequence so best to test this is to resize to 1080x1080 as it is shown on picture
  4. Follow Traypublisher Render product steps from above.
  5. Thumbnail can be then observed from Loader at product version.
    image

Explicit Thumbnai workflow > development stages

original PR
This PR is just a placeholder and will be broken into smaller chunks:

@ynbot
Copy link
Contributor

ynbot commented Nov 22, 2023

Task linked: OP-6659 Maya: thumbnail color space

@ynbot ynbot added size/S Denotes a PR changes 100-499 lines, ignoring general files type: enhancement Enhancements to existing functionality labels Nov 22, 2023
@BigRoy
Copy link
Collaborator

BigRoy commented Nov 22, 2023

Try it on some sequence bigger then 1920x1080 (since we want to test that it was reformated to the format)

Wouldn't it also be possible to test with a sequence of 10x10. The way the labels are written looks to me as "Always resize to that resolution no matter what." - disregarding whether it's bigger, smaller and/or matches the aspect ratio.

Also, what is the intended behavior for this for input sequences that do not have a square pixel aspect ratio? Is the intended result that the 1920x1080 output always has square pixel data or not? :)

@jakubjezek001
Copy link
Member Author

Wouldn't it also be possible to test with a sequence of 10x10. The way the labels are written looks to me as "Always resize to that resolution no matter what." - disregarding whether it's bigger, smaller and/or matches the aspect ratio.

It is not very usual situation but I get your point. Yes we are upscaling or downscaling and what ever resolution and aspect ration gets in the target scale rescales into squere pixel.

Also, what is the intended behavior for this for input sequences that do not have a square pixel aspect ratio? Is the intended result that the 1920x1080 output always has square pixel data or not? :)

Good point. At the moment the intention is to create [width]x[height]x1 only.

@jakubjezek001
Copy link
Member Author

Also, what is the intended behavior for this for input sequences that do not have a square pixel aspect ratio? Is the intended result that the 1920x1080 output always has square pixel data or not? :)

Well the intentions were different, but I have to confirm that this PR would not be complete without it. Also, our client was mentioning it in feedback so the rescaling is part of this PR @BigRoy.

  • It is undestorting input pixel astect back to square.
  • bacground color can be selected
  • centering original image smaller then target format and not scaling it
  • downscaling bigger formats to target format and fitting to width or height based on need

openpype/lib/transcoding.py Outdated Show resolved Hide resolved
- removing it from wrong ffmpeg process
Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hit the following error in extract_thumbnail.py when I tested with substance painter.
image

DEBUG: Processing instance with subset name textureMain.2D_View
DEBUG: repre {'name': 'png', 'ext': 'png', 'files': ['aiStandardSurface1_2D_View_1001_ACES - ACEScg.png', 'aiStandardSurface1_2D_View_1011_ACES - ACEScg.png'], 'udim': ['1001', '1011'], 'tags': ['review'], 'stagingDir': 'C:/Users/Kayla/AppData/Local/Temp/pyblish_tmp_b_qgv0hp'}
DEBUG: {'name': 'png', 'ext': 'png', 'files': ['aiStandardSurface1_2D_View_1001_ACES - ACEScg.png', 'aiStandardSurface1_2D_View_1011_ACES - ACEScg.png'], 'udim': ['1001', '1011'], 'tags': ['review'], 'stagingDir': 'C:/Users/Kayla/AppData/Local/Temp/pyblish_tmp_b_qgv0hp'}
DEBUG: Create temp directory C:\Users\Kayla\AppData\Local\Temp\pyblish_tmp_bjrryp82 for thumbnail
DEBUG: input C:\Users\Kayla\AppData\Local\Temp\pyblish_tmp_b_qgv0hp\aiStandardSurface1_2D_View_1011_ACES - ACEScg.png
DEBUG: Trying to convert with OIIO
DEBUG: Extracting thumbnail with OIIO: C:\Users\Kayla\AppData\Local\Temp\pyblish_tmp_bjrryp82\aiStandardSurface1_2D_View_1011_ACES - ACEScg_thumb.jpg
DEBUG: Getting information about input "C:\Users\Kayla\AppData\Local\Temp\pyblish_tmp_b_qgv0hp\aiStandardSurface1_2D_View_1011_ACES - ACEScg.png".
DEBUG: FFprobe command: D:\ayon_desktop\OpenPype\vendor\bin\ffmpeg\windows\bin\ffprobe.exe -hide_banner -loglevel fatal -show_error -show_format -show_streams -show_programs -show_chapters -show_private_data -print_format json "C:\Users\Kayla\AppData\Local\Temp\pyblish_tmp_b_qgv0hp\aiStandardSurface1_2D_View_1011_ACES - ACEScg.png"
DEBUG: FFprobe stdout:
{
    "programs": [

    ],
    "streams": [
        {
            "index": 0,
            "codec_name": "png",
            "codec_long_name": "PNG (Portable Network Graphics) image",
            "codec_type": "video",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 1024,
            "height": 1024,
            "coded_width": 1024,
            "coded_height": 1024,
            "closed_captions": 0,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "1:1",
            "pix_fmt": "rgb24",
            "level": -99,
            "color_range": "pc",
            "refs": 1,
            "r_frame_rate": "25/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/25",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ],
    "chapters": [

    ],
    "format": {
        "filename": "C:\\Users\\Kayla\\AppData\\Local\\Temp\\pyblish_tmp_b_qgv0hp\\aiStandardSurface1_2D_View_1011_ACES - ACEScg.png",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "png_pipe",
        "format_long_name": "piped png sequence",
        "size": "216297",
        "probe_score": 99
    }
}

Traceback (most recent call last):
  File "D:\ayon_desktop\OpenPype\.venv\lib\site-packages\pyblish\plugin.py", line 527, in __explicit_process
    runner(*args)
  File "D:\ayon_desktop\OpenPype\openpype\plugins\publish\extract_thumbnail.py", line 137, in process
    thumbnail_created = self._create_thumbnail_oiio(
  File "D:\ayon_desktop\OpenPype\openpype\plugins\publish\extract_thumbnail.py", line 219, in _create_thumbnail_oiio
    resolution_arg = self._get_resolution_arg("oiiotool", src_path)
  File "D:\ayon_desktop\OpenPype\openpype\plugins\publish\extract_thumbnail.py", line 339, in _get_resolution_arg
    return get_rescaled_command_arguments(
  File "D:\ayon_desktop\OpenPype\openpype\lib\transcoding.py", line 1265, in get_rescaled_command_arguments
    stream_input_par = stream[0].get("sample_aspect_ratio")
KeyError: 0

The code change fixes an issue in the transcoding.py file where the sample aspect ratio was not being parsed correctly. The fix involves modifying the way the sample aspect ratio is accessed from the stream object.
@jakubjezek001
Copy link
Member Author

File "D:\ayon_desktop\OpenPype\openpype\lib\transcoding.py", line 1265, in get_rescaled_command_arguments
stream_input_par = stream[0].get("sample_aspect_ratio")

fixed in 54205db

- Updated Ayon settings to fix issues with the ExtractThumbnail plugin.
- Fixed display and view at oiio defaults in the ExtractThumbnail plugin.
- Fixed target size in the ExtractThumbnail plugin.
- Fixed background color in the ExtractThumbnail plugin.

Also, updated server version to 0.1.4.
Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in OP
image

Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks also good in AYON
image

@jakubjezek001 jakubjezek001 merged commit 6a24cb6 into develop Dec 7, 2023
5 checks passed
@jakubjezek001 jakubjezek001 deleted the enhancement/OP-6659_extract-thumbnails-settings-size-frame branch December 7, 2023 11:06
@ynbot ynbot added this to the next-patch milestone Dec 7, 2023
@fabiaserra
Copy link
Contributor

I just encountered a bug when running latest OP version for a farm publish. Shouldn't we skip the local extract thumbnail if target is set to farm? Either that or then we need to do some changes on the integrate so it integrates the local extracted one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Denotes a PR changes 100-499 lines, ignoring general files type: enhancement Enhancements to existing functionality
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants