I want to read various info from a blend file without opening it and know that blendfile.py is the way to go (to be found here on pypi and here on developer.blender.org.

I managed to succeed in a certain way:

path = "../tests/resources/100_frames_step10.blend"

import blendfile

    with blendfile.open_blend(path) as blend:
        scenes = blend.find_blocks_from_code(b'SC')

        # For each scene find some info and print it
        for scene in scenes:
            scene_name = scene[b'id', b'name'].decode()
            frame_start = scene[b"r", b"sfra"]
            frame_end = scene[b"r", b"efra"]
            frame_step = scene[b"r", b"frame_step"]
            x_resolution = scene[b"r", b"xsch"]
            y_resolution = scene[b"r", b"ysch"]
            # This would fail:
            # fps = scene[b"r", b"frames_per_second"]
            print(x_resolution, y_resolution)
            print(x_parts, y_parts)
except blendfile.BlendFileError:
    print("Not a blend file")

This code reads start and end frames, frame step, scene name, resolution etc.

But I don't know how to figure out how to find (or list) the other possible fields for scene[b"r", b"foo"]. I am especially interested in the render scale settings, in the frames per seconds and so on. Does anybody have an Idea where this is documented or how I can list this?

  • $\begingroup$ There is the blender-bam module, the blend file reading part is included with blender, it can be found inside the Blend File Utils addon. $\endgroup$
    – sambler
    Commented Sep 15, 2018 at 5:06
  • $\begingroup$ I already use blendfile.py, but it's usage is not very well documented and also not quite straightforward unless you already know exactly how the file needs to be decoded. $\endgroup$
    – ato
    Commented Sep 20, 2018 at 13:05

1 Answer 1


The data structure seems to be python dictionaries pointing to addresses in memory. Given your above code you can see the dictionaries by using

DNA_struct_of_scene = scene.file.structs[scene.sdna_index]
rel_dict = DNA_struct_of_scene.field_from_name[b'r'].dna_type.field_from_name

From the dict posted below, you can use


to get the render scale and


to get the frames per second

rel dict = 
 {b'im_format': <__main__.DNAField at 0x7f4e476aa990>,
 b'avicodecdata': <__main__.DNAField at 0x7f4e476aa9d8>,
 b'qtcodecdata': <__main__.DNAField at 0x7f4e476aaa20>,
 b'qtcodecsettings': <__main__.DNAField at 0x7f4e476aaa68>,
 b'ffcodecdata': <__main__.DNAField at 0x7f4e476aaab0>,
 b'cfra': <__main__.DNAField at 0x7f4e476aaaf8>,
 b'sfra': <__main__.DNAField at 0x7f4e476aab40>,
 b'efra': <__main__.DNAField at 0x7f4e476aab88>,
 b'subframe': <__main__.DNAField at 0x7f4e476aabd0>,
 b'psfra': <__main__.DNAField at 0x7f4e476aac18>,
 b'pefra': <__main__.DNAField at 0x7f4e476aac60>,
 b'images': <__main__.DNAField at 0x7f4e476aaca8>,
 b'framapto': <__main__.DNAField at 0x7f4e476aacf0>,
 b'flag': <__main__.DNAField at 0x7f4e476aad38>,
 b'threads': <__main__.DNAField at 0x7f4e476aad80>,
 b'framelen': <__main__.DNAField at 0x7f4e476aadc8>,
 b'blurfac': <__main__.DNAField at 0x7f4e476aae10>,
 b'edgeR': <__main__.DNAField at 0x7f4e476aae58>,
 b'edgeG': <__main__.DNAField at 0x7f4e476aaea0>,
 b'edgeB': <__main__.DNAField at 0x7f4e476aaee8>,
 b'fullscreen': <__main__.DNAField at 0x7f4e476aaf30>,
 b'xplay': <__main__.DNAField at 0x7f4e476aaf78>,
 b'yplay': <__main__.DNAField at 0x7f4e476aafc0>,
 b'freqplay': <__main__.DNAField at 0x7f4e476ab048>,
 b'depth': <__main__.DNAField at 0x7f4e476ab090>,
 b'attrib': <__main__.DNAField at 0x7f4e476ab0d8>,
 b'frame_step': <__main__.DNAField at 0x7f4e476ab120>,
 b'stereomode': <__main__.DNAField at 0x7f4e476ab168>,
 b'dimensionspreset': <__main__.DNAField at 0x7f4e476ab1b0>,
 b'filtertype': <__main__.DNAField at 0x7f4e476ab1f8>,
 b'size': <__main__.DNAField at 0x7f4e476ab240>,
 b'maximsize': <__main__.DNAField at 0x7f4e476ab288>,
 b'pad6': <__main__.DNAField at 0x7f4e476ab2d0>,
 b'xsch': <__main__.DNAField at 0x7f4e476ab318>,
 b'ysch': <__main__.DNAField at 0x7f4e476ab360>,
 b'xparts': <__main__.DNAField at 0x7f4e476ab3a8>,
 b'yparts': <__main__.DNAField at 0x7f4e476ab3f0>,
 b'tilex': <__main__.DNAField at 0x7f4e476ab438>,
 b'tiley': <__main__.DNAField at 0x7f4e476ab480>,
 b'planes': <__main__.DNAField at 0x7f4e476ab4c8>,
 b'imtype': <__main__.DNAField at 0x7f4e476ab510>,
 b'subimtype': <__main__.DNAField at 0x7f4e476ab558>,
 b'quality': <__main__.DNAField at 0x7f4e476ab5a0>,
 b'displaymode': <__main__.DNAField at 0x7f4e476ab5e8>,
 b'use_lock_interface': <__main__.DNAField at 0x7f4e476ab630>,
 b'pad7': <__main__.DNAField at 0x7f4e476ab678>,
 b'scemode': <__main__.DNAField at 0x7f4e476ab6c0>,
 b'mode': <__main__.DNAField at 0x7f4e476ab708>,
 b'raytrace_options': <__main__.DNAField at 0x7f4e476ab750>,
 b'raytrace_structure': <__main__.DNAField at 0x7f4e476ab798>,
 b'pad1': <__main__.DNAField at 0x7f4e476ab7e0>,
 b'ocres': <__main__.DNAField at 0x7f4e476ab828>,
 b'pad4': <__main__.DNAField at 0x7f4e476ab870>,
 b'alphamode': <__main__.DNAField at 0x7f4e476ab8b8>,
 b'osa': <__main__.DNAField at 0x7f4e476ab900>,
 b'frs_sec': <__main__.DNAField at 0x7f4e476ab948>,
 b'edgeint': <__main__.DNAField at 0x7f4e476ab990>,
 b'safety': <__main__.DNAField at 0x7f4e476ab9d8>,
 b'border': <__main__.DNAField at 0x7f4e476aba20>,
 b'disprect': <__main__.DNAField at 0x7f4e476aba68>,
 b'layers': <__main__.DNAField at 0x7f4e476abab0>,
 b'actlay': <__main__.DNAField at 0x7f4e476abaf8>,
 b'mblur_samples': <__main__.DNAField at 0x7f4e476abb40>,
 b'xasp': <__main__.DNAField at 0x7f4e476abb88>,
 b'yasp': <__main__.DNAField at 0x7f4e476abbd0>,
 b'frs_sec_base': <__main__.DNAField at 0x7f4e476abc18>,
 b'gauss': <__main__.DNAField at 0x7f4e476abc60>,
 b'color_mgt_flag': <__main__.DNAField at 0x7f4e476abca8>,
 b'postgamma': <__main__.DNAField at 0x7f4e476abcf0>,
 b'posthue': <__main__.DNAField at 0x7f4e476abd38>,
 b'postsat': <__main__.DNAField at 0x7f4e476abd80>,
 b'dither_intensity': <__main__.DNAField at 0x7f4e476abdc8>,
 b'bake_osa': <__main__.DNAField at 0x7f4e476abe10>,
 b'bake_filter': <__main__.DNAField at 0x7f4e476abe58>,
 b'bake_mode': <__main__.DNAField at 0x7f4e476abea0>,
 b'bake_flag': <__main__.DNAField at 0x7f4e476abee8>,
 b'bake_normal_space': <__main__.DNAField at 0x7f4e476abf30>,
 b'bake_quad_split': <__main__.DNAField at 0x7f4e476abf78>,
 b'bake_maxdist': <__main__.DNAField at 0x7f4e476abfc0>,
 b'bake_biasdist': <__main__.DNAField at 0x7f4e476ad048>,
 b'bake_samples': <__main__.DNAField at 0x7f4e476ad090>,
 b'bake_pad': <__main__.DNAField at 0x7f4e476ad0d8>,
 b'bake_user_scale': <__main__.DNAField at 0x7f4e476ad120>,
 b'bake_pad1': <__main__.DNAField at 0x7f4e476ad168>,
 b'pic': <__main__.DNAField at 0x7f4e476ad1b0>,
 b'stamp': <__main__.DNAField at 0x7f4e476ad1f8>,
 b'stamp_font_id': <__main__.DNAField at 0x7f4e476ad240>,
 b'pad3': <__main__.DNAField at 0x7f4e476ad288>,
 b'stamp_udata': <__main__.DNAField at 0x7f4e476ad2d0>,
 b'fg_stamp': <__main__.DNAField at 0x7f4e476ad318>,
 b'bg_stamp': <__main__.DNAField at 0x7f4e476ad360>,
 b'seq_prev_type': <__main__.DNAField at 0x7f4e476ad3a8>,
 b'seq_rend_type': <__main__.DNAField at 0x7f4e476ad3f0>,
 b'seq_flag': <__main__.DNAField at 0x7f4e476ad438>,
 b'pad5': <__main__.DNAField at 0x7f4e476ad480>,
 b'simplify_flag': <__main__.DNAField at 0x7f4e476ad4c8>,
 b'simplify_subsurf': <__main__.DNAField at 0x7f4e476ad510>,
 b'simplify_subsurf_render': <__main__.DNAField at 0x7f4e476ad558>,
 b'simplify_shadowsamples': <__main__.DNAField at 0x7f4e476ad5a0>,
 b'pad9': <__main__.DNAField at 0x7f4e476ad5e8>,
 b'simplify_particles': <__main__.DNAField at 0x7f4e476ad630>,
 b'simplify_particles_render': <__main__.DNAField at 0x7f4e476ad678>,
 b'simplify_aosss': <__main__.DNAField at 0x7f4e476ad6c0>,
 b'cineonwhite': <__main__.DNAField at 0x7f4e476ad708>,
 b'cineonblack': <__main__.DNAField at 0x7f4e476ad750>,
 b'cineongamma': <__main__.DNAField at 0x7f4e476ad798>,
 b'jp2_preset': <__main__.DNAField at 0x7f4e476ad7e0>,
 b'jp2_depth': <__main__.DNAField at 0x7f4e476ad828>,
 b'rpad3': <__main__.DNAField at 0x7f4e476ad870>,
 b'domeres': <__main__.DNAField at 0x7f4e476ad8b8>,
 b'domemode': <__main__.DNAField at 0x7f4e476ad900>,
 b'domeangle': <__main__.DNAField at 0x7f4e476ad948>,
 b'dometilt': <__main__.DNAField at 0x7f4e476ad990>,
 b'domeresbuf': <__main__.DNAField at 0x7f4e476ad9d8>,
 b'pad2': <__main__.DNAField at 0x7f4e476ada20>,
 b'dometext': <__main__.DNAField at 0x7f4e476ada68>,
 b'line_thickness_mode': <__main__.DNAField at 0x7f4e476adab0>,
 b'unit_line_thickness': <__main__.DNAField at 0x7f4e476adaf8>,
 b'engine': <__main__.DNAField at 0x7f4e476adb40>,
 b'bake': <__main__.DNAField at 0x7f4e476adb88>,
 b'preview_start_resolution': <__main__.DNAField at 0x7f4e476adbd0>,
 b'debug_pass_type': <__main__.DNAField at 0x7f4e476adc18>,
 b'pad': <__main__.DNAField at 0x7f4e476adc60>,
 b'views': <__main__.DNAField at 0x7f4e476adca8>,
 b'actview': <__main__.DNAField at 0x7f4e476adcf0>,
 b'views_format': <__main__.DNAField at 0x7f4e476add38>,
 b'pad8': <__main__.DNAField at 0x7f4e476add80>,
 b'mblur_shutter_curve': <__main__.DNAField at 0x7f4e476addc8>}
  • $\begingroup$ Followup question: When I try to get the im_format I will get a error: Error: ("(b'r', b'im_format') exists but isn't pointer, can't resolve field b'im_format'", DNAName(b'im_format'), DNAStruct(b'ImageFormatData')) It is clear that I somehow need to decode that DNAStruct, but I am a bit confused how. $\endgroup$
    – ato
    Commented Sep 20, 2018 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .