ayon-core icon indicating copy to clipboard operation
ayon-core copied to clipboard

Deep images fail with ffmpeg in `ExtractReview`

Open MustafaJafar opened this issue 1 year ago • 7 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current Behavior:

Exporting Deep data is now allowed by https://github.com/ynput/ayon-houdini/pull/120 Exporting Deep Beauty AOV fails with ffmpeg in ExtractReview, it seems that the current ffmpeg didn't like the deep image. Not sure if this issue related to core addon or third party addon.

[exr @ 000001d9fab74940] deep data is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[image2 @ 000001d9fab71f00] decoding for stream 0 failed
[image2 @ 000001d9fab71f00] Could not find codec parameters for stream 0 (Video: exr, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, image2, from 'H:/AYON/projects/Experiments/things/USD_Render/work/Houdini/renders/Expr_USD_Render_Houdini_v006/karmarendersettings_and_beauty_products\Expr_USD_Render_Houdini_v006.karmarendersettings_and_beauty_products.dcm.%d.exr':
  Duration: 00:00:00.08, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: exr, none, 25 fps, 25 tbr, 25 tbn, 25 tbc
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (H:/AYON/projects/Experiments/things/USD_Render/work/Houdini/renders/Expr_USD_Render_Houdini_v006/karmarendersettings_and_beauty_products\Expr_USD_Render_Houdini_v006.karmarendersettings_and_beauty_products.dcm_h264.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (exr (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[exr @ 000001d9fabbd0c0] deep data is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
Error while decoding stream #0:0: Not yet implemented in FFmpeg, patches welcome
[exr @ 000001d9fb612d80] deep data is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
Error while decoding stream #0:0: Not yet implemented in FFmpeg, patches welcome
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
Conversion failed!

Expected Behavior:

It should work.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

  1. Setup Render in Houdini with deep beauty pass enabled in USD karma render.
  2. Publish

Are there any labels you wish to add?

  • [x] I have added the relevant labels to the bug report.

Relevant log output:


Additional context:

No response

MustafaJafar avatar Dec 12 '24 13:12 MustafaJafar

@MustafaJafar Can you try with the latest ffmpeg 7.1 ? Not sure this has been implemented: deep images use a different OpenEXR API and need to be flattened before being processed by ffmpeg.

philippe-ynput avatar Jan 22 '25 14:01 philippe-ynput

I looked at the ffmpeg changelog and deep support is not mentioned. The simplest solution is to pre-process the files with oiiotool deepRender.exr -flatten -o flatRender.exr.

philippe-ynput avatar Jan 22 '25 14:01 philippe-ynput

Definitively not implemented in latest ffmpeg ! 😂

    if (flags & 0x08) {
        avpriv_report_missing_feature(s->avctx, "deep data");
        return AVERROR_PATCHWELCOME;
    }

philippe-ynput avatar Jan 22 '25 14:01 philippe-ynput

I wonder whether we could workaround it for new by running it via ExtractOIIOTranscode plugin and convert it to something more FFMPEG friendly.

UPDATE ------ It actually is not working either see the internal comunication. https://discord.com/channels/517362899170230292/1344323811218034759

Executing arguments was not successful: "(['C:\\Users\\deadline.user\\AppData\\Local\\Ynput\\AYON\\addons\\ayon_third_party_1.1.1\\ayon_third_party\\downloads\\oiio\\oiiotool.exe', '--nosoftwareattrib', '--colorconfig', '//192.168.80.52/central_software/OCIO_2.1/studio-config-v1.0.0_aces-v1.3_ocio-v2.1.ocio', '-i:ch=R,G,B,A', '\\\\############\\projects/#######/scenes/###/###_0160/work/mist_P048/render/AWG_0160_mist_P048_v006/KMA_cbs_cubes\\###_0160_mist_P048_v006.KMA_cbs_cubes.dcm.989-992#.exr', '--ch', 'R=R,G=G,B=B,A=A', '--iscolorspace', 'ACEScg', '--ociodisplay:subimages=0', 'sRGB - Display', 'ACES 1.0 - SDR Video', '-o', 'C:\\Users\\DEADLI~1.USE\\AppData\\Local\\Temp\\ay_tmp_8l6iqbab\\####_0160_mist_P048_v006.KMA_cbs_cubes.dcm.989-992#.png'],)

jakubjezek001 avatar Feb 27 '25 10:02 jakubjezek001

I wonder whether we could workaround it for new by running it via ExtractOIIOTranscode plugin and convert it to something more FFMPEG friendly.

UPDATE ------ It actually is not working either see the internal comunication. https://discord.com/channels/517362899170230292/1344323811218034759

Executing arguments was not successful: "(['C:\\Users\\deadline.user\\AppData\\Local\\Ynput\\AYON\\addons\\ayon_third_party_1.1.1\\ayon_third_party\\downloads\\oiio\\oiiotool.exe', '--nosoftwareattrib', '--colorconfig', '//192.168.80.52/central_software/OCIO_2.1/studio-config-v1.0.0_aces-v1.3_ocio-v2.1.ocio', '-i:ch=R,G,B,A', '\\\\############\\projects/#######/scenes/###/###_0160/work/mist_P048/render/AWG_0160_mist_P048_v006/KMA_cbs_cubes\\###_0160_mist_P048_v006.KMA_cbs_cubes.dcm.989-992#.exr', '--ch', 'R=R,G=G,B=B,A=A', '--iscolorspace', 'ACEScg', '--ociodisplay:subimages=0', 'sRGB - Display', 'ACES 1.0 - SDR Video', '-o', 'C:\\Users\\DEADLI~1.USE\\AppData\\Local\\Temp\\ay_tmp_8l6iqbab\\####_0160_mist_P048_v006.KMA_cbs_cubes.dcm.989-992#.png'],)

I wonder if newer versions of oiio could solve this - because it does have a full section on "Deep EXRs" in their docs: https://openimageio.readthedocs.io/en/latest/imageoutput.html#writing-deep-data

Does anyone have an example dcm file to share? If so, then we can just try it quickly with uv:

uv run --with OpenImageIO -- oiiotool.exe

Crash may be fixed with newer OIIO

Third party addon currently comes with OpenImageIO 2.3.10 The latest OpenImageIO (that's available also through pip now) is OpenImageIO 3.0.3.1

Relevant changes since then may be:

  • fix(exr): Avoid integer overflow for large deep exr slice strides PR (3.0.1.0) in 3.0.1.0
  • exr: Avoid integer overflow for large deep exr slice strides PR in 2.5.18.0
  • IBAprep should not zero out deep images when creating dst PR in 2.4.8.0
  • Fix writing deep exrs when buffer datatype doesn't match the file. PR in 2.3.14.0

BigRoy avatar Feb 27 '25 11:02 BigRoy

I gave this a go and this fails:

uv run --with OpenImageIO -- oiiotool.exe -i:ch=R,G,B,A %FILE% -o test.png

Due to error:

oiiotool ERROR: -o : png does not support 'deep' images

But this succeeds:

uv run --with OpenImageIO -- oiiotool.exe -i:ch=R,G,B,A %FILE% --flatten -o test.png

As such, it may just be sufficient to include the --flatten argument for extract transcode settings to png and jpeg?

For example:

Image


This test was running OpenImageIO 3.0.3.1

BigRoy avatar Feb 27 '25 11:02 BigRoy

Also, here's an example DCM file:

test_dcm.zip

With courtesy from @MustafaJafar

BigRoy avatar Feb 27 '25 13:02 BigRoy