Skip to content

Amachua-Appure/HDR-ScreenCapture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Recently, Apple has introduced Dolby Vision HDR Screen Recording with their latest IOS update. So I wanted to try making an for android if possible. The result? due to many restrictions the virtual display rendered by the phone is always in 8 bit sRGB even if you phone has Wide gamut support. So I made this app which tone maps on the fly to give you very high fidelty video. Until android makes it an option and if OEMs allow it to be possible, we are stuck with this method. Other than that, this app aims to provide maximum control even in post.

🎬 HDR ScreenCapture – Advanced Screen Recording for Android

A powerful, feature-rich Android screen recording application with support for HDR (PQ/HLG) encoding, 10-bit color depth and advanced audio mixing. Built with Kotlin and modern Android APIs.

✨ Key Features

πŸ“Ί Video Encoding

  • Multiple Codecs: HEVC (H.265), AVC (H.264) | Only Hardware Encoders are supported
  • HDR Support: Proper PQ (ST2084) and HLG (BT.2100) color profiles for High fidelity video | Tone Mapped because android does not allow true HDR capture yet.
  • 10-Bit Encoding: HEVC Main 10 profile with full bit-depth support
  • Flexible Resolution: 2160p(4k), 1440p, 1080p, 720p with custom orientation [Portrait/Landscape/Square (only in native resolution for max screen real estate)], Aspect Ratio of your phone is maintained across all resolutions
  • High Frame Rates: Upto 120 FPS (Modern devices use variable FPS)
  • Constant Quality Mode (CQ): Adaptive bitrate based on quality settings (fallback to CBR)

🎡 Audio Capture & Mixing

  • Dual Audio Input: Simultaneously capture device audio + microphone
  • Multiple Codecs: AAC (MP4A), Opus, FLAC, PCM (Raw)
  • Multi-Channel Mixing: Mix device and mic audio for 3 Channel or 6 Channel audio for good voice and device audio separation (aac and pcm only)

🎨 Color Science & Advanced Processing

  • SurfaceProcessor: GPU-based OpenGL pipeline for color space conversions
    • Rec.709 (SDR) passthrough
    • Rec.709 β†’ Rec.2020 (HDR primaries) with gamut mapping
    • Proper tonemapping for PQ and HLG HDR standards
  • 10-Bit to 10-Bit Processing: Maintains color fidelity end-to-end
  • EGL Configuration Detection: Automatically finds 10-bit or FP16 display configs (with fallbacks)

βš™οΈ Customization & Settings

  • Granular Settings UI: Control every aspect of recording
  • Device Capability Probing: Automatically detects supported codecs, HDR profiles, and color modes
  • Video Quality Slider: Intuitive quality vs. file size tradeoff
  • Recording Orientation: Choose portrait, landscape, or square capture *sqaure aspect ratio uses max dimension of your device native resolution (Eg: 2340x1080 -> 2340x2340) so that no scaling occurs when you switch orientation from portrait to landscape while recording. you capture full resolution of your screen

πŸ“ File Management

  • Organized Playback: Browse and manage recorded videos (Play, Rename, Share, etc)
  • Metadata: Shows detailed information of the recordings

πŸ› οΈ Developer Features

  • Debug Dashboard: View device codec capabilities, color profile support, and hardware specs to better understand your capabilites and limitations

πŸ“– Usage Guide

Basic Recording

  1. Open the app β†’ Recording tab
  2. Configure Settings:
    • Select video codec (HEVC recommended for best compression)
    • Select Audio codec (non aac codecs are stored separately due to mediamuxer limitations)
    • Choose resolution (FHD, 2K, 4K, etc.)
    • Set frame rate (60 FPS standard)
    • Enable/disable microphone or device audio
    • Pick a color profile (Default for SDR, PQ/HLG for HDR)
  3. Tap Start β†’ Tap to begin capturing
  4. Tap Stop β†’ Recording saved to device storage
  5. Browse Files β†’ View your recordings in the Files tab

Advanced Settings

Video Tab:

  • Quality: 1–100 scale (higher = better quality, larger file)
  • Codec: Switch between HEVC (better compression) or AVC (broader compatibility)
  • Resolution: Auto or manual override
  • Color Profile:
    • Default – SDR (standard 8-bit color)
    • PQ – HDR10 (luminance-preserving, cinema-grade) (Tone mapped)
    • HLG – HLG HDR (hybrid log-gamma, broadcast standard) (Tone mapped)

Audio Tab:

  • Device Audio: Enable to capture system sounds, music, etc.
  • Microphone: Enable to record voice narration (Phone or external mics)
  • Codec: AAC (universal), Opus (better quality), FLAC (lossless), PCM (Raw audio)

Advanced:

  • Toggle 10-Bit SDR (for reduced video artifacts)
  • View hardware capability details in Debug Dashboard

πŸ—οΈ Architecture

Key Classes

Class Purpose
EncoderManager Configures MediaCodec, handles video encoding with CQ/CBR modes
SurfaceProcessor OpenGL pipeline for color space conversion (SDR β†’ HDR, 8-bit β†’ 10-bit)
AudioTrackManager Manages AudioRecord, audio mixing, and synchronization
MediaProjectionService Foreground service managing screen capture lifecycle
RecordingSettings Data class storing all user-configurable parameters
DeviceProbeUtils Probes codec capabilities and color profile support

🎨 Color Science & HDR

This app implements full color-accurate video encoding:

Rec.709 (SDR)

  • Standard 8-bit sRGB β†’ bit-shifted to 10-bit (no color transformation)
  • Direct passthrough to encoder

PQ (HDR10)

  • Color Space: Rec.2020 primaries
  • Transfer Function: ST2084 (Perceptual Quantizer)
  • Tonemapping: Luminance-preserving Reinhard with gamut mapping
  • Peak Brightness: Configurable (default 960 nits)

HLG (BT.2100)

  • Color Space: Rec.2020 primaries
  • Transfer Function: Hybrid Log-Gamma (OETF)
  • Characteristics: Backward compatible with SDR displays

πŸ› οΈ Building from Source

Project Structure

Dependencies

Key libraries used:

  • Jetpack Compose – Modern UI framework
  • MediaCodec API – Hardware-accelerated encoding
  • OpenGL ES 3.0 – GPU color processing
  • Coroutines – Async/concurrent operations
  • Kotlin Serialization – Settings persistence

πŸ› Troubleshooting

Recording Fails to Start

  • Check Permissions: Ensure microphone + screen recording permissions are granted
  • Check Storage: Device must have >1 GB free space
  • Logcat: Open Android Studio β†’ Logcat tab, filter by RecordingScreen or EncoderManager

Encoding Quality Issues

  • Blurry Output: Increase quality slider or lower resolution
  • Codec Not Supported: Use Debug Dashboard to check device capabilities; fallback to AVC
  • Low Frame Rate: Some devices can't sustain 60+ FPS; check Debug Dashboard for hardware limits

HDR Not Working

  • Not all devices support HDR encoding. Use Device Debug Screen to verify:
    • Is KEY_COLOR_TRANSFER supported?
    • Does the device have a 10-bit codec (HEVC Main 10)?
  • If not supported, fall back to SDR (Rec.709)

πŸ“Š Performance Notes

Tips for Best Performance:

  1. Close background apps – Reduces system load
  2. Use AVC SDR 8bit – Better compatibilty across devices and reduced load
  3. Lower quality for longer recordings – Balances file size
  4. Avoid High resolutions/FPS values – Causes throttling on most devices

Tips for Best Quality:

  1. Use HEVC – Better compression
  2. Use 10bit SDR or HDR - Better Visual fidelity
  3. Higher Resolution/FPS – Negligible increase in quality on most apps but gives you better quality in general
  4. Use other audio codecs – Use Opus if you want compressed but Higher Quality and FLAC/PCM for the absolute best audio quality.

πŸ“ License

This project uses the Google Sans font family, licensed under the SIL Open Font License (OFL 1.1). See OFL.txt for details. All source code is provided as-is for educational and professional use.


🀝 Contributing

Found a bug? Have a feature request? Feel free to:

  1. Open an Issue – Describe the problem or feature
  2. Submit a PR – Fork, branch, code, and submit a pull request

For major changes, please open an issue first to discuss.


πŸ“š References & Inspiration

  • MediaCodec API: Android Developers
  • HDR Standards: ST2084 (PQ), BT.2100 (HLG) specifications
  • OpenGL ES: Modern GPU rendering techniques
  • Jetpack Compose: Declarative UI framework

About

Advanced Android Screen recording app that aims at giving users the maximum control over the recording

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages