Sony ARW file use libraw_open_file return -2 error code.

Hi dev~

I used libraw_open_file open my sony ARW photo file, that return -2 error code, but I found our Supported cameras has supported Sony A7M4, can you help me update my code? :(

        libraw_data_t *raw = libraw_init(0);
        int code = libraw_open_file(raw, "/Users/pjhubs/Movies/test.ARW");
        if (code != LIBRAW_SUCCESS) {
            // Here return -2 error code.
            NSLog(@"error open file");
        if (libraw_unpack_thumb(raw) != LIBRAW_SUCCESS) {
            NSLog(@"error libraw_unpack file");
        if (libraw_dcraw_thumb_writer(raw, "/Users/pjhubs/Movies/test.jpeg") != LIBRAW_SUCCESS) {
            NSLog(@"error libraw_dcraw_thumb_writer file");

my test.ARW file google drive link:


This file is recorded using

This file is recorded using 'Sony YCC pseudo-raw' (Small/Medium RAW).

This format is not supported by LibRaw 0.21 (and will be supported in the next 'public snapshot').

The format was introduced after A7-IV release via firmware update; that's why this camera is listed as supported while it is really partially supported: at the time of the release of Librav 0.21, this recording format did not yet exist for this camera.

-- Alex Tutubalin @LibRaw LLC