NewLife.JT1078 1.0.2026.1022-beta0159

This is a prerelease version of NewLife.JT1078.
dotnet add package NewLife.JT1078 --version 1.0.2026.1022-beta0159
                    
NuGet\Install-Package NewLife.JT1078 -Version 1.0.2026.1022-beta0159
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NewLife.JT1078" Version="1.0.2026.1022-beta0159" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NewLife.JT1078" Version="1.0.2026.1022-beta0159" />
                    
Directory.Packages.props
<PackageReference Include="NewLife.JT1078" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NewLife.JT1078 --version 1.0.2026.1022-beta0159
                    
#r "nuget: NewLife.JT1078, 1.0.2026.1022-beta0159"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NewLife.JT1078@1.0.2026.1022-beta0159
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NewLife.JT1078&version=1.0.2026.1022-beta0159&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NewLife.JT1078&version=1.0.2026.1022-beta0159&prerelease
                    
Install as a Cake Tool

NewLife.JT1078

GitHub License Nuget Downloads Nuget Nuget (with prereleases) NativeAOT test TFM locales platform

🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية

A .NET implementation of the JT/T 1078 video communication protocol for road transport satellite positioning systems. It covers the full pipeline of protocol parsing, audio/video codecs, FLV/fMP4 remuxing, TCP/UDP servers, and HTTP/WebSocket live streaming. NativeAOT and runtime localization are supported.

Features

Protocol

  • JT1078 RTP protocol: complete RTP message parsing and building with 29 audio/video payload types
  • Frame framing: sticky-packet splitting and header-first parsing built on NewLife.Core IMessageCodec
  • RTP fragment merging: automatic buffering and merging of I/P/B frame fragments

Audio and video codecs

  • Audio decoding: G.711A (A-law), G.711U (μ-law), IMA-ADPCM, with HiSilicon header stripping
  • AAC encoding: AAC encoding via FaacEncoder (P/Invoke)
  • H.264 parsing: NAL unit splitting, SPS/PPS parsing, start-code handling, emulation-prevention byte removal

Container remuxing

  • FLV remuxing: real-time RTP to HTTP-FLV / WebSocket-FLV for flv.js playback
  • fMP4 remuxing: CMAF/fMP4 segment output with core ISO BMFF boxes

Server

  • TCP service: out-of-the-box JT1078 TCP server with port configuration and debug logging
  • UDP service: JT/T 1078 UDP transport coexisting with TCP
  • HTTP/WS live streaming: built-in ASP.NET Core endpoints for FLV/fMP4/AAC/PCM/WAV
  • Playback: historical audio/video playback by SIM, channel and time range
  • Device commands: cluster command bus based on IEventBus, standalone or Redis cluster

Management and integration

  • Device presence: real-time tracking of terminal connect/disconnect events
  • Stream authorization: token authentication protecting live endpoints
  • DI builder: AddJT1078Gateway().AddTcp().AddHttp() fluent registration
  • IHostedService: automatic ASP.NET Core lifecycle management
  • NativeAOT: reflection-free protocol and localization tables, native image verified by smoke test
  • Localization: English source messages with 10 bundled translations and English fallback

Quick Start

Install NuGet packages

dotnet add package NewLife.JT1078           # core protocol library (includes FLV/fMP4 remuxing)
dotnet add package NewLife.JT1078.Server    # TCP/UDP server + HLS/MP3

Parse an RTP message

using System.Buffers;
using NewLife.JT1078.Protocols;

// Frame framing: a message is produced as soon as the header arrives; the body is bound by the frame layer
var codec = new JTCodec();
var result = codec.TryParse(new ReadOnlySequence<Byte>(data));
if (result is { Invalid: false } rs && rs.Message is JTMessage msg)
{
    // Inspect the payload type
    if (msg.Type == AVTypes.H264)
    {
        var decoder = new H264Decoder();
        var frame = decoder.ParseAVFrame(msg);
    }
}

Audio decoding

using NewLife.Audio;

var factory = new AudioCodecFactory();
// Device payload -> PCM
var pcm = factory.ToPcm(NewLife.Audio.AVTypes.ADPCMA, packet);
// PCM -> G.711A
var g711a = factory.FromPcm(NewLife.Audio.AVTypes.G711A, pcm);

Start the streaming server

using NewLife.JT1078.Server;

// Option 1: use directly
var server = new JT1078Server();
server.Start();

// Option 2: ASP.NET Core integration
builder.Services.AddJT1078Gateway()
       .AddTcp()
       .AddHttp();

NuGet Packages

Package Description NuGet
NewLife.JT1078 Core protocol + codecs + FLV/fMP4 remuxing (Flv/FMp4 merged into the core) NuGet
NewLife.JT1078.Server TCP/UDP server + DI builder + HLS/MP3 encoding NuGet

Native AOT

The core protocol library and the server under default configuration support NativeAOT and trimming. The AOT/trim analyzers are always enabled for net8.0 and later targets with zero IL warnings at build time. The AotSmoke project in this repository publishes a native image in CI with PublishAot=true and exercises frame codecs, model reflection serialization, DI assembly, server assembly and localization lookups.

dotnet publish AotSmoke/AotSmoke.csproj -c Release -r linux-x64 -p:PublishAot=true -o out
./out/AotSmoke

Plugins, dynamic scripting and runtime reflection registration are outside the AOT support boundary (consistent with NewLife.Core).

Localization

Exceptions and logs share a compile-time generated localization table. It follows CultureInfo.CurrentUICulture by default and falls back to English when a translation is missing. No resx or satellite assemblies are involved: a single DLL, natively AOT-safe.

Setting Purpose
CultureInfo.CurrentUICulture Default language source; ASP.NET Core can vary it per request
Localization.Culture Forces the language for exceptions and regular text
Localization.LogCulture Language of developer-facing text (logs, configuration comments)
// Site-wide Chinese
Localization.Culture = new CultureInfo("zh-CN");

// Web service honoring Accept-Language per request
using var culture = RequestCultureScope.Create(Request.Headers.AcceptLanguage);

Bundled translations: zh-Hans, zh-Hant, es, de, ja, fr, pt, ru, ko, ar. To add a language, map English source strings to translations in Locales/<culture>.yml; the source generator validates, compresses and registers the table at build time.

Build and Test

dotnet test -c Release

Tests cover frame codec framing/building, multi-segment sequences, invalid frames, message fragment merging, BCD serialization, audio codecs, H.264 parsing, FLV/fMP4 packaging, server protocol mode and localization tables.

Architecture

JT1078 device (TCP/UDP:1078)
    │
    ▼
NewLife.JT1078.Server ─── JT1078Session / JT1078UdpSession
    │  RTP fragment merging
    ▼
JTMessage (RTP message)
    ├──► H264Decoder (video)
    ├──► AudioCodecFactory (audio)
    │
    ├──► FlvEncoder ──────────► HTTP-FLV / WS-FLV
    ├──► FMp4Encoder ────────► fMP4
    ├──► HlsHandler / TSMuxer ──► HLS (/hls.m3u8)
    ├──► Mp3Handler ─────────► MP3 audio
    ├──► audio handlers ──────► AAC / PCM / WAV
    │
    ├──► DeviceSessionManager ──► cluster command broadcast (IEventBus)
    │
    ▼
Player (flv.js / hls.js)

Cluster Deployment

The server supports multi-instance deployment and forwards device commands across instances through an event bus:

// Standalone (default, in-memory EventBus)
services.AddJT1078Gateway().AddTcp().AddHttp();

// Cluster (provide ICacheProvider via Redis/Stardust)
// A Redis EventBus is created automatically and commands are broadcast to all instances

REST API:

  • POST /Command/Send: send a command to a device synchronously, automatically routed to the instance holding the device
  • POST /Command/SendAsync: send a command asynchronously with CancellationToken support
  • GET /Command/Devices: list locally connected devices (TCP/UDP)

Live Endpoints

Endpoint Format Transport Player
/live.flv FLV HTTP / WebSocket flv.js
/live.mp4 fMP4 HTTP / WebSocket native MSE
/live.aac AAC HTTP native audio
/live.pcm PCM HTTP native audio
/live.wav WAV HTTP native audio
/live.mp3 MP3 HTTP native audio
/hls.m3u8 + /hls.ts HLS (MPEG-TS) HTTP hls.js

Protocol References

  • JT/T 1078-2016, Road transport vehicles satellite positioning system - Video communication protocol
  • ISO 14496-12 (ISO BMFF)
  • Adobe Flash Video (FLV)

Acknowledgements

The design and implementation of this project refer to the open-source project SmallChi/JT1078. Many thanks.

Ecosystem Map

NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared verbatim by every NewLife repository; each project links to its repository and its primary NuGet package.

Project What it does Downloads
Foundation
NewLife.Core Logging, configuration, caching, networking, serialization, scheduling and APM tracing. NuGet
NewLife.XCode Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. NuGet
NewLife.Net High-performance network library: 1.77M pps / 14.5 Gbps on a single machine (TCP 1KB, 2026-10), 4M long-lived TCP connections. NuGet
NewLife.Remoting Protocol communication and RPC framework for client/server applications and IoT devices. NuGet
NewLife.Agent Installs .NET applications as OS daemons: Windows services and Linux systemd. NuGet
NewLife.Templates dotnet new project templates for console, web, API, service, data and IoT projects. NuGet
Data & Messaging
NewLife.Redis Redis client with microsecond latency, millions of ops/s and built-in message queues. NuGet
NewLife.RocketMQ Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. NuGet
NewLife.MQTT MQTT client and server, including Alibaba Cloud IoT connectivity. NuGet
NewLife.NovaDb Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. NuGet
NewLife.MySql MySql driver and helper layer built on the NewLife data stack. NuGet
Web, AI & Distributed
NewLife.Cube Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. NuGet
Stardust Distributed service platform: node management, APM, configuration center, registry and release center. NuGet
AntJob Distributed task and real-time data scheduling platform with sharding, retries and backfill. NuGet
NewLife.AI Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. NuGet
Industrial & IoT
NewLife.IoT IoT standard library defining protocol contracts and device abstractions. NuGet
NewLife.Modbus Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. NuGet
NewLife.Siemens Siemens PLC protocol on top of NewLife.IoT. NuGet
NewLife.Omron Omron PLC protocol on top of NewLife.IoT. NuGet
NewLife.Melsec Mitsubishi Melsec PLC protocol on top of NewLife.IoT. NuGet
NewLife.OPC OPC client for industrial data access. —
NewLife.BACnet BACnet building-automation protocol stack. NuGet
ZeroIoT Lightweight open-source IoT platform with gateway and device management. —
Vehicle Telematics
NewLife.JT808 JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. NuGet
NewLife.JT809 JT/T 809 platform-to-platform protocol for transport authorities. NuGet
NewLife.JT1078 JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. NuGet
Domain Components
NewLife.Office One package for Excel, Word, PPT, PDF and 15+ document formats. NuGet
NewLife.Audio Cross-platform audio: codecs, device I/O, DSP, containers and streaming. NuGet
NewLife.Video Video codecs, container formats, frame processing and streaming. NuGet
NewLife.Map Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. NuGet
NewLife.IP IPv4 geolocation with an offline memory-mapped database and an online API fallback. NuGet
Tools & Products
CrazyCoder Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. NuGet
GitCandy Self-hosted Git source code management system. —
LuckyClover Installs the matching .NET runtime automatically when launched from an older host. —

Badges show the primary package of each project; theme, extension and satellite packages are listed on their NuGet pages. The 30+ packages not listed here (FTP, LoRa, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com.

Team

<img src="https://newlifex.com/logo.png" width="48" align="right" alt="NewLife" />

Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (34 of them core to this map), and delivers integrated software and hardware solutions for power, logistics, healthcare, industrial control and internet industries. We live by the motto "learning has no seniority — mastery earns respect".

Open-source components have been downloaded 6.48M times from NuGet (ecosystem-wide, as of 2026-10).

Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX

<details> <summary>WeChat Official Account: 智能大石头 (scan to follow)</summary>

智能大石头

</details>

License

MIT © 2022-2026 NewLife

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NewLife.JT1078:

Package Downloads
NewLife.JT1078.Server

基于NewLife.Net的JT1078 TCP服务端,支持RTP分包合并和设备会话管理

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2026.1022-beta0159 0 10/22/2026
1.0.2026.1020-beta0648 36 10/20/2026

v1.0 正式版:RTP协议解析、G711/ADPCM编解码、H.264解析、FLV/fMP4转封装、集群命令下发总线;支持 AOT 与多语言