Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-2024-05-13· OpenAIAi2 WildChat-4.8M (AI2)

Hi,can you give me the correct encode settings to inspect a openexr image with 16 bit…

  1. User

    Hi,can you give me the correct encode settings to inspect a openexr image with 16 bit float dwaa codec here is the arg tha needs correcting:ffmpeg -hide_banner -apply_trc iec61966_2_1 -i "0000.exr" -pix_fmt gbrpf32le -c:v exr -compression_level 6 -compression_level dwaa "cc.exr"

  2. Assistant

    Certainly! OpenEXR is a format that supports various codecs, including DWAA and DWAB, which are lossy wavelet-based codecs. From your command, it looks like you are trying to apply DWAA compression specifically.

    Here's the corrected ffmpeg command to encode an OpenEXR image with 16-bit float pixels using the DWAA codec:

    ffmpeg -hide_banner -apply_trc iec61966_2_1 -i "0000.exr" -pix_fmt gbrp16le -c:v exr -compression dwaa -tiles 64x64 "cc.exr"
    

    Here's a breakdown of the command:

    • -hide_banner: Suppresses the display of the banner in the console output.
    • -apply_trc iec61966_2_1: Applies the specified transfer characteristic, in this case, IEC 61966-2-1 (sRGB).
    • -i "0000.exr": Specifies the input file.
    • -pix_fmt gbrp16le: Sets the pixel format to 16-bit float (little-endian).
    • -c:v exr: Sets the codec to encode the output file as an OpenEXR image.
    • -compression dwaa: Specifies the DWAA compression method.
    • -tiles 64x64: Sets the tile size for better compression efficiency. This is optional but recommended for DWAA/DWAB.

    Note that the -compression_level parameter isn't used in this context and should be replaced with -compression.

    The resulting output file will be "cc.exr".

  3. User

    what would be the diffrence using -c:v openexr instead of -c:v exr: ffmpeg -hide_banner -apply_trc iec61966_2_1 -i “0000.exr” -pix_fmt gbrp16le -c:v exr -compression dwaa -tiles 64x64 “cc.exr”

  4. Assistant

    There is no difference between using -c:v openexr and -c:v exr in ffmpeg, as both are aliases for the same codec. ffmpeg recognizes both names due to internal mappings of codec aliases to ensure compatibility and ease of use.

    So, these two commands are functionally identical:

    ffmpeg -hide_banner -apply_trc iec61966_2_1 -i "0000.exr" -pix_fmt gbrp16le -c:v exr -compression dwaa -tiles 64x64 "cc.exr"
    
    ffmpeg -hide_banner -apply_trc iec61966_2_1 -i "0000.exr" -pix_fmt gbrp16le -c:v openexr -compression dwaa -tiles 64x64 "cc.exr"
    

    Both commands will use the same OpenEXR encoder in ffmpeg and produce the same output file with DWAA compression.

    Use whichever alias you find more convenient or readable. They will have the same effect in terms of the encoding process for OpenEXR images.

  5. User

    from previous response when i convert i am getting a higher file size that was orginaly 1.3 mb now when convert the file is 23 mb is there any reason why the file should be much bigger

  6. Assistant

    When an OpenEXR file increases significantly in size after conversion, it often indicates that the encoding settings haven't properly preserved the original compression or data layout. Here are some factors that could be causing the file size to blow up:

    1. Pixel Format: Ensure the pixel format (-pix_fmt gbrp16le) matches the original file's bit depth and layout. Converting to a higher bit depth or uncompressed format can increase file size.

    2. Compression Settings: Double-check if the compression is correctly applied, and verify the effectiveness of DWAA compression. The specific -compression dwaa option should enable DWAA compression, which is lossy but efficiently reduces file sizes.

    3. Tile Size and Encoding Parameters: Misconfiguring tile sizes or other encoding parameters could lead to inefficiencies in the file's internal layout.

    Here’s a revised approach for the conversion, ensuring optimal settings:

    1. Inspect the Original File: Find out the original settings using ffmpeg -i "0000.exr".

    2. Optimal Command: Make sure to align the encoding parameters closely with the original to maintain compression. Here’s an updated example:

    ffmpeg -hide_banner -apply_trc iec61966_2_1 -i "0000.exr" -pix_fmt gbrp16le -c:v exr -compression dwaa -tiles 256x256 -pred 1 "cc.exr"
    

    Explanation:

    • -apply_trc iec61966_2_1: Apply the correct transfer characteristic.
    • -pix_fmt gbrp16le: Use the 16-bit float pixel format if your input format is indeed 16-bit.
    • -c:v exr: Specify OpenEXR codec.
    • -compression dwaa: Apply DWAA compression.
    • -tiles 256x256: Increasing tile size to 256x256, which might better match the original tiling and improve compression. Adjust based on output size and performance.
    • -pred 1: Use PIZ wavelet compression prediction mode (ensure alignment with original method used).

    Use the above command but adjust the -tiles and -pred options by testing increments to get closer to the original file size and quality. If you're still seeing large files:

    1. Check Compression: Ensure compression is indeed applied and effective:
    ffmpeg -i "cc.exr"
    

    Verify the output lists dwaa as the compression method.

    1. Compare Metadata: Use a tool like exrheader (from OpenEXR suite) on both files to compare settings, and ensure metadata and compression settings match:
    exrheader 0000.exr
    exrheader cc.exr
    

    Cross-verify parameters like compression and data layout, and adjust ffmpeg settings accordingly.

    By iterating through efficient tile sizes and confirming the settings, you can effectively control the output file size.

  7. User

    from previous response when i encode a error says: [exr @ 0x822a400] [Eval @ 0x7ffea3100b90] Undefined constant or missing '(' in 'dwaa' [exr @ 0x822a400] Unable to parse option value "dwaa" [exr @ 0x822a400] Error setting option compression to value dwaa.

  8. Assistant

    It seems that the option -compression dwaa isn't being recognized by ffmpeg specifically as you might have an older version of ffmpeg or an incorrect codec setting.

    To resolve this, we'll use a different approach by using openexr tools directly if the ffmpeg version you have doesn't support dwaa compression directly.

    Here’s a step-by-step approach:

    1. Install OpenEXR Tools: Ensure you have the OpenEXR tools installed. On Ubuntu, you can install them via:

      sudo apt-get install openexr
      
    2. Convert Using OpenEXR Tools:

      You can use exrmakepreview or other tools from the OpenEXR suite directly to convert and compress using dwaa. However, ffmpeg should ideally work also.

    If you prefer to continue using ffmpeg and want to troubleshoot this issue, please verify the ffmpeg version:

    ffmpeg -version
    

    Make sure it is a recent build. Here's an alternative ffmpeg command without using the compression flag directly but adjusting parameters:

    ffmpeg -hide_banner -apply_trc iec61966_2_1 -i "0000.exr" -pix_fmt gbrp16le -c:v exr -compression_level 6 -tiles 256x256 "cc.exr"
    

    In this situation:

    • -compression_level 6: Ensures some form of compression is applied.
    • Without the explicit -compression parameter, the default compression is used, which should not result in a huge size jump unless settings are mistuned.
    1. Update: If the desired result of dwaa compression is critical, consider updating your ffmpeg to a more recent build from source or use a build from ppa repositories known to be recent:
    sudo add-apt-repository ppa:jonathonf/ffmpeg-4
    sudo apt-get update
    sudo apt-get install ffmpeg
    

    Reattempt the original command:

    ffmpeg -hide_banner -apply_trc iec61966_2_1 -i "0000.exr" -pix_fmt gbrp16le -c:v exr -compression dwaa -tiles 256x256 "cc.exr"
    

    If these approaches do not resolve the issue, sharing exact diagnostic logs or version mismatches may help in finalizing steps. Using OpenEXR tools can be a direct fallback which has inbuilt and precise handling of such compressions:

    exrenvmap --compression dwaa -i "0000.exr" "cc.exr"
    

    By debugging version compatibility or using specific tools, you can ensure correct compression setting and expected file size output.

  9. User

    from previous response what would be the command to encode with openexr tools

  10. Assistant

    To use OpenEXR tools for encoding an image with the dwaa compression, you would typically use a combination of openexr command line utilities such as oiiotool (from OpenImageIO, which handles OpenEXR files well) or other specific utilities. OpenEXR itself provides tools like exrmaketiled to generate tiled, compressed EXR files.

    Here’s how you can do it with openexr tools:

    1. Install OpenImageIO:

      If you haven't yet installed OpenImageIO, you can do so using package managers. For example, on Ubuntu:

      sudo apt-get install openimageio-tools
      
    2. Convert Using maketiled from OpenEXR:

      Use oiiotool or exrmaketiled to apply the dwaa compression. For exrmaketiled, the command would be:

      exrmaketiled -c dwaa -o "cc.exr" "0000.exr"
      

      Here's what each option means:

      • -c dwaa: Specifies the dwaa compression method.
      • -o "cc.exr": The output file.
      • "0000.exr": The input file.
    3. Example with OpenImageIO (oiiotool):

      OpenImageIO’s oiiotool provides comprehensive options for image conversion and manipulation, including dwaa compression:

      oiiotool "0000.exr" --compression dwaa -o "cc.exr"
      

    Summary of Installation and Commands:

    Install OpenEXR and OpenImageIO Tools:

    For Ubuntu:

    sudo apt-get install openexr openimageio-tools
    

    Using exrmaketiled (from OpenEXR):

    exrmaketiled -c dwaa -o "cc.exr" "0000.exr"
    

    Using OpenImageIO (oiiotool):

    oiiotool "0000.exr" --compression dwaa -o "cc.exr"
    

    These commands use dedicated tools designed for OpenEXR and ensure the application of the desired dwaa compression efficiently.

    By using these specialized commands, you can precisely control compression and tiling to optimize file size effectively.