---
title: "Transmuxing: muxing, remuxing and transcoding explained"
url: https://recursiveai.org/onemedia/articles/muxing-remuxing-transmuxing/
description: "Run an MP4-to-TS example in C# and read the report for framing changes, timestamps and metadata the destination cannot keep."
date: 2026-11-16
author: OneMedia team
---

# Transmuxing: muxing, remuxing and transcoding explained

Run an MP4-to-TS example in C# and read the report for framing changes, timestamps and metadata the destination cannot keep.

November 16, 2026 · OneMedia team

**Transmuxing changes a media container without re-encoding its audio or video.** Muxing packages encoded tracks into a container; remuxing reads an existing container and packages its tracks again. Transcoding decodes a stream and encodes it again.

OneMedia is a free, open-source .NET library from Recursive AI for reading, writing and repackaging media containers without decoding audio or video ([MIT or Apache-2.0](https://licenses.nuget.org/MIT%20OR%20Apache-2.0)). [NuGet](https://www.nuget.org/packages/RecursiveAI.OneMedia/1.0.2) · [GitHub](https://github.com/recursive-ai-oss/onemedia-csharp).

[Jump to the C# example](#csharp-example)

## MP4 to TS in C# with OneMedia

The following console program uses [RecursiveAI.OneMedia 1.0.2](https://www.nuget.org/packages/RecursiveAI.OneMedia/1.0.2). It remuxes `input.mp4` to `output.ts` and prints the report. It overwrites an existing `output.ts`; keep the original input.

*Terminal · Shell*

```
dotnet new console -n TransmuxVideo
cd TransmuxVideo
dotnet add package RecursiveAI.OneMedia --version 1.0.2
```

Use an MP4 containing supported tracks. To make a two-second local H.264/AAC input instead, run this command with an FFmpeg build that includes `libx264`. This command encodes the input clip; the C# operation below only remuxes it.

*Terminal · Shell*

```
ffmpeg -hide_banner -loglevel error -y \
  -f lavfi -i testsrc2=size=320x180:rate=25 \
  -f lavfi -i sine=frequency=440:sample_rate=48000 \
  -t 2 -c:v libx264 -pix_fmt yuv420p -bf 0 \
  -c:a aac -b:a 96k input.mp4
```

Replace `Program.cs` with:

*Program.cs · .NET 10*

```
using System;
using RecursiveAI.OneMedia.Remuxing;
 
var report = Remuxer.Remux(
    "input.mp4", "output.ts", RemuxFormat.MpegTs,
    new RemuxOptions { AllowDrop = false, Overwrite = true });
 
Console.WriteLine(report);
foreach (var track in report.Tracks)
    Console.WriteLine($"Track {track.InputTrack} -> {track.OutputTrack}: {track.Packets} packets");
foreach (string change in report.Changes)
    Console.WriteLine($"Change: {change}");
foreach (var loss in report.Losses)
    Console.WriteLine($"Loss: {loss}");
```

*Terminal · Shell*

```
dotnet run
```

The five losses are expected for this generated clip: the encoder-name tag, each track’s default-selection flag, and each track’s bitrate information are not carried into TS.

Output for the generated clip:

*Output · dotnet run*

```
Remuxed: 2 tracks written, 5 losses (see Losses)
Track 0 -> 0: 50 packets
Track 1 -> 1: 95 packets
Change: Input track 0: packet bytes differ from the input by design: length prefixes became Annex B start codes, and the parameter sets from the avcC record are written in-band before keyframes that lack them (plus an access unit delimiter in front of each access unit, unless switched off).
Change: Input track 1: packet bytes differ from the input by design: an ADTS header was added in front of each AAC access unit.
Change: Input track 1: times were moved by -1024/48000 s, the start of its first edit and its priming, because a transport stream has no edit list.
Loss: RemuxLoss { Kind = Tag, Reason = NotWritten, InputTrack = -1, Subject = ilst, Detail = 1 tags: ©too. }
Loss: RemuxLoss { Kind = Disposition, Reason = NotRepresentable, InputTrack = 0, Subject = Default, Detail = A transport stream has no field for track dispositions. }
Loss: RemuxLoss { Kind = CodecField, Reason = NotRepresentable, InputTrack = 0, Subject = btrt, Detail = The muxer does not write these sample entry boxes (colour, field order, clean aperture, HDR metadata). }
Loss: RemuxLoss { Kind = Disposition, Reason = NotRepresentable, InputTrack = 1, Subject = Default, Detail = A transport stream has no field for track dispositions. }
Loss: RemuxLoss { Kind = CodecField, Reason = NotRepresentable, InputTrack = 1, Subject = btrt, Detail = The muxer does not write these sample entry boxes (colour, field order, clean aperture, HDR metadata). }
```

`AllowDrop = false` prevents a wanted track that the destination refuses from being left out: the operation throws instead. It does *not* guarantee that all metadata survives. The [remux options](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/remux.md#choosing-and-dropping-tracks) distinguish track refusal from other losses.

The practical rule is to inspect the codecs before choosing the operation. If the destination can carry the existing codecs, a container change may be enough. If the codec or the decoded picture or sound must change, transmuxing alone cannot do it. [Mux’s transmuxing glossary](https://www.mux.com/video-glossary/transmultiplexing-transmuxing) describes the container-only operation, and [FFmpeg’s transcoding documentation](https://ffmpeg.org/ffmpeg.html#Transcoding) describes the decode-and-encode path.

## Muxing, remuxing and transmuxing

These terms describe different parts of the workflow, not three competing video codecs:

- **Muxing:** a muxer accepts encoded packets for one or more tracks, interleaves them as needed and writes the container. It can receive packets from an encoder or from a demuxer. See [FFmpeg’s component definitions](https://ffmpeg.org/ffmpeg.html#Detailed-description).
- **Remuxing:** a demuxer reads an existing container and passes its encoded packets to a muxer. In OneMedia, the remux layer copies compressed payloads and adapts framing, configuration records and timing for the destination. See the [1.0.2 remux contract](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/remux.md#what-a-remux-does).
- **Transmuxing:** emphasizes the change from one container format to another, such as MP4 to MPEG-TS, without re-encoding. This is the container-changing use of the remux path, not an additional codec conversion stage.

For an MP4-to-TS operation, the demuxer removes the MP4 structure, the remux layer passes the encoded tracks onward, and the TS muxer writes transport packets. OneMedia’s [MPEG-TS muxer reference](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/muxing-ts.md) documents that packet-based path.

## Transmuxing vs transcoding: choose by what must change

Changing an H.264/AAC MP4 to H.264/AAC TS is a container change. Changing H.264 video to another codec, resizing it, or applying a pixel filter requires more than repackaging. A transcode can also use the same codec on both sides: decoding and re-encoding is what defines the operation, not whether the codec names differ. FFmpeg’s [stream-copy](https://ffmpeg.org/ffmpeg.html#Streamcopy) and [transcoding](https://ffmpeg.org/ffmpeg.html#Transcoding) sections explain that distinction.

OneMedia’s TS remuxer is useful when your encoded media is already suitable for the destination. It does not turn an unsupported video codec into H.264 or an unsupported audio codec into AAC. In version 1.0.2, the TS muxer refuses codecs including Opus, Vorbis, FLAC, VP8, VP9 and AV1 with `UnsupportedCodec`. AAC with `channelConfiguration` zero is also refused: that value means the channel layout is described in a separate configuration element, which this muxer does not insert into the audio data. Check the [payload support rules](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/muxing-ts.md#payloads) before selecting TS as the output.

## Why packet bytes can change without re-encoding

“No re-encoding” does not mean “the same bytes everywhere.” Containers store codec payloads differently. For the MP4-to-TS path, OneMedia 1.0.2 documents these changes:

- **H.264:** length prefixes (numbers giving the size of each encoded unit) become Annex B start codes (byte markers separating those units). By default, access unit delimiters are added, and parameter sets are inserted before keyframes that lack them.
- **AAC:** encoded audio frames receive ADTS headers, which supply framing and audio configuration information.
- **Timing:** TS uses a 90 kHz time base, and edit-list starts and AAC priming are reflected in the output times.

These are framing and timing changes, not a new encode of the video frames or audio samples. The [payload section](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/muxing-ts.md#payloads) explicitly says packet bytes differ by design; the [time section](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/muxing-ts.md#time) explains the timestamp mapping. A file hash or raw packet-byte comparison cannot by itself tell you that a transcode occurred.

## Read the remux report before accepting the output

`Tracks` identifies the input-to-output track mapping and packet counts. `Changes` describes repackaging and timing changes. `Losses` lists input information the destination does not carry. For TS, rotation, track dispositions and multi-edit lists have no equivalent and are reported rather than silently promised. See [the report contract](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/remux.md#what-a-remux-does) and [TS timing and metadata rules](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/docs/muxing-ts.md#time).

That makes two checks necessary: did the required media tracks reach the output, and did the output retain the information your application needs? Preserving the encoded media does not guarantee that every container-level field survives.

Start with [OneMedia’s getting-started guide](https://recursiveai.org/onemedia/docs/getting-started/), then use the [remux API reference](https://recursiveai.org/onemedia/docs/remux/) and [TS muxer reference](https://recursiveai.org/onemedia/docs/muxing-ts/) for supported payloads and timing rules. [OneMedia](https://recursiveai.org/onemedia/) handles the container path shown here; the [Recursive AI library catalog](https://recursiveai.org/) lists the other libraries.
