Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Enhancement: More control over thumbnail processing. #3259

Merged
merged 39 commits into from
Jun 15, 2022

Conversation

ghost
Copy link

@ghost ghost commented May 27, 2022

Brief description

Add specific control for processing of thumbnails.

Description

Improve control over processing of thumbnails using profiles to indicate hosts and tasks.
Fixes a bug (Should fix Issue #2843), handles files with arbitrary size processing in through setting max_int as an FFMPEG flag, as well as handling video files through FFMPEG specifically, and image files through OpenImageIO utility.

Additional info

Some refactoring is done to check for specific file format within the representation in order to specify which tool is used for the thumbnail creation (to reduce probability of errors).

@ghost ghost added the type: enhancement Enhancements to existing functionality label May 27, 2022
@ghost ghost self-assigned this May 27, 2022
@ynbot
Copy link
Contributor

ynbot commented May 27, 2022

@ghost ghost requested review from iLLiCiTiT, mkolar and antirotor May 27, 2022 06:46
@ghost ghost marked this pull request as draft May 27, 2022 06:47
@BigRoy BigRoy changed the title Enhancemet: More control over thumbnail processing. Enhancement: More control over thumbnail processing. May 27, 2022
@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented May 27, 2022

  • First of all, do not crash if oiio is not supported.
  • Secondly, separate the extraction logic using ffmpeg and oiio into their separated methods. They should return if were successfull and should not crash if were not (thumbnail is not reason to crash publishing?). Failed extraction should cause warning log.
  • Using extensions would be endless goal. Thus I recommend that you can check if oiio supports a file just by simply try to read information about it. If can't read their information then you can try convert it using ffmpeg.
from openpype.lib import oiio_is_supported, execute

thumbnail_created = False
# Try use ffmpeg when oiio is not supported (for cases when oiio tool is not available)
if not oiio_is_supported():
    thumbnail_created = self.create_thumbnail_with_ffmpeg(src_path, dst_path)
else:
    # Check if file can be read by oiio
    args = [
        oiiotool_path, "--info", "-i", src_path
    ]
    returncode = execute(args, silet=True)
    
    # If input can be read by oiio then use oiio method for creation otherwise use ffmpeg
    if returncode == 0:
        thumbnail_created = self.create_thumbnail_oiio(src_path, dst_path)
    else:
        thumbnail_created = self.create_thumbnail_with_ffmpeg(src_path, dst_path)

# Skip rest of process if thumbnail was not created
if not thumbnail_created:
    return

# Rest of plugin logic
...

@ghost
Copy link
Author

ghost commented May 27, 2022

Thank you @iLLiCiTiT I appreciate the thorough reply! Will get on that right away!

Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

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

Some comments... Couldn't test it currently because of unrelated bugs, but otherwise it looks ok.

openpype/plugins/publish/extract_jpeg_exr.py Outdated Show resolved Hide resolved
openpype/plugins/publish/extract_jpeg_exr.py Outdated Show resolved Hide resolved
openpype/plugins/publish/extract_jpeg_exr.py Outdated Show resolved Hide resolved
@jakubjezek001 jakubjezek001 requested a review from 64qam June 14, 2022 10:27
@jakubjezek001 jakubjezek001 requested review from antirotor and removed request for antirotor June 15, 2022 10:01
@jakubjezek001 jakubjezek001 dismissed antirotor’s stale review June 15, 2022 12:05

changes are applied

@jakubjezek001 jakubjezek001 merged commit 1f4709a into develop Jun 15, 2022
@jakubjezek001 jakubjezek001 deleted the OP-3172_More-control-over-thumbnail-processing branch June 15, 2022 12:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Enhancements to existing functionality
Projects
None yet
5 participants