FFmpegfs Fuse Multi Media Filesystem 2.16
|
Make audience audience specific optimisations. More...
#include "ffmpeg_transcoder.h"
Go to the source code of this file.
Make audience audience specific optimisations.
The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4 file has all the metadata about all packets stored in one location (written at the end of the file, it can be moved to the start for better playback by adding faststart to the movflags, or using the qt-faststart tool). A fragmented file consists of a number of fragments, where packets and metadata about these packets are stored together. Writing a fragmented file has the advantage that the file is decodable even if the writing is interrupted (while a normal MOV/MP4 is undecodable if it is not properly finished), and it requires less memory when writing very long files (since writing normal MOV/MP4 files stores info about every single packet in memory until the file is closed). The downside is that it is less compatible with other applications.
Fragmentation is enabled by setting one of the AVOptions that define how to cut the file into fragments:
-moov_size bytes
Reserves space for the moov atom at the beginning of the file instead of placing the moov atom at the end. If the space reserved is insufficient, muxing will fail.
-movflags frag_keyframe
Start a new fragment at each video keyframe.
-frag_duration duration
Create fragments that are duration microseconds long.
-frag_size size
Create fragments that contain up to size bytes of payload data.
-movflags frag_custom
Allow the caller to manually choose when to cut fragments, by calling av_write_frame(ctx, nullptr) to write a fragment with the packets written so far. (This is only useful with other applications integrating libavformat, not from ffmpeg.)
-min_frag_duration duration
Don’t create fragments that are shorter than duration microseconds long.
If more than one condition is specified, fragments are cut when one of the specified conditions is fulfilled. The exception to this is -min_frag_duration, which has to be fulfilled for any of the other conditions to apply.
Additionally, the way the output file is written can be adjusted through a few other options:
-movflags empty_moov
Write an initial moov atom directly at the start of the file, without describing any samples in it. Generally, an mdat/moov pair is written at the start of the file, as a normal MOV/MP4 file, containing only a short portion of the file. With this option set, there is no initial mdat atom, and the moov atom only describes the tracks but has a zero duration.
This option is implicitly set when writing ismv (Smooth Streaming) files.
-movflags separate_moof
Write a separate moof (movie fragment) atom for each track. Normally, packets for all tracks are written in a moof atom (which is slightly more efficient), but with this option set, the muxer writes one moof/mdat pair for each track, making it easier to separate tracks.
This option is implicitly set when writing ismv (Smooth Streaming) files.
-movflags faststart
Run a second pass moving the index (moov atom) to the beginning of the file. This operation can take a while, and will not work in various situations such as fragmented output, thus it is not enabled by default.
-movflags rtphint
Add RTP hinting tracks to the output file.
-movflags disable_chpl
Disable Nero chapter markers (chpl atom). Normally, both Nero chapters and a QuickTime chapter track are written to the file. With this option set, only the QuickTime chapter track will be written. Nero chapters can cause failures when the file is reprocessed with certain tagging programs, like mp3Tag 2.61a and iTunes 11.3, most likely other versions are affected as well.
-movflags omit_tfhd_offset
Do not write any absolute base_data_offset in tfhd atoms. This avoids tying fragments to absolute byte positions in the file/streams.
-movflags default_base_moof
Similarly to the omit_tfhd_offset, this flag avoids writing the absolute base_data_offset field in tfhd atoms, but does so by using the new default-base-is-moof flag instead. This flag is new from 14496-12:2012. This may make the fragments easier to parse in certain circumstances (avoiding basing track fragment location calculations on the implicit end of the previous track fragment).
-write_tmcd
Specify on to force writing a timecode track, off to disable it and auto to write a timecode track only for mov and mp4 output (default).
-movflags negative_cts_offsets
Enables utilization of version 1 of the CTTS box, in which the CTS offsets can be negative. This enables the initial sample to have DTS/CTS of zero, and reduces the need for edit lists for some cases such as video tracks with B-frames. Additionally, eases conformance with the DASH-IF interoperability guidelines.
Possible codec options:
Possible format options:
Definition in file ffmpeg_profiles.cc.