[MOD] Custom camera HAL with 4K UHD/DCI and 30 FPS video recording [Apr. 22, 2016]

Search This thread

Sultanxda

Recognized Developer
Code:
/*
* Your warranty is... still valid?
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this mod
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*
*/

Installing this mod will give you the ability to record 4K UHD/DCI videos on your OnePlus X, as well as record videos at a consistent 30 frames per second in all lighting conditions (no more frame drops/stuttering when recording videos at night). This mod is compatible with most ROMs.

This is a custom camera HAL I created using CAF's vanilla camera HAL sources. As a lot of reverse engineering was involved in this, there are some caveats (see below).

Do NOT install this on my CM13 ROM!

Note that some ROMs using older proprietary camera libraries (such as the newest version of H2OS) will not benefit from 30 FPS video or my anti-shake algorithm.

If the 4K option does not appear in the camera app you're using, or your camera stops working, then clear data for the camera app that you're using.


Notable features:
  • 4K UHD and DCI video recording
  • Consistent 30 FPS video recording in all lighting conditions
  • Intelligent anti-shake algorithm (significantly reduces motion blur when capturing photos)
  • Faster autofocus in low lighting conditions
  • No stuttering in camera viewfinder
  • Improved photo quality
  • Photo capture up to 4208x3120 resolution (instead of 4160x3120)

Caveats:
  • No ClearImage
  • No manual mode only in the OnePlus Camera app (other apps that support manual ISO and manual exposure work fine)

Installation instructions:
Install the 60 Hz Anti-banding file if you are in any of the following countries:

American Samoa
Anguilla
Antigua
Aruba
Bahamas
Belize
Bermuda
Brazil
Canada
Cayman Islands
Colombia
Costa Rica
Cuba
Dominican Republic
Ecuador
El Salvador
Guam
Guatemala
Guyana
Haiti
Honduras
Liberia
Mexico
Micronesia
Montserrat Islands
Nicaragua
Okinawa
Palmyra Atoll
Panama
Peru
Philippines
Puerto Rico
St. Kitts & Nevis Islands
Saudi Arabia
South Korea
Suriname
Tahiti
Taiwan
Trinidad & Tobago
United States
Venezuela
Virgin Islands


Instructions:
  1. Download the camera HAL and copy it to your device
  2. Reboot to recovery
  3. Install the camera HAL
  4. OPTIONAL install the 60 Hz Anti-banding file ONLY if you are in any of the countries listed above
  5. Reboot

Downloads:
Camera HAL: http://xdaforums.com/devdb/project/dl/?id=18115

60 Hz Anti-banding: http://xdaforums.com/devdb/project/dl/?id=17356


XDA:DevDB Information
Custom camera HAL for OPX, Device Specific App for the OnePlus X

Contributors
Sultanxda

Version Information
Status: Stable

Created 2016-02-15
Last Updated 2016-08-10
 
Last edited:

Sultanxda

Recognized Developer
Changelog:

April 22, 2016:
*Fixed slow-motion recording in the OnePlus Camera app (for OxygenOS)
*Fixed delay when moving camera while recording high-speed and slow-motion videos
*Fewer frames are dropped when recording high-speed and slow-motion videos now

April 20, 2016:
*Fixed blue tint when recording slow-motion and high-speed videos (60 FPS and 120 FPS videos)

April 17, 2016:
*Made anti-shake algorithm even less aggressive (images are less noisy and better quality now)

March 26, 2016:
*Made anti-shake algorithm less aggressive (images are less noisy and better quality now)
*Reduced JPEG quality to 95% (image files are smaller with no visible impact to quality)
*Improved image clarity

March 13, 2016:
*Fixed anti-banding setting in camera apps
*Set default anti-banding mode to 50 Hz (for Europe)
*Added flashable zip to change default anti-banding mode to 60 Hz (for the USA; see the installation instructions for details)
*Fixed rare flashing in camera viewfinder

March 7, 2016:
*Fixed graphical glitches when using HDR
*Fixed graphical glitches when taking photos with the front camera
*Fixed many other minor bugs

March 6, 2016:
*Fixed noisy HDR photos
*Fixed incorrect maker, model, and aperture displayed in image info

March 5, 2016:
*Fixed HDR
*Fixed manual exposure control
*Fixed manual ISO control

February 26, 2016:
*Implemented stronger, more intelligent anti-shake algorithm (significantly reduces motion blur when capturing photos)
*Fixed Panorama mode not working in Google Camera after recording video
*Fixed Photo Sphere mode not working in Google Camera after recording video
*Fixed photo capture not working while recording 4K video

February 22, 2016:
*Fixed compatibility with H2OS (note: 30 FPS video is not guaranteed in H2OS, as well as some out-of-date ROMs)
*Fixed long delay when turning off the flashlight in some ROMs
*Fixed long delay when switching between the front and back camera in some ROMs
*Improved image sharpness and clarity

February 16, 2016:
*Fixed compatibility with all ROMs

February 15, 2016:
*Initial release
 
Last edited:

Sultanxda

Recognized Developer
will test this soon and hope it works. you will be saviour for us.

I tested it on CM12.1 and OxygenOS 2.2.0, and it appears to be working. Tested 4k UHD recording in Google Camera and it works.

The 4k video option won't show up in the OxygenOS camera app until you clear data for the app.

Let's see how this goes :silly:
 

saurabh40629

Senior Member
Sep 1, 2014
1,090
477
I tested it on CM12.1 and OxygenOS 2.2.0, and it appears to be working. Tested 4k UHD recording in Google Camera and it works.

The 4k video option won't show up in the OxygenOS camera app until you clear data for the app.

Let's see how this goes :silly:
Because of Enormously crappy camera videos, I was having thoughts of selling this one. Seems like my money is saved. Kudos to you. :highfive:
 

mieru

Senior Member
Aug 7, 2009
272
77
Flashed on temasek v4.0 and had a bootloop after that. Needed to reflash the rom.
 

Sultanxda

Recognized Developer
If the camera had the capability to record to 4k,why didn't one plus include it in oos?

They didn't know how to fix it. There's a software bug with 4k on Snapdragon 800/801 chips that causes the 4k video to record at 7 FPS. This is a very difficult bug to fix (took me weeks to originally fix it on my OPO), so it isn't surprising that they decided to move on to other things instead of trying to solve it.

Flashed on temasek v4.0 and had a bootloop after that. Needed to reflash the rom.

The media_profiles.xml that comes with my package probably has some things in it that your ROM doesn't like. I'll have to test it myself to get a log so I can fix it.

Holy crap the legendary sultan developing for the one x?!?! Any plans for a oneplus x rom as well?

Not enough time/energy/motivation for that right now. Have a camera HAL instead :p
 
Last edited:

rockuppl

Senior Member
May 6, 2013
181
69
New Delhi
They didn't know how to fix it. There's a software bug with 4k on Snapdragon 800/801 chips that causes the 4k video to record at 7 FPS. This is a very difficult bug to fix (took me weeks to originally fix it on my OPO), so it isn't surprising that they decided to move on to other things instead of trying to solve .

Don't they scout for talent on these Developer forum's if they have such dumb people sitting and developing ? :p

I heard a lot about you from my colleagues on OPO( obviously positive things :D)..... Welcome here :fingers-crossed::good:
 
  • Like
Reactions: jonas2790 and Ankru

ckret

Senior Member
Sep 22, 2010
603
541
Don't they scout for talent on these Developer forum's if they have such dumb people sitting and developing ? :p

I heard a lot about you from my colleagues on OPO( obviously positive things :D)..... Welcome here :fingers-crossed::good:

they already looked for sultan
but since he hasnt grad yet they didnt hire
edit: well thats what they said on AMA
 

taaeem

Senior Member
Feb 22, 2014
1,013
642
Hamburg
Morning
Any open-source plans? Or can't you share because of reverse engineering? Will test soon

EDIT: UHD works fine and everything else also good work
 
Last edited:

Loureiro

Senior Member
Aug 6, 2011
808
427
Alentejo
Xiaomi Redmi Note 5 Pro
Nailed it!

@Sultanxda, add to the 1st post that slowmotion mode on OOS camera app won't perform as expected. Didn't tested much, but it seems it is recording at 30fps.

It does not bothers me at all. Being possible to record at night is a big step forward.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 175
    Code:
    /*
    * Your warranty is... still valid?
    *
    * I am not responsible for bricked devices, dead SD cards,
    * thermonuclear war, or you getting fired because the alarm app failed. Please
    * do some research if you have any concerns about features included in this mod
    * before flashing it! YOU are choosing to make these modifications, and if
    * you point the finger at me for messing up your device, I will laugh at you.
    *
    */

    Installing this mod will give you the ability to record 4K UHD/DCI videos on your OnePlus X, as well as record videos at a consistent 30 frames per second in all lighting conditions (no more frame drops/stuttering when recording videos at night). This mod is compatible with most ROMs.

    This is a custom camera HAL I created using CAF's vanilla camera HAL sources. As a lot of reverse engineering was involved in this, there are some caveats (see below).

    Do NOT install this on my CM13 ROM!

    Note that some ROMs using older proprietary camera libraries (such as the newest version of H2OS) will not benefit from 30 FPS video or my anti-shake algorithm.

    If the 4K option does not appear in the camera app you're using, or your camera stops working, then clear data for the camera app that you're using.


    Notable features:
    • 4K UHD and DCI video recording
    • Consistent 30 FPS video recording in all lighting conditions
    • Intelligent anti-shake algorithm (significantly reduces motion blur when capturing photos)
    • Faster autofocus in low lighting conditions
    • No stuttering in camera viewfinder
    • Improved photo quality
    • Photo capture up to 4208x3120 resolution (instead of 4160x3120)

    Caveats:
    • No ClearImage
    • No manual mode only in the OnePlus Camera app (other apps that support manual ISO and manual exposure work fine)

    Installation instructions:
    Install the 60 Hz Anti-banding file if you are in any of the following countries:

    American Samoa
    Anguilla
    Antigua
    Aruba
    Bahamas
    Belize
    Bermuda
    Brazil
    Canada
    Cayman Islands
    Colombia
    Costa Rica
    Cuba
    Dominican Republic
    Ecuador
    El Salvador
    Guam
    Guatemala
    Guyana
    Haiti
    Honduras
    Liberia
    Mexico
    Micronesia
    Montserrat Islands
    Nicaragua
    Okinawa
    Palmyra Atoll
    Panama
    Peru
    Philippines
    Puerto Rico
    St. Kitts & Nevis Islands
    Saudi Arabia
    South Korea
    Suriname
    Tahiti
    Taiwan
    Trinidad & Tobago
    United States
    Venezuela
    Virgin Islands


    Instructions:
    1. Download the camera HAL and copy it to your device
    2. Reboot to recovery
    3. Install the camera HAL
    4. OPTIONAL install the 60 Hz Anti-banding file ONLY if you are in any of the countries listed above
    5. Reboot

    Downloads:
    Camera HAL: http://xdaforums.com/devdb/project/dl/?id=18115

    60 Hz Anti-banding: http://xdaforums.com/devdb/project/dl/?id=17356


    XDA:DevDB Information
    Custom camera HAL for OPX, Device Specific App for the OnePlus X

    Contributors
    Sultanxda

    Version Information
    Status: Stable

    Created 2016-02-15
    Last Updated 2016-08-10
    49
    Changelog:

    April 22, 2016:
    *Fixed slow-motion recording in the OnePlus Camera app (for OxygenOS)
    *Fixed delay when moving camera while recording high-speed and slow-motion videos
    *Fewer frames are dropped when recording high-speed and slow-motion videos now

    April 20, 2016:
    *Fixed blue tint when recording slow-motion and high-speed videos (60 FPS and 120 FPS videos)

    April 17, 2016:
    *Made anti-shake algorithm even less aggressive (images are less noisy and better quality now)

    March 26, 2016:
    *Made anti-shake algorithm less aggressive (images are less noisy and better quality now)
    *Reduced JPEG quality to 95% (image files are smaller with no visible impact to quality)
    *Improved image clarity

    March 13, 2016:
    *Fixed anti-banding setting in camera apps
    *Set default anti-banding mode to 50 Hz (for Europe)
    *Added flashable zip to change default anti-banding mode to 60 Hz (for the USA; see the installation instructions for details)
    *Fixed rare flashing in camera viewfinder

    March 7, 2016:
    *Fixed graphical glitches when using HDR
    *Fixed graphical glitches when taking photos with the front camera
    *Fixed many other minor bugs

    March 6, 2016:
    *Fixed noisy HDR photos
    *Fixed incorrect maker, model, and aperture displayed in image info

    March 5, 2016:
    *Fixed HDR
    *Fixed manual exposure control
    *Fixed manual ISO control

    February 26, 2016:
    *Implemented stronger, more intelligent anti-shake algorithm (significantly reduces motion blur when capturing photos)
    *Fixed Panorama mode not working in Google Camera after recording video
    *Fixed Photo Sphere mode not working in Google Camera after recording video
    *Fixed photo capture not working while recording 4K video

    February 22, 2016:
    *Fixed compatibility with H2OS (note: 30 FPS video is not guaranteed in H2OS, as well as some out-of-date ROMs)
    *Fixed long delay when turning off the flashlight in some ROMs
    *Fixed long delay when switching between the front and back camera in some ROMs
    *Improved image sharpness and clarity

    February 16, 2016:
    *Fixed compatibility with all ROMs

    February 15, 2016:
    *Initial release
    42
    New build uploaded. All of the major caveats have been fixed! HDR, manual ISO, and manual exposure are all working now :victory:
    28
    New build uploaded. In addition to bug fixes in Google Camera, I have written a smarter/stronger anti-shake algorithm that makes it much easier to capture clear photos indoors or in poor lighting conditions in general.

    Please let me know how it goes :)
    26
    If the camera had the capability to record to 4k,why didn't one plus include it in oos?

    They didn't know how to fix it. There's a software bug with 4k on Snapdragon 800/801 chips that causes the 4k video to record at 7 FPS. This is a very difficult bug to fix (took me weeks to originally fix it on my OPO), so it isn't surprising that they decided to move on to other things instead of trying to solve it.

    Flashed on temasek v4.0 and had a bootloop after that. Needed to reflash the rom.

    The media_profiles.xml that comes with my package probably has some things in it that your ROM doesn't like. I'll have to test it myself to get a log so I can fix it.

    Holy crap the legendary sultan developing for the one x?!?! Any plans for a oneplus x rom as well?

    Not enough time/energy/motivation for that right now. Have a camera HAL instead :p