Stream overlay (text, logo) for mobile device streaming

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Stream overlay (text, logo) for mobile device streaming
Medium
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    757
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    874
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Stream Overlays: Text and Logo on Mobile Stream

Overlay a logo on stream seems simple — until you realize overlay must render not to screen but directly into video stream before encoder. UIKit/SwiftUI views don't help here: they draw in display pipeline unrelated to CVPixelBuffer going to VideoToolbox.

Where to Insert Overlay Correctly

Pipeline looks like:

AVCaptureVideoDataOutput → CMSampleBuffer → CVPixelBuffer → [overlay] → H.264 encoder → RTMP/SRT

Overlay applied to CVPixelBuffer before encoder. Two ways:

Metal (recommended). Create MTLTexture from CVPixelBuffer via CVMetalTextureCacheCreateTextureFromImage, render overlay on top via Metal render pass, write result back to CVPixelBuffer. Runs on GPU — CPU load minimal.

CoreImage. Use CISourceOverCompositing filter: overlay CIImage logo on CIImage from CMSampleBuffer. Simpler code, but on iPhone 12 and older at 1080p30 adds 4–6ms to frame processing on main CPU — on edge of drop.

For production projects with 1080p30 without drops requirement — only Metal.

Metal Implementation

class OverlayRenderer {
    private let device: MTLDevice
    private let commandQueue: MTLCommandQueue
    private var textureCache: CVMetalTextureCache?
    private var overlayTexture: MTLTexture? // pre-loaded logo

    func apply(to pixelBuffer: CVPixelBuffer) -> CVPixelBuffer {
        var cvTexture: CVMetalTexture?
        CVMetalTextureCacheCreateTextureFromImage(
            nil, textureCache!, pixelBuffer, nil,
            .bgra8Unorm,
            CVPixelBufferGetWidth(pixelBuffer),
            CVPixelBufferGetHeight(pixelBuffer),
            0, &cvTexture
        )
        guard let texture = CVMetalTextureGetTexture(cvTexture!) else { return pixelBuffer }

        let commandBuffer = commandQueue.makeCommandBuffer()!
        // render pass: main texture + overlayTexture on top
        // ...
        commandBuffer.commit()
        commandBuffer.waitUntilCompleted()
        return pixelBuffer // modified in-place
    }
}

Load logo (overlayTexture) once on session start from PNG with alpha channel. Don't load UIImage per frame — 2–3ms allocation overhead per call.

Text Overlays: Separate Problem

Static text (channel name) — just Metal texture prepared once via CoreText. Problem with dynamic text: viewer count, timer, donation messages. Can't render via Metal directly — Metal doesn't work with text, only geometry and textures.

Solution: create offscreen CALayer with CATextLayer, render to UIGraphicsImageRenderer, get UIImage, convert to MTLTexture. Do in background thread no more than once per 500ms for counters and on event for donation messages. On screen text updates smoothly, in stream goes without delay.

Android: Analogous Approach via OpenGL ES / Vulkan

Android equivalent — SurfaceTexture + OpenGL ES 2.0. Camera renders to SurfaceTexture, overlay via GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA), result goes to MediaCodec via Surface. Vulkan more powerful but supported from Android 7+ and requires significantly more boilerplate — justified only with complex effects.

Overlay Positioning and Adaptation

Store logo position as relative coordinates (0.0–1.0 of frame size), not absolute pixels. Allows correct work on resolution or orientation change without logic recalculation. On landscape rotation — recalculate overlayRect in Metal render pass automatically.

Fade-in/fade-out for donation text via alpha channel change in MTLTexture between frames — smooth appearance over 15–20 frames (0.5–0.7 seconds).

Timeline

Static logo + Metal pipeline on iOS: 1–1.5 weeks. Dynamic text, overlay animations, iOS + Android support: 3–4 weeks. Cost calculated individually.