User Tools

Site Tools


doc:appunti:hardware:ambarella_custom_firmware

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
doc:appunti:hardware:ambarella_custom_firmware [2022/05/01 16:50] – [Chroma curves examples] niccolodoc:appunti:hardware:ambarella_custom_firmware [2022/05/02 11:16] niccolo
Line 1: Line 1:
-====== SJCAM SJ8 Pro Custom Firmware ======+====== How to customize the Ambarella firmware of the SJCAM SJ8 Pro ======
  
-**How to customize the Ambarella firmware using BitrateEditor** +See also my SJCAM SJ8 Pro action camera review in page **[[sjcam-8pro]]**.
- +
-See also my SJCAM SJ8 Pro review in page **[[sjcam-8pro]]**.+
  
 In this page there are some notes about customizing the firmware of the **[[sjcam-8pro|SJCAM SJ8 Pro]]** action camera, using the **[[https://github.com/vmax1145/BitrateEditor|BitrateEditor]]** software. BitrateEditor is not just about bitrates, it can also change firmware tables about gamma values, YUV values, exposure and many others. In this page there are some notes about customizing the firmware of the **[[sjcam-8pro|SJCAM SJ8 Pro]]** action camera, using the **[[https://github.com/vmax1145/BitrateEditor|BitrateEditor]]** software. BitrateEditor is not just about bitrates, it can also change firmware tables about gamma values, YUV values, exposure and many others.
Line 10: Line 8:
  
 Unfortunately it seems that the hackers community is very jealous of their findings, hardly anyone writes complete documentation and it seems that the main interest is to prove our own supremacy by publishing as many //mod//s as possible, without documenting exactly what was done inside. A notable exception is the **BitrateEditor** software by **V_Max** hacker; being released as open source it is a source of very useful information on the internal structure of firmware files. Unfortunately it seems that the hackers community is very jealous of their findings, hardly anyone writes complete documentation and it seems that the main interest is to prove our own supremacy by publishing as many //mod//s as possible, without documenting exactly what was done inside. A notable exception is the **BitrateEditor** software by **V_Max** hacker; being released as open source it is a source of very useful information on the internal structure of firmware files.
- 
-===== My Custom firmware ===== 
- 
-Download the custom firmware: **{{.:sjcam:sj8pro_mod-rigacci.org_v1.0_20211225.tgz|SJ8PRO_MOD-rigacci.org_V1.0_20211225.tgz}}** 
- 
-This is a breif list of customizations, see the README.txt contained into the archive for more details: 
- 
-  * Increased **bitrates**, as per other 4K action cameras. Particular attention to default settings and 1920x1080 mode. 
-  * Increased **keyframes** rates (reducing GOP-N): one keyframe every 1/4 second instead of 1 per second. 
-  * Changed **YUV color profiles**: less contrast for **SJCAM - Vivid**, more contrast for **Flat** 
-  * Fixed **exposition** profiles: **Center**, **Spot** and **Average**. 
-  * Changed **gamma curves**: reducing blue sky and contrast. 
-  * Changed power-on, power-off and photo shutter **sounds** with louder ones. 
-  * Disabled **LRV** (low resolution videos) recording. 
- 
-=== Bitrates === 
- 
-The SJ8 Pro camera has by default very low bitrates compared with other 4K action cameras. In the following table you can compare three cameras in various video modes. My custom settings are geared to always keep the standard quality and to film mainly at 1920x1080, to save space and battery. 
- 
-^  Bitrates  ^^^^^^^^^^ 
-^              SJCAM\\ SJ8Pro  ^^^  Xiaomi\\ Yi 4K+  ^^ DJI Osmo\\ Action 4K  ^  My Custom\\ SJ8Pro  ^^^ 
-^ Video Mode  ^  Eco  ^  Std  ^  Fine  ^  Default  ^  S-Fine  ^  Default  ^  Eco  ^  Std  ^ Fine  ^ 
-^ 4K@60         50 |    60 |   100 |   100 |     135 |  100 |  80 |  100 |  120 | 
-^ 4K@30         30 |    40 |    60 |    60 |     100 |  100 |  46 |   72 |   98 | 
-|  ||||||| 
-^ 2.7K@60       46 |    60 |    72 |    60 |      75 |  100 |  40 |   60 |   80 | 
-^ 2.7K@30       24 |    34 |    52 |    45 |      60 |   82 |  30 |   48 |   60 | 
-|  ||||||| 
-^ 1440@60       24 |    30 |    36 |    60 |      75 |      |  36 |   56 |   76 | 
-^ 1440@30       24 |    30 |    36 |    45 |      60 |      |  28 |   46 |   58 | 
-|  ||||||| 
-^ 1080@120    |   44 |    58 |    74 |    60 |      75 |  100 |  40 |   60 |   80 | 
-^ 1080@60       24 |    30 |    36 |    45 |      60 |   82 |  30 |   48 |   60 | 
-^ 1080@30       18 |    24 |    30 |    45 |      60 |   36 |  24 |   38 |   48 | 
-|  ||||||| 
-^ 720@240       24 |    30 |    36 |    60 |      75 |  100 |  40 |   60 |   80 | 
- 
-  * **[[https://help.yitechnology.com/hc/en-us/articles/115005742328-What-is-the-bitrate-for-each-resolution-|Yi - What is the bitrate for each resolution?]]** 
-  * **[[https://havecamerawilltravel.com/gopro/dji-osmo-action-video-modes/|Video Modes of the DJI Osmo Action]]** 
- 
-**NOTICE**: For bitrates of **100 Mbit/s** or above you have to consider the micro SD card performances. Recording a stream of 100 Mbit/s means writing a **sustained stream of 12 Mb/s** (megabytes/second). Checking the **speed class ratings** from the **[[wp>SD_card|Wikipedia SD card]]** page, you understand that you need at least a **V30 Video Speed Class**, or **U3 UHS Speed Class**. 
- 
-=== Bitrates GOP === 
- 
-I want at least 4 keyframes per second, so I can cut scenes without re-encoding with the precision of about 0.25 seconds. The original firmware instead put only a keyframe every second. 
- 
-^  GOP-N Values  ^^^^^^^ 
-^               FPS ^  24  ^  25  ^  30  ^  60  ^  120  ^  240  ^ 
-^ SJ8Pro Default    |   24 |   32 |   32 |   64 |   120 |   240 | 
-^ My Custom SJ8Pro  |    6 |    8 |    8 |   16 |    32 |    64 | 
- 
-=== YUV Profiles === 
- 
-For my taste the two YUV profiles are both too exagerated. The **Vivid - SJCAM** profile has **too much contrast** and colors are **too much saturated**, something that is eye-catching on a small smartphone screen, but rather disturbing on a larger and good quality screen. By contrast the **Flat** profile is so **washed-out** that you almost never want to use it. 
- 
-For the **default** and **vivid** profile I reduced the multipliers by about 6% on the luminance channel and by about 14% on the colors channels. Then I decreased the luminance offset (2%) to recover a bit of the black. For the **flat** profile I reduced the luminance multiplier by about 19%, on both the color channels the multiplier was reduced by about 21%; then I added about 2.5% to the luminance offset, to get some more white. 
- 
-The resulting two profiles are not so different from each other, may be you cannot tell them apart looking at the touch screen. This may be a problem, because of the firmware bug which does not properly show the selected profile name and which does not remember the selected profile on power-off/power-on. Neverthless you can use the flat profile when you want to have softer colors and contrast. 
- 
-^            SJCAM SJ8Pro Default   ^^^  My Custom SJ8Pro       ^^^ 
-^           ^ Default  ^ Vivid  ^ Flat  ^ Default  ^ Vivid  ^ Flat  ^ 
-^ Y             1024 |   1024 |   690 |      960 |   960 |    830 | 
-^ U             1024 |   1024 |   820 |      880 |   880 |    810 | 
-^ V             1024 |   1024 |   820 |      880 |   880 |    810 | 
-^ Y-offset  |        0 |      0 |    40 |       -5 |    -5 |      6 | 
-^ U-offset  |        0 |      0 |     0 |        0 |     0 |      0 | 
-^ V-offset  |        0 |      0 |     0 |        0 |     0 |      0 | 
- 
-=== Exposition === 
- 
-Metering tables were fixed, this simply means swapping profiles **Spot** and **Average**. 
- 
-=== Gamma curves === 
- 
-After countless experiments with the gamma curves, I decided to replace the original ones with **ascending linear lines**, i.e. **no actual gamma transformation**. There is no documentation on how the **%%*/255%%**, **%%*/128%%** and **%%*/0%%** groups are mixed together, from my experiments it seems that: 
- 
-  * Group **%%*/0%%** is not used at all. 
-  * Groups **%%*/255%%** and **%%*/128%%** are mixed togheter, but with some sort of brightness threshold, so it is very likely that you can obtain color banding if graphs curves are not accurately tuned. 
-  * It seems that in some **particular circumstances** (some color component of */255 is **very dark**) the gamma curve is replaced automatically with something different, may be a **negative** (descending) curve. 
- 
-For all that reasons, I decided to replace the curves with linear ones. It may be that I will intervene in the future if I notice any problems in the footages. 
- 
-=== Chroma curves === 
- 
-At the moment I leaved the same chroma curves as the original 1.3.2 SJCAM firmware. 
- 
- 
-=== Sounds === 
- 
-I changed the original sounds for **power-on**, **power-off** and **photo shutter** with something more audible. They are simple and loud beeps, but with different patterns, so they can be distinguished. 
- 
-=== autoexec.ash === 
- 
-I suggest to add a single line **autoexec.ash** to disable the recording of the **.LRV** (low resolution video) files into the SD card. I don't use them at all, so it is a waste of space and CPU/battery to create them. 
  
 ===== Anatomy of the Ambarella firmware ===== ===== Anatomy of the Ambarella firmware =====
Line 503: Line 407:
 === Mixing the curves === === Mixing the curves ===
  
-The first example shows the effect of creating some **disjointed theet on the three curves**; each tooth is set at the maximum value of 2048. Actually the single tooth of the curve 4k30/255 produces almos no visble effect, you can see **only three narrow bands of colors** corresponding to teeth on curves **4k30/128** and **4k30/0**:+The first example shows the effect of creating some **disjointed theet on the three curves**; each tooth is set at the maximum value of 2048. Actually the single tooth of the curve 4k30/255 produces almos no visble effect, you can see **only three narrow bands of colors** corresponding to teeth on curves **4K30/128** and **4K30/0**:
  
-{{.:ambarella:chroma-4k30-curves-separed.jpg?direct&400|}}+{{.:ambarella:chroma-4k30-curves-separed.jpg?direct&400|Chroma bands: one from 4K30/128, two from 4K30/0}}
  
 The last example is used to show how curves are **mixed together**. In this case a **wide teeth** on curve **4K30/128** is mixed with a **narrow teeth** on curve **4K30/0**. Each teeth is set to 1024 (half of the maximum), so taht the more satured color band on the overlapping region can be apreciated. The last example is used to show how curves are **mixed together**. In this case a **wide teeth** on curve **4K30/128** is mixed with a **narrow teeth** on curve **4K30/0**. Each teeth is set to 1024 (half of the maximum), so taht the more satured color band on the overlapping region can be apreciated.
  
-{{.:ambarella:chroma-4k-curves-mixed.jpg?direct&400|}}+{{.:ambarella:chroma-4k-curves-mixed.jpg?direct&400|One narrow chroma band from 4K30/0 overlapping a larger one from 4K30/128}}
  
 ===== AGC and digital gain ===== ===== AGC and digital gain =====
doc/appunti/hardware/ambarella_custom_firmware.txt · Last modified: 2022/05/05 08:26 by niccolo