Ffmpeg issues with 2.83.3

Hi,

within openSUSE Tumbleweed, we track upstream closely. During transition from ffmpeg 4.2.3 to 4.3.1, we noticed some issues related to the way, Blender and Chromium are using some ffmpeg interfaces.

Since then, Chromium and Blender 2.90 seems to be fixed, but 2.83.3 is not.
Note, that this happens, if Blender is built against ffmpeg 4.3.1, btw.

A typical sequence to reproduce this issue is: switch to Shading mode, Add -> Texture -> Image Texture, connect Color with Base Color, Open -> open some simple mp4, and boom!

Resulting in this backtrace:

Thread 1 "blender" received signal SIGSEGV, Segmentation fault.
0x00007ffff5d82eaa in ff_yuv_420_bgr32_ssse3.loop0 () at libswscale/x86/yuv_2_rgb.asm:379
379     libswscale/x86/yuv_2_rgb.asm: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  0x00007ffff5d82eaa in ff_yuv_420_bgr32_ssse3.loop0 () at libswscale/x86/yuv_2_rgb.asm:379
#1  0x00007ffff5d76693 in yuv420_bgr32_ssse3 (c=0x7fffa1878200, src=0x7fffffffbce0, srcStride=0x7fffffffbcb0, srcSliceY=0, srcSliceH=1080, dst=0x7fffffffbcc0, 
    dstStride=0x7fffffffbca0) at libswscale/x86/yuv2rgb_template.c:133
#2  0x00007ffff5d553bd in sws_scale (c=<optimized out>, srcSlice=srcSlice@entry=0x7fff9c95e000, srcStride=srcStride@entry=0x7fff9c95e040, 
    srcSliceY=srcSliceY@entry=0, srcSliceH=<optimized out>, dst=dst@entry=0x7fffffffbf20, dstStride=<optimized out>) at libswscale/swscale.c:969
#3  0x0000555556794dba in ffmpeg_postprocess (anim=<optimized out>) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/imbuf/intern/anim_movie.c:836
#4  ffmpeg_fetchibuf (tc=<optimized out>, position=0, anim=<optimized out>)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/imbuf/intern/anim_movie.c:1192
#5  IMB_anim_absolute (anim=<optimized out>, position=<optimized out>, tc=<optimized out>, preview_size=<optimized out>)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/imbuf/intern/anim_movie.c:1391
#6  0x00005555562f1e6c in openanim (name=0x7fffffffc170 "/work/Dokumente/Video/Test.mp4", flags=<optimized out>, streamindex=<optimized out>, 
    colorspace=<optimized out>) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/blenkernel/intern/image.c:2969
#7  0x00005555562f32de in load_movie_single (ima=0x7fff9c819608, iuser=0x7fffba0145c8, frame=1, view_id=<optimized out>)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/blenkernel/intern/image.c:4162
#8  0x00005555562f612d in image_load_movie_file (frame=1, iuser=0x7fffba0145c8, ima=0x7fff9c819608)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/blenkernel/intern/image.c:4215
#9  image_acquire_ibuf (ima=0x7fff9c819608, iuser=0x7fffba0145c8, r_lock=<optimized out>)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/blenkernel/intern/image.c:4840
#10 0x000055555812f969 in BKE_image_acquire_ibuf (r_lock=0x0, iuser=0x7fffba0145c8, ima=0x7fff9c819608)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/blenkernel/intern/image.c:4950
#11 GPU_texture_from_blender (ima=0x7fff9c819608, iuser=0x7fffba0145c8, ibuf=0x0, textarget=3553)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/gpu/intern/gpu_draw.c:902
#12 0x00005555566d9656 in drw_shgroup_material_texture (tex=0x7fffba936988, tex=0x7fffba936988, textarget=3553, name=0x7fffba9369b0 "samp0", 
    grp=0x7fffba12b370) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/intern/draw_manager_data.c:1290
#13 drw_shgroup_material_inputs (material=0x7fffba859ae8, grp=0x7fffba12b370)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/intern/draw_manager_data.c:1317
#14 DRW_shgroup_material_create (material=0x7fffba859ae8, pass=<optimized out>)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/intern/draw_manager_data.c:1356
#15 0x00005555567014d4 in material_opaque (holdout=<optimized out>, shgrps=0x7fffffffcc60, gpumat_depth=<optimized out>, gpumat=<optimized out>, 
    vedata=<optimized out>, sldata=<optimized out>, material_hash=<optimized out>, ma=0x7fffc284d988)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/engines/eevee/eevee_materials.c:2087
#16 EEVEE_materials_cache_populate (vedata=vedata@entry=0x7fffa916e088, sldata=sldata@entry=0x7fffba169308, ob=ob@entry=0x7fffdfa52408, 
    cast_shadow=cast_shadow@entry=0x7fffffffce47) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/engines/eevee/eevee_materials.c:2042
#17 0x000055555670172b in EEVEE_cache_populate (vedata=0x7fffa916e088, ob=0x7fffdfa52408)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/engines/eevee/eevee_engine.c:128
#18 0x00005555566d2a73 in drw_engines_cache_populate (ob=ob@entry=0x7fffdfa52408)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/intern/draw_manager.c:1003
#19 0x00005555566e4c9b in DRW_draw_render_loop_ex (depsgraph=<optimized out>, engine_type=0x7fffffffcf00, region=0x7fffdad6c648, v3d=0x7fffdf743608, 
    viewport=<optimized out>, evil_C=<optimized out>) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/draw/intern/draw_manager.c:1475
#20 0x0000555556ef28d7 in view3d_draw_view (region=0x7fffdad6c648, C=0x7fffe203e608)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/editors/space_view3d/view3d_draw.c:1602
#21 view3d_main_region_draw (C=0x7fffe203e608, region=0x7fffdad6c648)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/editors/space_view3d/view3d_draw.c:1626
#22 0x00005555569c1c81 in ED_region_do_draw (C=0x7fffe203e608, region=0x7fffdad6c648)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/editors/screen/area.c:538
#23 0x00005555565ca31e in wm_draw_window_offscreen (stereo=false, win=0x7fffdfaafe08, C=0x7fffe203e608)
    at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/windowmanager/intern/wm_draw.c:688
#24 wm_draw_window (win=0x7fffdfaafe08, C=0x7fffe203e608) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/windowmanager/intern/wm_draw.c:809
#25 wm_draw_update (C=0x7fffe203e608) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/windowmanager/intern/wm_draw.c:1016
#26 0x00005555565dcf40 in WM_main (C=0x7fffe203e608) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/blender/windowmanager/intern/wm.c:456
#27 0x00005555562699f9 in main (argc=1, argv=0x7fffffffd958) at /usr/src/debug/blender-2.83.3-372.1.x86_64/source/creator/creator.c:528

Could somebody point me to the relevant changeset, please?

Well the change to bump ffmpeg and some related codecs happened at 5db2d9c82b7

There’s conflicting versions listed there but ffmpeg is currently at 4.2.3 for 2.90 and 2.91. 2.83 was built against 4.0.2

So it was fixed here: https://developer.blender.org/rB6778ef4dcc6e8d92e3b2ec9b9ecaf1e54e5bf7b5

And here is the ticket with additional info. https://developer.blender.org/T78867

This doesn’t appear to be an issue with official Blender builds if I am reading the above links correctly.

FFmpeg ticket where the issue was fixed in FFmpeg’s dev branch 12 days ago: https://trac.ffmpeg.org/ticket/8747

This is exactly, what I was after. Thanks a lot, @EAW.

We’re affected due using ffmpeg system libraries for various reasons…

It might be appropriate to backport the fix to the 2.83 series as well, since they are destined as LTS releases, even if official builds aren’t affected.

Hrmpf, unfortunately, for some reason, attempting to fetch the raw changeset results in a diff with the full file as context :worried: