Basic raw support on firmware 1.4.0

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
Hi all,

I finally managed to get some basic raw support on the Yi 4k. I did it some time ago but I think someone else could be interested.

First, you need to create an autoexec.ash file on the root of the memory card with this content:
t app test enable_rawcap 1
t app test enc stillrawcap 1 0

The first line enables capturing in raw (and raw only, no jpeg is created when the shutter is pressed).
The second line disables the creation of multiple Ituner files. These files are really interesting, but you probably don't want them for all your pictures.

Once you have that you can reboot the camera and take some pictures. The raw files will be on the root of the SD with a name like StillRawCap_0001.RAW

These files cannot be opened directly, you need to convert them first to DNG using raw2dng tool from https://github.com/wildstray/raw2dng

You will need a custom .ini file for the yi 4k camera. Create a file named raw2nef.ini with this line:
24000000, 0, 4000, 3000, 7, 8000, 16, 4, YI4k

Then use the software with -YI4k to convert to DNG.

As a jpeg is not created along with the raw file, we cannot include any exif information. This creates problems with Darktable, the raw software I use. But you can convert the DNG to tiff using dcraw without any problems.

I would love to hear from you if you try it or if you discover any ways to improve it. And ask about any detail of the process you don't understand.

Cheers,
Pablo

PS1: Some help from the commands

Usage: t app test enc stillrawcap [Cmpr][DumpItuner]
Cmpr:0 : Normal Raw, 1 : Compress Raw.
DumpItuner: Enable dump ituner or not
t app test enc stillrawcap 1 0

Cmpr = 1 doesn't compress. Test with 0
DumpItuner = 0 avoids the extra files

t img -rawenc [filepath] : raw encode flow
filepath = file path for configuration file

The first command should enable raw compressión, but is not working for me, it just avoids the ituner files. The second I didn't try but seems related, and it might be a way to configure something on the raw file.

PS2: Bonus command, you can use t ipc rpc clnt exec1 'touch /tmp/SD0/foo' to run commands on the linux OS of the camera from autoexec.ash
 
Last edited:

hirsti99

Member
Joined
Jun 22, 2015
Messages
81
Reaction score
23
Country
United Kingdom
Hi, Thanks for this :D

I can get the camera to create the raw file but when I try to use the editor it says unsupported format.
I have entered the line 24000000, 0, 4000, 3000, 7, 8000, 16, 4, YI4k into the raw2nef.ini but still get this error
 
OP
P

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
I have the same problem with my editor. What I've done is to convert the dng to tiff using dcraw, and then edit the tiff file (that has much more info than the jpeg).

Of course, this is not ideal, but I didn't put much time to fix it. If you manage to get any improvement, please report it here.
 

hirsti99

Member
Joined
Jun 22, 2015
Messages
81
Reaction score
23
Country
United Kingdom
Sorry I meant the converter to DNG gives unsupported error not the editor
 
OP
P

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
This is the full command that works for me on linux, I've not tested the windows version:
./raw2dng -i raw2nef.ini -YI4k -o test.dng StillRawCap_0001.RAW
 
OP
P

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
I've just tested everything again, and if I want to covert to tiff I must use raw2nef instead of raw2dng. I'm not sure why.
 
OP
P

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
If anyone is interested, Darktable is able to open the raw files directly just modifying one configuration file.

The file is cameras.xml inside rawspeed. There you have to find the entry <Camera make="Samsung" model="WB550" supported="no" mode="chdk-b"> and change it to this:

<Camera make="Yi" model="4k" mode="chdk-b">
<CFA2 width="2" height="2">
<ColorRow y="0">RG</ColorRow>
<ColorRow y="1">GB</ColorRow>
</CFA2>
<Crop x="0" y="0" width="0" height="0"/>
<Sensor black="800" white="16383"/>
<Hints>
<Hint name="filesize" value="24000000"/>
<Hint name="full_width" value="4000"/>
<Hint name="full_height" value="3000"/>
</Hints>
</Camera>

Then, you can just open the .RAW files directly in Darktable (tested on linux). There are some operations that complain because it cannot find a color matrix, but I guess this could be easily solved contacting the DT developers.

This makes the raw files finally useful, even if it's not yet a perfect solution.
 

hirsti99

Member
Joined
Jun 22, 2015
Messages
81
Reaction score
23
Country
United Kingdom
Finally managed to get the converter to work.
The resulting DNG file however seems to be a lot worse than having JPG's
It is drastically underexposed and has all the wrong colour, in fact it almost looks like an infra red photo, ie when you don't have an ir filter, like very pink/magenta
Is this your experience or is something wrong at my end?
The DNG opens up in Photoshop CC ok.
 

hirsti99

Member
Joined
Jun 22, 2015
Messages
81
Reaction score
23
Country
United Kingdom
Ignore my last comment, just realised I had not put them through the Yi-correct-RAW-counter batch file.
They open in photoshop ok and with a slight White Balance adjustment they look ok.
Will have a play with it tomorrow and see how they differ to the JPG;s the camera produces.
Seems to be a bit hit and miss though on if it reboots the camera or not.
 
OP
P

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
hirsti99, you can try to play a littlebit with the correct raw script because the white and black levels seem wrong to me for the yi 4k.

The numbers I use on darktable are 800 for black and 16383 for white (taken from the ituner files). I'm not sure if it will be the same on this script (I don't have access to windows right now), but probably they will work better.

If you see that there are many overexposed areas, this is probably the reason.

Let me know if it works better,
Cheers
 

hirsti99

Member
Joined
Jun 22, 2015
Messages
81
Reaction score
23
Country
United Kingdom
The batch file I have only has this entry, if I change it to your figures then it is way too dark.

exiftool -WhiteLevel=1024 -BlackLevel=50 %1 -overwrite_original

Also the command in the Autexec.ash file causes the camera to reboot after every photo, if I set it to as follows it works but I get all the extra files, cant seem to get rid of them.

t app test enable_rawcap 1
t app test enc stillrawcap 0 1
 

irungentoo

Member
Joined
Mar 16, 2017
Messages
42
Reaction score
37
Country
Canada
I noticed the enable_rawcap command and did some tests with it a few weeks ago. The main issue with it is that it's only a debugging command used to debug the camera.

For example, if you take two pictures, reboot the camera and take two other pictures those two new pictures will overwrite the two older pictures you took.
 
OP
P

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
Thanks @irungentoo I didn't notice this on my tests (i didn't reboot). That makes it useless for me.

One possible solution could be to move the files from the linux side after a reboot (and maybe every few seconds), this should be pretty fast. This can also be used to remove the extra ituner files (solving the autoreboot), compress the raw, ... and even generate a jpeg from the raw for review on camera if we find a way to do it (I couldn't find a way to execute ash commands from linux, yet).

Ideally we could enable a mode of Raw+Jpeg as in the old Yi camera, but I have no clue how to find it.
 
OP
P

Pablo Guerrero

New Member
Joined
Apr 11, 2017
Messages
14
Reaction score
3
Country
Switzerland
No raw support on 1.4.14, that means it still makes sense to try to find a solution.
 

nutsey

Well-Known Member
Joined
May 12, 2015
Messages
569
Reaction score
474
Location
Turkey
Country
Russian Federation
Hi. Could you please share ituner settings file (StillRawCapItuner_1.txt)?
 
Thread starter Similar threads Forum Replies Date
R Yi 4K Action Camera 6
B Yi 4K Action Camera 8
Top