mp4box
Package, inspect, and manipulate MP4 files
TLDR
Display information about an existing MP4 file
Add an SRT subtitle file into an MP4 file
Combine audio from one file and video from another
SYNOPSIS
MP4Box [options] input_files
PARAMETERS
-add input_file[options]
Adds the specified input_file to the MP4 container. Various options can be used to customize the import process, such as specifying the track ID, language, or codec-specific parameters.
-cat input_file
Concatenates the input_file at the end of current file.
-split duration
Splits the MP4 file into segments of the specified duration in seconds. Useful for creating smaller video clips or breaking up large files.
-split-size size
Splits the MP4 file into segments with specified size in bytes.
-hint
Hints the MP4 file for streaming. Creates hint tracks, which contain information that allows servers to stream the file efficiently over a network.
-dash duration
Creates a DASH (Dynamic Adaptive Streaming over HTTP) manifest and segments the file. Useful for adaptive bitrate streaming.
-dump-chap
Dumps chapter information from the MP4 file.
-merge
Merges segments listed in given file (for DASH).
-info
Displays information about the MP4 file, including its structure, codecs, and metadata. Is same as default action when no parameters are passed.
-discards
Writes a file containing list of discardable frames per track.
-remux
Remuxes the input file(s) to the output file, potentially changing container format.
-out output_file
Specifies the output_file name for the manipulated MP4 file.
-brand brand_name
Specifies the major brand name for the MP4 file. Used to indicate the file's intended usage and compatibility.
-iso
Creates an ISO-compliant MP4 file.
-version
Prints the MP4Box version and exits.
-h
Displays help message.
DESCRIPTION
MP4Box is a versatile command-line tool that is used for manipulating and inspecting MP4 (ISO Base Media File Format) and related multimedia container files. It allows users to perform a variety of operations, including multiplexing (combining audio, video, and subtitles into a single MP4 file), demultiplexing (extracting streams from an MP4 file), inspecting file structure and metadata, hinting files for streaming (creating metadata to optimize delivery over networks), and fixing broken or incomplete files.
It supports a wide range of codecs and formats, making it a valuable tool for video editing, media conversion, and digital video management. Its non-destructive editing capabilities allow to change meta data without re-encoding the entire stream.
CAVEATS
MP4Box's extensive options can be complex. Incorrect usage may lead to corrupted or unplayable files. Backups are recommended before performing complex operations. Large files may require significant processing time and memory.
STREAM OPTIONS WITH -ADD
The -add option provides a powerful way to customize the import process of individual streams.
- trackID=id: specify track ID
- lang=language_code: specify language
- par=width:height: sets pixel aspect ration
FILE NAMING
When splitting files using -split duration or -split-size size, MP4Box automatically generates sequential file names based on the output filename specified with -out. For example, if the output file is named 'output.mp4', the split files will be named 'output_1.mp4', 'output_2.mp4', and so on.
HISTORY
MP4Box is part of the GPAC (GStreamer Plugin And Codec) project, an open-source multimedia framework. Its development has been ongoing for many years, with the goal of providing a comprehensive toolset for MP4 manipulation and streaming. It has been widely adopted in video editing, content creation, and digital media delivery workflows.