Skip to content

Latest commit

 

History

History
275 lines (216 loc) · 17.6 KB

File metadata and controls

275 lines (216 loc) · 17.6 KB

tsMuxer : Usage Instructions

GUI

The simplest thing to do is to use the tsMuxerGUI. A screenshot of that can be seen below:

tsMuxerGUI_Screenshot

Editing the Meta File in the GUI

The tsMuxerGUI displays an auto-generated meta file in the "Meta file" section. This preview shows the exact content that will be used when you start muxing.

You can now manually edit this meta file directly in the GUI to use advanced options not available through the visual interface. This is useful when you need to:

  • Combine options that the GUI doesn't provide
  • Apply specialized parameters for particular encoding scenarios
  • Test different muxing configurations without creating separate project files

How to edit:

  1. Click in the "Meta file" text area to position your cursor
  2. Edit the meta file content directly (add/remove/modify lines)
  3. The GUI will remember your changes and use the edited version when you click "Start muxing"

Reverting changes:

  • If you've manually edited the meta file and want to go back to the auto-generated version, click the "Reset meta to auto-generated" button
  • This will discard your manual edits and regenerate the meta file based on current GUI settings

Saving edited meta files:

  • Use the "Save meta file" button to save your edited meta file as a .meta project file
  • This allows you to reuse complex configurations later
  • When you load the saved .meta file from the command line, it will use your custom settings

Note: Once you manually edit the meta file, subsequent GUI changes will no longer automatically update it. You can reset it at any time using the "Reset meta to auto-generated" button, or make additional manual edits as needed.

TrueHD + AC-3 Compatibility Core Merge in the GUI

When working with Dolby TrueHD and AC-3 tracks in Matroska files, the GUI provides options to automatically merge them into a Blu-ray compatible format.

GUI usage:

Select the TRUE-HD track, then set:

  • track= to the TrueHD Matroska track number
  • Merge AC-3 track to the AC-3 Matroska track number (when the AC-3 exists as a track in the MKV), or
  • Merge AC-3 file to a standalone .ac3 file (when the MKV does not contain an AC-3 track)

The GUI will emit either merge-ac3-track=<n> or merge-ac3-file="path" into the meta preview.

If the MKV has no AC-3 track:

Create an AC-3 compatibility stream from the TrueHD audio with FFmpeg (choose the correct audio index for 0:a:N):

ffmpeg -i input.mkv -map 0:a:0 -c:a ac3 -b:a 640k -ac 6 compat.ac3

Then either:

  • use Merge AC-3 file / merge-ac3-file="compat.ac3" directly, or
  • remux compat.ac3 back into the MKV as a separate audio track (e.g. with mkvmerge) and use Merge AC-3 track / merge-ac3-track with the new AC-3 track number.

Command Line

Alternatively you can use tsMuxer via the command-line.

Examples:

    tsMuxeR <media file name>
    tsMuxeR <meta file name> <out file/dir name>

tsMuxeR can be run in track detection mode or muxing mode. If tsMuxeR is run with only one argument, then the program displays track information required to construct a meta file. When running with two arguments, tsMuxeR starts the muxing or demuxing process.

Supported output formats:

  • TS - MPEG Transport Stream
  • M2TS - Blu-ray MPEG-2 Transport Stream
  • MKV/MKA - Matroska Video/Audio container
  • ISO - Blu-ray disc image
  • Blu-ray folder structure - BDMV directory layout

The output format is determined by the file extension of the output file name (e.g. .ts, .m2ts, .mkv, .mka, .iso).

The output of the program is encoded in UTF-8, which means that non-ASCII characters will not show up properly in the Windows console by default. If you want to see the output properly, run chcp 65001 before running tsMuxeR.

Meta file format

File MUST have the .meta extension. This file defines files you want to multiplex. The first line of a meta file contains additional parameters that apply to all tracks. In this case the first line should begin with the word MUXOPT.

Encoding

The file should be encoded with UTF-8. However, since older versions of the GUI saved the file in the "active code page" encoding on Windows, it is used as a fallback on this platform. In the very rare event of the program not being able to open some files referenced by a meta file saved with an older GUI version, please convert it to UTF-8 manually by opening it in Notepad and selecting ANSI as the encoding, and then saving it via "Save As", but this time selecting UTF-8 as the encoding.

Syntax

The following lines form a list of tracks and their parameters. The format is as follows: <code name>, <file name>, <parameters>. Parameters are separated with commas, with each parameter consisting of a name and a value, separated with an equals sign. Example of META file:

MUXOPT --blu-ray
V_MPEG4/ISO/AVC, D:/media/test/stream.h264, fps=25
A_AC3, D:/media/test/stream.ac3, timeshift=-10000ms

In this example one AC3 audio stream and one H264 video stream are multiplexed into BD disc. The input file name can reference an elementary stream or a track located inside a container.

Example of META file for MKV output:

MUXOPT --vbr
V_MPEG4/ISO/AVC, D:/media/test/stream.h264, fps=25
A_AC3, D:/media/test/stream.ac3, timeshift=-10000ms

When the output file has an .mkv or .mka extension, tsMuxeR automatically uses the Matroska muxer. Most MUXOPT parameters related to TS/Blu-ray (such as --blu-ray, --new-audio-pes, --pcr-on-video-pid) are not applicable to MKV output and will be ignored.

Supported input containers:

  • TS/M2TS/MTS
  • EVO/VOB/MPG/MPEG
  • MKV
  • MOV/MP4
  • MPLS (Blu-ray media play list file)

Names of codecs in the meta file:

Meta File Code Description
V_MPEGI/ISO/VVC H.266/VVC
V_MPEGH/ISO/HEVC H.265/HEVC
V_MPEG4/ISO/AVC H.264/AVC
V_MPEG4/ISO/MVC H.264/MVC
V_MS/VFW/WVC1 VC1
V_MPEG-2 MPEG2
V_AV1 AV1
A_AC3 AC3/AC3+/TRUE-HD
A_AAC AAC
A_DTS DTS/DTS-Express/DTS-HD
A_MP3 MPEG audio layer 1/2/3
A_LPCM raw pcm data or PCM WAV file
A_FLAC FLAC (MKV and demux output only)
A_OPUS Opus (TS, MKV, and demux output only)
S_HDMV/PGS Presentation graphic stream (BD subtitle format)
S_TEXT/UTF8 SRT subtitle format. Encoding MUST be UTF-8/UTF-16/UTF-32

Each track may have additional parameters. Track parameters do not have dashes. If a parameter's value consists of several words, it must be enclosed in quotes.

Common additional parameters for any type of track:

Parameter Description
track track number if input file is a container.
lang track language. MUST contain exactly 3 letters.

Additional parameters for audio tracks:

Parameter Description
timeshift Shift audio track by the given number of milliseconds. Can be negative.
down-to-dts Available only for DTS-HD tracks. Filter out HD part.
down-to-ac3 Available only for TRUE-HD tracks. Filter out HD part.
secondary Mux as secondary audio. Available for DD+ and DTS-Express.
default Mark this track as the default when muxing to Blu-ray.
stretch Stretch audio by a given factor. Can be a decimal value or a fraction (e.g. 25/24). Useful for fixing A/V sync issues caused by frame rate discrepancies.
merge-ac3-track MKV only, A_MLP only. Matroska track number of a classic AC-3 stream to interleave with this TrueHD track for Blu-ray-style muxing. Requires track=<TrueHD track number>. Do not add the AC-3 track as a separate meta line.
merge-ac3-file A_MLP only. Path to an external classic AC-3 (.ac3) file to interleave with a standalone TrueHD (.thd) stream for Blu-ray-style muxing.

TrueHD + AC-3 Compatibility Core Merge

Some remuxed Blu-ray MKVs store Dolby TrueHD and the AC-3 compatibility track as separate tracks. For Blu-ray output, tsMuxer can merge them into the Blu-ray style interleaved TrueHD+AC-3 stream during muxing.

  • Note: You can merge either:
    • an AC-3 Matroska track from the same MKV (merge-ac3-track), or
    • an external AC-3 file (merge-ac3-file).

Meta file example

MUXOPT --blu-ray
V_MPEG4/ISO/AVC, "movie.mkv", track=1
A_MLP, "movie.mkv", track=2, merge-ac3-track=3

TrueHD (.thd) + AC-3 (.ac3) Merge (Elementary Streams)

If you have standalone TrueHD and AC-3 files, you can merge them directly:

MUXOPT --blu-ray
A_MLP, "audio.thd", merge-ac3-file="compat.ac3"

Additional parameters for video tracks:

Parameter Description
fps The number of frames per second. If not defined, the value is auto detected from the source stream or the container metadata (e.g. MKV default_duration, MP4 timescale). If neither source is available, the GUI defaults to 23.976 and the CLI defaults to 25.
delPulldown Remove pulldown from the track, if it exists. If the pulldown is present, the FPS value is changed from 30 to 24.
ar Override video aspect ratio. 16:9, 4:3 e.t.c.

Additional parameters for H.264 video tracks:

Parameter Description
level Overwrite the level in the H264 stream. Do note that this option only updates the headers and does not reencode the stream, which may not meet the requirements for a lower level.
insertSEI If the original stream does not contain SEI picture timing, SEI buffering period or VUI parameters, add this data to the stream. This option is recommended for BD muxing.
forceSEI Add SEI picture timing, buffering period and VUI parameters to the stream and rebuild this data if it already exists.
contSPS If the original video doesn't contain repetitive SPS/PPS, then SPS/PPS will be added to the stream before each key frame. This option is recommended for BD muxing.
subTrack Used for combined AVC/MVC tracks only. TsMuxeR always demultiplexes such tracks to separate AVC and MVC streams. Setting this to 1 sets the reference to the AVC part, while 2 sets it to the MVC part.
secondary Mux as secondary video (PIP).
pipCorner Corner for PIP video. Allowed values: "TopLeft","TopRight", "BottomRight", "BottomLeft".
pipHOffset PIP window horizontal offset from the corner in pixels.
pipVOffset PIP window vertical offset from the corner in pixels.
pipScale PIP window scale factor. Allowed values: "1", "1/2", "1/4", "1.5", "fullScreen".
pipLumma Allow the PIP window to be transparent. Transparent colors are lumma colors in range [0..pipLumma].

Additional parameters for PG and SRT tracks:

Parameter Description
video-width The width of the video in pixels.
video-height The height of the video in pixels.
default Mark this track as the default when muxing to Blu-ray. Allowed values are all which causes all subtitles to be shown, and forced which shows only elements marked as "forced" in the subtitle stream.
fps Video fps. It is recommended to define this parameter in order to enable more careful timing processing.
3d-plane Defines the number of the '3D offset track' which is placed inside the MVC track. Each message has an individual 3D offset. This information is stored inside 3D offset track.

Additional parameters for SRT tracks:

Parameter Description
font-name Font name to render.
font-color Font color, defined as a hexadecimal or decimal number. 24-bit long numbers (for instance 0xFF00FF) define RGB components, while 32-bit long ones (for instance 0x80FF00FF) define ARGB components.
font-size Font size in pixels.
font-italic Italic display text.
font-bold Bold display text.
font-underline Underlined text.
font-strike-out Strikethrough text.
font-charset Font character set (numeric). Allows selection of a specific character set for font rendering.
bottom-offset Distance from the lower edge while displaying text.
font-border Outline width.
fadein-time Time in ms for smooth subtitle appearance.
fadeout-time Time in ms for smooth subtitle disappearance.
line-spacing Interval between subtitle lines. Default value is 1.0.

Currently tsMuxer only supports fonts in TTF format. It also will only load fonts from /usr/share/fonts/ on Linux and /Library/Fonts/ on Mac. As such our recommendation is to use font "FreeSans" on Linux and "OpenSans" on Mac.

tsMuxeR supports additional tags inside SRT tracks. The syntax and parameters coincide with HTML: <b>, <i>, <u>, <strike>, <font>. Default relative font size (used in these tags) is 3. For example:

<b><font size=5 color="deepskyblue" name="Arial"><u>Test</u>
<font size= 4 color="#806040">colored</font>text</font>
</b>

Global additional parameters are placed in the first line of the META file, which must begin with the MUXOPT token. All parameters in this group start with two dashes:

Parameter Description
--no-pcr-on-video-pid Allocate a separate PID for PCR and do not use the existing video PID.
--new-audio-pes Use bytes 0xfd instead of 0xbd for AC3, True-HD, DTS and DTS-HD. Activated automatically for BD muxing.
--no-hdmv-descriptors Use ITU-T H.222.0 / ISO/IEC 13818-1 descriptors instead of HDMV descriptors. Not activated for BD or AVCHD muxing.
--vbr Use variable bitrate. This is the default mode.
--minbitrate Sets the lower limit of the VBR bitrate. If the stream has a smaller bitrate, NULL packets will be inserted to compensate.
--maxbitrate The upper limit of the vbr bitrate.
--cbr Muxing mode with a fixed bitrate. --vbr and --cbr must not be used together.
--bitrate Set a fixed bitrate in Mbps (e.g. --bitrate=35). This sets both the minimum and maximum bitrate to the same value, enabling CBR mode.
--vbv-len The length of the virtual buffer in milliseconds. The default value is 500. Typically, this option is used together with --cbr. The parameter is similar to the value of vbv-buffer-size in the x264 codec, but defined in milliseconds instead of kbit.
--no-asyncio Do not create a separate thread for writing. This option also disables the FILE_FLAG_NO_BUFFERING flag on Windows when writing. This option is deprecated.
--auto-chapters Insert a chapter every minutes. Used only in BD/AVCHD mode.
--custom-chapters A semicolon delimited list of hh:mm:ss.zzz strings, representing the chapters' start times.
--demux Run in demux mode : the selected audio and video tracks are stored as separate files. The output name must be a folder name. All selected effects (such as changing the level of a H264 stream) are processed. When demuxing, certain types of tracks are always changed : - Subtitles in a Presentation Graphic Stream are converted into sup format. - PCM audio is saved as WAV files.
--blu-ray Mux as a BD disc. If the output file name is a folder, a Blu-Ray folder structure is created inside that folder. SSIF files for BD3D discs are not created in this case. If the output name has an .iso extension, then the disc is created directly as an image file.
--blu-ray-v3 As above - except mux to UHD BD discs. If you're using the GUI, this will be automatically set if one of the streams is HEVC.
--avchd Mux to AVCHD disc.
--cut-start Trim the beginning of the file. The value should be followed by the time unit : "ms" (milliseconds), "s" (seconds) or "min" (minutes).
--cut-end Trim the end of the file. Same rules as --cut-start apply.
--split-duration Split the output into several files, with each of them being seconds long.
--split-size Split the output into several files, with each of them having a given maximum size. KB, KiB, MB, MiB, GB and GiB are accepted as size units.
--right-eye Use base video stream for right eye. Used for 3DBD only.
--start-time Timestamp of the first video frame. May be defined as 45Khz clock (just a number) or as time in hh:mm:ss.zzz format
--mplsOffset The number of the first MPLS file. Used for BD disc mode.
--m2tsOffset The number of the first M2TS file. Used for BD disc mode.
--insertBlankPL Add an additional short playlist. Used for cropped video muxed to BD disc.
--blankOffset Blank playlist number.
--label Disk label when muxing to ISO.
--extra-iso-space Allocate extra space in 64K units for ISO metadata (file and directory names). Normally, tsMuxeR allocates this space automatically, but if split condition generates a lot of small files, it may be required to define extra space.
--constant-iso-hdr Generates an ISO header that does not depend on the program version or the current time. Normally, the ISO header's "application ID", "implementation ID", and "volume ID" fields are set to strings containing the program version and/or a random number, while the access/modification/creation times of the files in the image are set to the current time. This option disables this behaviour by filling these fields with hardcoded values and setting the file times to the equivalent of Wed 1 Jul 20:00:00 UTC 2020 in the local timezone. Using this option is not recommended for normal usage, as it is meant only for testing ISO output validity.