FFix.Muxer (ffix v0.2.0)

Copy Markdown View Source

Package output streams into a file or streaming format.

A muxer writes the container. Choose encoding separately with FFix.Encoder, or keep the existing encoded streams with FFix.stream_copy/1.

MP4 for download and playback

alias FFix.{Encoder, Muxer}
source = FFix.input("interview.mov")

output =
  Muxer.mp4(
    [Encoder.libx264(FFix.video(source, 0)), Encoder.aac(FFix.audio(source, 0))],
    "interview.mp4",
    movflags: [:faststart],
    output_options: [t: 30]
  )

FFix.command(output)

movflags configures the MP4 muxer. output_options: [t: 30] limits the output to 30 seconds. Keeping those option lists separate makes their scope clear. See FFix.Command for general FFmpeg option syntax.

A named helper selects its format regardless of the filename. Use FFix.output/3 when FFmpeg should choose the format from the target instead. new/2 provides a standalone muxer configuration and mux/4 accepts other FFmpeg format names.

Segments and playlists

One output declaration can write a set of files. This creates an HLS playlist and its media segments:

source = FFix.input("interview.mp4")
video = FFix.Encoder.libx264(FFix.video(source, 0), b: "2M")
audio = FFix.Encoder.aac(FFix.audio(source, 0), b: "128k")

output = FFix.Muxer.hls([video, audio], "hls/index.m3u8", hls_time: 4)
FFix.command(output)

Create the hls directory before running the command. HLS segments normally start at keyframes, so hls_time is a target duration. For multiple renditions sharing audio, see the named-mapping example in FFix.Command.Output.

Helpers document options from the recorded FFmpeg reference. Use raw: for newer option names, as described in FFix.Encoder. Available formats and codec compatibility depend on the FFmpeg build and destination container.

See the FFmpeg format reference for muxer options and format-specific requirements.

Summary

Functions

Apple HTTP Live Streaming

MPEG-TS (MPEG-2 Transport Stream)

Declares an output using an FFmpeg format name and its options.

Builds a muxer configuration for the muxer: option of FFix.output/3.

Types

hls_option()

@type hls_option() ::
  {:avioflags,
   integer()
   | String.t()
   | [String.t() | :direct]
   | :direct
   | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:cc_stream_map, String.t() | atom() | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:headers, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_allow_cache, integer() | String.t() | FFix.Command.option_callback()}
  | {:hls_base_url, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_delete_threshold,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:hls_enc, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:hls_enc_iv, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_enc_key, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_enc_key_url, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_flags,
     integer()
     | String.t()
     | [
         String.t()
         | :single_file
         | :temp_file
         | :delete_segments
         | :round_durations
         | :discont_start
         | :omit_endlist
         | :split_by_time
         | :append_list
         | :program_date_time
         | :second_level_segment_index
         | :second_level_segment_duration
         | :second_level_segment_size
         | :periodic_rekey
         | :independent_segments
         | :iframes_only
       ]
     | :single_file
     | :temp_file
     | :delete_segments
     | :round_durations
     | :discont_start
     | :omit_endlist
     | :split_by_time
     | :append_list
     | :program_date_time
     | :second_level_segment_index
     | :second_level_segment_duration
     | :second_level_segment_size
     | :periodic_rekey
     | :independent_segments
     | :iframes_only
     | FFix.Command.option_callback()}
  | {:hls_fmp4_init_filename,
     String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_fmp4_init_resend,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:hls_init_time, number() | String.t() | FFix.Command.option_callback()}
  | {:hls_key_info_file, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_list_size, integer() | String.t() | FFix.Command.option_callback()}
  | {:hls_playlist_type,
     integer() | String.t() | :event | :vod | FFix.Command.option_callback()}
  | {:hls_segment_filename,
     String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_segment_options, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_segment_size, integer() | String.t() | FFix.Command.option_callback()}
  | {:hls_segment_type,
     integer() | String.t() | :mpegts | :fmp4 | FFix.Command.option_callback()}
  | {:hls_start_number_source,
     integer()
     | String.t()
     | :generic
     | :epoch
     | :epoch_us
     | :datetime
     | FFix.Command.option_callback()}
  | {:hls_subtitle_path, String.t() | atom() | FFix.Command.option_callback()}
  | {:hls_time, number() | String.t() | FFix.Command.option_callback()}
  | {:hls_vtt_options, String.t() | atom() | FFix.Command.option_callback()}
  | {:http_persistent,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:http_user_agent, String.t() | atom() | FFix.Command.option_callback()}
  | {:ignore_io_errors,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:master_pl_name, String.t() | atom() | FFix.Command.option_callback()}
  | {:master_pl_publish_rate,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:method, String.t() | atom() | FFix.Command.option_callback()}
  | {:start_number, integer() | String.t() | FFix.Command.option_callback()}
  | {:strftime, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:strftime_mkdir,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:timeout, number() | String.t() | FFix.Command.option_callback()}
  | {:var_stream_map, String.t() | atom() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

image2_option()

@type image2_option() ::
  {:atomic_writing,
   boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:avioflags,
     integer()
     | String.t()
     | [String.t() | :direct]
     | :direct
     | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:frame_pts,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:protocol_opts, String.t() | atom() | FFix.Command.option_callback()}
  | {:start_number, integer() | String.t() | FFix.Command.option_callback()}
  | {:strftime, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:update, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

matroska_option()

@type matroska_option() ::
  {:allow_raw_vfw,
   boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:avioflags,
     integer()
     | String.t()
     | [String.t() | :direct]
     | :direct
     | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:cluster_size_limit,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:cluster_time_limit,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:cues_to_front,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:dash, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:dash_track_number,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:default_mode,
     integer()
     | String.t()
     | :infer
     | :infer_no_subs
     | :passthrough
     | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flipped_raw_rgb,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:live, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:reserve_index_space,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:write_crc32,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

mov_option()

@type mov_option() ::
  {:avioflags,
   integer()
   | String.t()
   | [String.t() | :direct]
   | :direct
   | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:brand, String.t() | atom() | FFix.Command.option_callback()}
  | {:empty_hdlr_name,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:encryption_key, String.t() | atom() | FFix.Command.option_callback()}
  | {:encryption_kid, String.t() | atom() | FFix.Command.option_callback()}
  | {:encryption_scheme, String.t() | atom() | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:frag_duration, integer() | String.t() | FFix.Command.option_callback()}
  | {:frag_interleave, integer() | String.t() | FFix.Command.option_callback()}
  | {:frag_size, integer() | String.t() | FFix.Command.option_callback()}
  | {:fragment_index, integer() | String.t() | FFix.Command.option_callback()}
  | {:iods_audio_profile,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:iods_video_profile,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:ism_lookahead, integer() | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:min_frag_duration,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:moov_size, integer() | String.t() | FFix.Command.option_callback()}
  | {:mov_gamma, number() | String.t() | FFix.Command.option_callback()}
  | {:movflags,
     integer()
     | String.t()
     | [
         String.t()
         | :cmaf
         | :dash
         | :default_base_moof
         | :delay_moov
         | :disable_chpl
         | :empty_moov
         | :faststart
         | :frag_custom
         | :frag_discont
         | :frag_every_frame
         | :frag_keyframe
         | :global_sidx
         | :isml
         | :negative_cts_offsets
         | :omit_tfhd_offset
         | :prefer_icc
         | :rtphint
         | :separate_moof
         | :skip_sidx
         | :skip_trailer
         | :use_metadata_tags
         | :write_colr
         | :write_gama
         | :hybrid_fragmented
       ]
     | :cmaf
     | :dash
     | :default_base_moof
     | :delay_moov
     | :disable_chpl
     | :empty_moov
     | :faststart
     | :frag_custom
     | :frag_discont
     | :frag_every_frame
     | :frag_keyframe
     | :global_sidx
     | :isml
     | :negative_cts_offsets
     | :omit_tfhd_offset
     | :prefer_icc
     | :rtphint
     | :separate_moof
     | :skip_sidx
     | :skip_trailer
     | :use_metadata_tags
     | :write_colr
     | :write_gama
     | :hybrid_fragmented
     | FFix.Command.option_callback()}
  | {:movie_timescale, integer() | String.t() | FFix.Command.option_callback()}
  | {:rtpflags,
     integer()
     | String.t()
     | [String.t() | :latm | :rfc2190 | :skip_rtcp | :h264_mode0 | :send_bye]
     | :latm
     | :rfc2190
     | :skip_rtcp
     | :h264_mode0
     | :send_bye
     | FFix.Command.option_callback()}
  | {:skip_iods,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:use_editlist,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:use_stream_ids_as_track_ids,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:video_track_timescale,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:write_btrt,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:write_prft,
     integer() | String.t() | :pts | :wallclock | FFix.Command.option_callback()}
  | {:write_tmcd,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

mp4_option()

@type mp4_option() ::
  {:avioflags,
   integer()
   | String.t()
   | [String.t() | :direct]
   | :direct
   | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:brand, String.t() | atom() | FFix.Command.option_callback()}
  | {:empty_hdlr_name,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:encryption_key, String.t() | atom() | FFix.Command.option_callback()}
  | {:encryption_kid, String.t() | atom() | FFix.Command.option_callback()}
  | {:encryption_scheme, String.t() | atom() | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:frag_duration, integer() | String.t() | FFix.Command.option_callback()}
  | {:frag_interleave, integer() | String.t() | FFix.Command.option_callback()}
  | {:frag_size, integer() | String.t() | FFix.Command.option_callback()}
  | {:fragment_index, integer() | String.t() | FFix.Command.option_callback()}
  | {:iods_audio_profile,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:iods_video_profile,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:ism_lookahead, integer() | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:min_frag_duration,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:moov_size, integer() | String.t() | FFix.Command.option_callback()}
  | {:mov_gamma, number() | String.t() | FFix.Command.option_callback()}
  | {:movflags,
     integer()
     | String.t()
     | [
         String.t()
         | :cmaf
         | :dash
         | :default_base_moof
         | :delay_moov
         | :disable_chpl
         | :empty_moov
         | :faststart
         | :frag_custom
         | :frag_discont
         | :frag_every_frame
         | :frag_keyframe
         | :global_sidx
         | :isml
         | :negative_cts_offsets
         | :omit_tfhd_offset
         | :prefer_icc
         | :rtphint
         | :separate_moof
         | :skip_sidx
         | :skip_trailer
         | :use_metadata_tags
         | :write_colr
         | :write_gama
         | :hybrid_fragmented
       ]
     | :cmaf
     | :dash
     | :default_base_moof
     | :delay_moov
     | :disable_chpl
     | :empty_moov
     | :faststart
     | :frag_custom
     | :frag_discont
     | :frag_every_frame
     | :frag_keyframe
     | :global_sidx
     | :isml
     | :negative_cts_offsets
     | :omit_tfhd_offset
     | :prefer_icc
     | :rtphint
     | :separate_moof
     | :skip_sidx
     | :skip_trailer
     | :use_metadata_tags
     | :write_colr
     | :write_gama
     | :hybrid_fragmented
     | FFix.Command.option_callback()}
  | {:movie_timescale, integer() | String.t() | FFix.Command.option_callback()}
  | {:rtpflags,
     integer()
     | String.t()
     | [String.t() | :latm | :rfc2190 | :skip_rtcp | :h264_mode0 | :send_bye]
     | :latm
     | :rfc2190
     | :skip_rtcp
     | :h264_mode0
     | :send_bye
     | FFix.Command.option_callback()}
  | {:skip_iods,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:use_editlist,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:use_stream_ids_as_track_ids,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:video_track_timescale,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:write_btrt,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:write_prft,
     integer() | String.t() | :pts | :wallclock | FFix.Command.option_callback()}
  | {:write_tmcd,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

mpegts_option()

@type mpegts_option() ::
  {:avioflags,
   integer()
   | String.t()
   | [String.t() | :direct]
   | :direct
   | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:mpegts_copyts,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:mpegts_flags,
     integer()
     | String.t()
     | [
         String.t()
         | :resend_headers
         | :latm
         | :pat_pmt_at_frames
         | :system_b
         | :initial_discontinuity
         | :nit
         | :omit_rai
       ]
     | :resend_headers
     | :latm
     | :pat_pmt_at_frames
     | :system_b
     | :initial_discontinuity
     | :nit
     | :omit_rai
     | FFix.Command.option_callback()}
  | {:mpegts_m2ts_mode,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:mpegts_original_network_id,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:mpegts_pmt_start_pid,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:mpegts_service_id,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:mpegts_service_type,
     integer()
     | String.t()
     | :digital_tv
     | :digital_radio
     | :teletext
     | :advanced_codec_digital_radio
     | :mpeg2_digital_hdtv
     | :advanced_codec_digital_sdtv
     | :advanced_codec_digital_hdtv
     | :hevc_digital_hdtv
     | FFix.Command.option_callback()}
  | {:mpegts_start_pid, integer() | String.t() | FFix.Command.option_callback()}
  | {:mpegts_transport_stream_id,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:muxrate, integer() | String.t() | FFix.Command.option_callback()}
  | {:nit_period, number() | String.t() | FFix.Command.option_callback()}
  | {:omit_video_pes_length,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:pat_period, number() | String.t() | FFix.Command.option_callback()}
  | {:pcr_period, integer() | String.t() | FFix.Command.option_callback()}
  | {:pes_payload_size, integer() | String.t() | FFix.Command.option_callback()}
  | {:sdt_period, number() | String.t() | FFix.Command.option_callback()}
  | {:tables_version, integer() | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

null_option()

@type null_option() ::
  {:avioflags,
   integer()
   | String.t()
   | [String.t() | :direct]
   | :direct
   | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

segment_option()

@type segment_option() ::
  {:avioflags,
   integer()
   | String.t()
   | [String.t() | :direct]
   | :direct
   | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:break_non_keyframes,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:increment_tc,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:individual_header_trailer,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:initial_offset, number() | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:min_seg_duration, number() | String.t() | FFix.Command.option_callback()}
  | {:reference_stream, String.t() | atom() | FFix.Command.option_callback()}
  | {:reset_timestamps,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:segment_atclocktime,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:segment_clocktime_offset,
     number() | String.t() | FFix.Command.option_callback()}
  | {:segment_clocktime_wrap_duration,
     number() | String.t() | FFix.Command.option_callback()}
  | {:segment_format, String.t() | atom() | FFix.Command.option_callback()}
  | {:segment_format_options,
     String.t() | atom() | FFix.Command.option_callback()}
  | {:segment_frames, String.t() | atom() | FFix.Command.option_callback()}
  | {:segment_header_filename,
     String.t() | atom() | FFix.Command.option_callback()}
  | {:segment_list, String.t() | atom() | FFix.Command.option_callback()}
  | {:segment_list_entry_prefix,
     String.t() | atom() | FFix.Command.option_callback()}
  | {:segment_list_flags,
     integer()
     | String.t()
     | [String.t() | :cache | :live]
     | :cache
     | :live
     | FFix.Command.option_callback()}
  | {:segment_list_size,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:segment_list_type,
     integer()
     | String.t()
     | :flat
     | :csv
     | :ext
     | :ffconcat
     | :m3u8
     | :hls
     | FFix.Command.option_callback()}
  | {:segment_start_number,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:segment_time, number() | String.t() | FFix.Command.option_callback()}
  | {:segment_time_delta,
     number() | String.t() | FFix.Command.option_callback()}
  | {:segment_times, String.t() | atom() | FFix.Command.option_callback()}
  | {:segment_wrap, integer() | String.t() | FFix.Command.option_callback()}
  | {:segment_wrap_number,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:strftime, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:write_empty_segments,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:write_header_trailer,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

t()

@type t() :: %FFix.Muxer{
  name: String.t() | nil,
  options: [FFix.Command.output_av_option()]
}

tee_option()

@type tee_option() ::
  {:avioflags,
   integer()
   | String.t()
   | [String.t() | :direct]
   | :direct
   | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:fifo_options, String.t() | atom() | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:use_fifo, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

webm_option()

@type webm_option() ::
  {:allow_raw_vfw,
   boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:avioflags,
     integer()
     | String.t()
     | [String.t() | :direct]
     | :direct
     | FFix.Command.option_callback()}
  | {:avoid_negative_ts,
     integer()
     | String.t()
     | :auto
     | :disabled
     | :make_non_negative
     | :make_zero
     | FFix.Command.option_callback()}
  | {:cluster_size_limit,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:cluster_time_limit,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:cues_to_front,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:dash, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:dash_track_number,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:default_mode,
     integer()
     | String.t()
     | :infer
     | :infer_no_subs
     | :passthrough
     | FFix.Command.option_callback()}
  | {:fflags,
     integer()
     | String.t()
     | [
         String.t()
         | :flush_packets
         | :ignidx
         | :genpts
         | :nofillin
         | :noparse
         | :igndts
         | :discardcorrupt
         | :sortdts
         | :fastseek
         | :nobuffer
         | :bitexact
         | :shortest
         | :autobsf
       ]
     | :flush_packets
     | :ignidx
     | :genpts
     | :nofillin
     | :noparse
     | :igndts
     | :discardcorrupt
     | :sortdts
     | :fastseek
     | :nobuffer
     | :bitexact
     | :shortest
     | :autobsf
     | FFix.Command.option_callback()}
  | {:flipped_raw_rgb,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:flush_packets, integer() | String.t() | FFix.Command.option_callback()}
  | {:live, boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:max_delay, integer() | String.t() | FFix.Command.option_callback()}
  | {:reserve_index_space,
     integer() | String.t() | FFix.Command.option_callback()}
  | {:write_crc32,
     boolean() | :auto | String.t() | FFix.Command.option_callback()}
  | {:raw, [FFix.Command.output_av_option()]}
  | {:output_options, [FFix.Command.option()]}

Functions

hls(sources, target, options \\ [])

Apple HTTP Live Streaming

Declares an output in hls format. See FFix.Muxer for usage and option conventions.

Example

FFix.Muxer.hls(sources, "hls/index.m3u8", hls_time: 4)

Options

  • start_number (int64): set first number in the sequence (from 0 to I64_MAX) (default 0)
  • hls_time (duration): set segment length (default 2)
  • hls_init_time (duration): set segment length at init list (default 0)
  • hls_list_size (int): set maximum number of playlist entries (from 0 to INT_MAX) (default 5)
  • hls_delete_threshold (int): set number of unreferenced segments to keep before deleting (from 1 to INT_MAX) (default 1)
  • hls_vtt_options (string): set hls vtt list of options for the container format used for hls
  • hls_allow_cache (int): explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments (from INT_MIN to INT_MAX) (default -1)
  • hls_base_url (string): url to prepend to each playlist entry
  • hls_segment_filename (string): filename template for segment files
  • hls_segment_options (dictionary): set segments files format options of hls
  • hls_segment_size (int): maximum size per segment file, (in bytes) (from 0 to INT_MAX) (default 0)
  • hls_key_info_file (string): file with key URI and key file path
  • hls_enc (boolean): enable AES128 encryption support (default false)
  • hls_enc_key (string): hex-coded 16 byte key to encrypt the segments
  • hls_enc_key_url (string): url to access the key to decrypt the segments
  • hls_enc_iv (string): hex-coded 16 byte initialization vector
  • hls_subtitle_path (string): set path of hls subtitles
  • hls_segment_type (int): set hls segment files type (from 0 to 1) (default mpegts) Values: mpegts, fmp4.
  • hls_fmp4_init_filename (string): set fragment mp4 file init filename (default "init.mp4")
  • hls_fmp4_init_resend (boolean): resend fragment mp4 init file after refresh m3u8 every time (default false)
  • hls_flags (flags): set flags affecting HLS playlist and media file generation (default 0) Values: single_file, temp_file, delete_segments, round_durations, discont_start, omit_endlist, split_by_time, append_list, program_date_time, second_level_segment_index, second_level_segment_duration, second_level_segment_size, periodic_rekey, independent_segments, iframes_only.
  • strftime (boolean): set filename expansion with strftime at segment creation (default false)
  • strftime_mkdir (boolean): create last directory component in strftime-generated filename (default false)
  • hls_playlist_type (int): set the HLS playlist type (from 0 to 2) (default 0) Values: event, vod.
  • method (string): set the HTTP method(default: PUT)
  • hls_start_number_source (int): set source of first number in sequence (from 0 to 3) (default generic) Values: generic, epoch, epoch_us, datetime.
  • http_user_agent (string): override User-Agent field in HTTP header
  • var_stream_map (string): Variant stream map string
  • cc_stream_map (string): Closed captions stream map string
  • master_pl_name (string): Create HLS master playlist with this name
  • master_pl_publish_rate (int): Publish master play list every after this many segment intervals (from 0 to UINT32_MAX) (default 0)
  • http_persistent (boolean): Use persistent HTTP connections (default false)
  • timeout (duration): set timeout for socket I/O operations (default -0.000001)
  • ignore_io_errors (boolean): Ignore IO errors for stable long-duration runs with network output (default false)
  • headers (string): set custom HTTP headers, can override built in default headers
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Common extensions: m3u8.
  • Default video codec: h264.
  • Default audio codec: aac.
  • Default subtitle codec: webvtt.

image2(sources, target, options \\ [])

image2 sequence

Declares an output in image2 format. See FFix.Muxer for usage and option conventions.

Options

  • update (boolean): continuously overwrite one file (default false)
  • start_number (int): set first number in the sequence (from 0 to INT_MAX) (default 1)
  • strftime (boolean): use strftime for filename (default false)
  • frame_pts (boolean): use current frame pts for filename (default false)
  • atomic_writing (boolean): write files atomically (using temporary files and renames) (default false)
  • protocol_opts (dictionary): specify protocol options for the opened files
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Common extensions: bmp,dpx,exr,jls,jpeg,jpg,jxl,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv,phm,png,ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8,im24,sunras,vbn,xbm,xface,pix,y,avif,qoi,hdr,wbmp.
  • Default video codec: mjpeg.

matroska(sources, target, options \\ [])

Matroska

Declares an output in matroska format. See FFix.Muxer for usage and option conventions.

Example

FFix.Muxer.matroska(sources, "archive.mkv")

Options

  • reserve_index_space (int): reserve a given amount of space (in bytes) at the beginning of the file for the index (cues) (from 0 to INT_MAX) (default 0)
  • cues_to_front (boolean): move Cues (the index) to the front by shifting data if necessary (default false)
  • cluster_size_limit (int): store at most the provided amount of bytes in a cluster (from -1 to INT_MAX) (default -1)
  • cluster_time_limit (int64): store at most the provided number of milliseconds in a cluster (from -1 to I64_MAX) (default -1)
  • dash (boolean): create a WebM file conforming to WebM DASH specification (default false)
  • dash_track_number (int): track number for the DASH stream (from 1 to INT_MAX) (default 1)
  • live (boolean): write files assuming it is a live stream (default false)
  • allow_raw_vfw (boolean): allow raw VFW mode (default false)
  • flipped_raw_rgb (boolean): store raw RGB bitmaps in VFW mode in bottom-up mode (default false)
  • write_crc32 (boolean): write a CRC32 element inside every Level 1 element (default true)
  • default_mode (int): control how a track's FlagDefault is inferred (from 0 to 2) (default passthrough) Values: infer, infer_no_subs, passthrough.
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Common extensions: mkv.
  • Mime type: video/x-matroska.
  • Default video codec: h264.
  • Default audio codec: vorbis.
  • Default subtitle codec: ass.

mov(sources, target, options \\ [])

QuickTime / MOV

Declares an output in mov format. See FFix.Muxer for usage and option conventions.

Options

  • brand (string): Override major brand
  • empty_hdlr_name (boolean): write zero-length name string in hdlr atoms within mdia and minf atoms (default false)
  • encryption_key (binary): The media encryption key (hex)
  • encryption_kid (binary): The media encryption key identifier (hex)
  • encryption_scheme (string): Configures the encryption scheme, allowed values are none, cenc-aes-ctr
  • frag_duration (int): Maximum fragment duration (from 0 to INT_MAX) (default 0)
  • frag_interleave (int): Interleave samples within fragments (max number of consecutive samples, lower is tighter interleaving, but with more overhead) (from 0 to INT_MAX) (default 0)
  • frag_size (int): Maximum fragment size (from 0 to INT_MAX) (default 0)
  • fragment_index (int): Fragment number of the next fragment (from 1 to INT_MAX) (default 1)
  • iods_audio_profile (int): iods audio profile atom. (from -1 to 255) (default -1)
  • iods_video_profile (int): iods video profile atom. (from -1 to 255) (default -1)
  • ism_lookahead (int): Number of lookahead entries for ISM files (from 0 to 255) (default 0)
  • movflags (flags): MOV muxer flags (default 0) Values: cmaf, dash, default_base_moof, delay_moov, disable_chpl, empty_moov, faststart, frag_custom, frag_discont, frag_every_frame, frag_keyframe, global_sidx, isml, negative_cts_offsets, omit_tfhd_offset, prefer_icc, rtphint, separate_moof, skip_sidx, skip_trailer, use_metadata_tags, write_colr, write_gama, hybrid_fragmented.
  • moov_size (int): maximum moov size so it can be placed at the begin (from 0 to INT_MAX) (default 0)
  • min_frag_duration (int): Minimum fragment duration (from 0 to INT_MAX) (default 0)
  • mov_gamma (float): gamma value for gama atom (from 0 to 10) (default 0)
  • movie_timescale (int): set movie timescale (from 1 to INT_MAX) (default 1000)
  • rtpflags (flags): RTP muxer flags (default 0) Values: latm, rfc2190, skip_rtcp, h264_mode0, send_bye.
  • skip_iods (boolean): Skip writing iods atom. (default true)
  • use_editlist (boolean): use edit list (default auto)
  • use_stream_ids_as_track_ids (boolean): use stream ids as track ids (default false)
  • video_track_timescale (int): set timescale of all video tracks (from 0 to INT_MAX) (default 0)
  • write_btrt (boolean): force or disable writing btrt (default auto)
  • write_prft (int): Write producer reference time box with specified time source (from 0 to 2) (default 0) Values: pts, wallclock.
  • write_tmcd (boolean): force or disable writing tmcd (default auto)
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Common extensions: mov.
  • Default video codec: h264.
  • Default audio codec: aac.

mp4(sources, target, options \\ [])

MP4 (MPEG-4 Part 14)

Declares an output in mp4 format. See FFix.Muxer for usage and option conventions.

Example

FFix.Muxer.mp4(sources, "interview.mp4", movflags: [:faststart])

Options

  • brand (string): Override major brand
  • empty_hdlr_name (boolean): write zero-length name string in hdlr atoms within mdia and minf atoms (default false)
  • encryption_key (binary): The media encryption key (hex)
  • encryption_kid (binary): The media encryption key identifier (hex)
  • encryption_scheme (string): Configures the encryption scheme, allowed values are none, cenc-aes-ctr
  • frag_duration (int): Maximum fragment duration (from 0 to INT_MAX) (default 0)
  • frag_interleave (int): Interleave samples within fragments (max number of consecutive samples, lower is tighter interleaving, but with more overhead) (from 0 to INT_MAX) (default 0)
  • frag_size (int): Maximum fragment size (from 0 to INT_MAX) (default 0)
  • fragment_index (int): Fragment number of the next fragment (from 1 to INT_MAX) (default 1)
  • iods_audio_profile (int): iods audio profile atom. (from -1 to 255) (default -1)
  • iods_video_profile (int): iods video profile atom. (from -1 to 255) (default -1)
  • ism_lookahead (int): Number of lookahead entries for ISM files (from 0 to 255) (default 0)
  • movflags (flags): MOV muxer flags (default 0) Values: cmaf, dash, default_base_moof, delay_moov, disable_chpl, empty_moov, faststart, frag_custom, frag_discont, frag_every_frame, frag_keyframe, global_sidx, isml, negative_cts_offsets, omit_tfhd_offset, prefer_icc, rtphint, separate_moof, skip_sidx, skip_trailer, use_metadata_tags, write_colr, write_gama, hybrid_fragmented.
  • moov_size (int): maximum moov size so it can be placed at the begin (from 0 to INT_MAX) (default 0)
  • min_frag_duration (int): Minimum fragment duration (from 0 to INT_MAX) (default 0)
  • mov_gamma (float): gamma value for gama atom (from 0 to 10) (default 0)
  • movie_timescale (int): set movie timescale (from 1 to INT_MAX) (default 1000)
  • rtpflags (flags): RTP muxer flags (default 0) Values: latm, rfc2190, skip_rtcp, h264_mode0, send_bye.
  • skip_iods (boolean): Skip writing iods atom. (default true)
  • use_editlist (boolean): use edit list (default auto)
  • use_stream_ids_as_track_ids (boolean): use stream ids as track ids (default false)
  • video_track_timescale (int): set timescale of all video tracks (from 0 to INT_MAX) (default 0)
  • write_btrt (boolean): force or disable writing btrt (default auto)
  • write_prft (int): Write producer reference time box with specified time source (from 0 to 2) (default 0) Values: pts, wallclock.
  • write_tmcd (boolean): force or disable writing tmcd (default auto)
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Common extensions: mp4.
  • Mime type: video/mp4.
  • Default video codec: h264.
  • Default audio codec: aac.

mpegts(sources, target, options \\ [])

MPEG-TS (MPEG-2 Transport Stream)

Declares an output in mpegts format. See FFix.Muxer for usage and option conventions.

Options

  • mpegts_transport_stream_id (int): Set transport_stream_id field. (from 1 to 65535) (default 1)
  • mpegts_original_network_id (int): Set original_network_id field. (from 1 to 65535) (default 65281)
  • mpegts_service_id (int): Set service_id field. (from 1 to 65535) (default 1)
  • mpegts_service_type (int): Set service_type field. (from 1 to 255) (default digital_tv) Values: digital_tv, digital_radio, teletext, advanced_codec_digital_radio, mpeg2_digital_hdtv, advanced_codec_digital_sdtv, advanced_codec_digital_hdtv, hevc_digital_hdtv.
  • mpegts_pmt_start_pid (int): Set the first pid of the PMT. (from 32 to 8186) (default 4096)
  • mpegts_start_pid (int): Set the first pid. (from 32 to 8186) (default 256)
  • mpegts_m2ts_mode (boolean): Enable m2ts mode. (default auto)
  • muxrate (int): (from 0 to INT_MAX) (default 1)
  • pes_payload_size (int): Minimum PES packet payload in bytes (from 0 to INT_MAX) (default 2930)
  • mpegts_flags (flags): MPEG-TS muxing flags (default 0) Values: resend_headers, latm, pat_pmt_at_frames, system_b, initial_discontinuity, nit, omit_rai.
  • mpegts_copyts (boolean): don't offset dts/pts (default auto)
  • tables_version (int): set PAT, PMT, SDT and NIT version (from 0 to 31) (default 0)
  • omit_video_pes_length (boolean): Omit the PES packet length for video packets (default true)
  • pcr_period (int): PCR retransmission time in milliseconds (from -1 to INT_MAX) (default -1)
  • pat_period (duration): PAT/PMT retransmission time limit in seconds (default 0.1)
  • sdt_period (duration): SDT retransmission time limit in seconds (default 0.5)
  • nit_period (duration): NIT retransmission time limit in seconds (default 0.5)
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Common extensions: ts,m2t,m2ts,mts.
  • Mime type: video/MP2T.
  • Default video codec: mpeg2video.
  • Default audio codec: mp2.

mux(sources, name, target, options \\ [])

Declares an output using an FFmpeg format name and its options.

FFix.Muxer.mux(audio, "flac", "recording.flac")

Format names and options are passed to FFmpeg. Place general output controls, such as a duration limit, in output_options:.

new(name, options \\ [])

@spec new(String.t() | nil, [FFix.Command.output_av_option()]) :: t()

Builds a muxer configuration for the muxer: option of FFix.output/3.

muxer = FFix.Muxer.new("mp4", movflags: "faststart")
FFix.output(video, "video.mp4", muxer: muxer)

Use a nil name to let FFmpeg select the format while applying the options.

null(sources, target, options \\ [])

raw null video

Declares an output in null format. See FFix.Muxer for usage and option conventions.

Example

FFix.Muxer.null(sources, :stdout)

Options

  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Default video codec: wrapped_avframe.
  • Default audio codec: pcm_s16le.

segment(sources, target, options \\ [])

segment

Declares an output in segment format. See FFix.Muxer for usage and option conventions.

Options

  • reference_stream (string): set reference stream (default "auto")
  • segment_format (string): set container format used for the segments
  • segment_format_options (dictionary): set list of options for the container format used for the segments
  • segment_list (string): set the segment list filename
  • segment_header_filename (string): write a single file containing the header
  • segment_list_flags (flags): set flags affecting segment list generation (default cache) Values: cache, live.
  • segment_list_size (int): set the maximum number of playlist entries (from 0 to INT_MAX) (default 0)
  • segment_list_type (int): set the segment list type (from -1 to 4) (default -1) Values: flat, csv, ext, ffconcat, m3u8, hls.
  • segment_atclocktime (boolean): set segment to be cut at clocktime (default false)
  • segment_clocktime_offset (duration): set segment clocktime offset (default 0)
  • segment_clocktime_wrap_duration (duration): set segment clocktime wrapping duration (default INT64_MAX)
  • segment_time (duration): set segment duration (default 2)
  • segment_time_delta (duration): set approximation value used for the segment times (default 0)
  • min_seg_duration (duration): set minimum segment duration (default 0)
  • segment_times (string): set segment split time points
  • segment_frames (string): set segment split frame numbers
  • segment_wrap (int): set number after which the index wraps (from 0 to INT_MAX) (default 0)
  • segment_list_entry_prefix (string): set base url prefix for segments
  • segment_start_number (int): set the sequence number of the first segment (from 0 to INT_MAX) (default 0)
  • segment_wrap_number (int): set the number of wrap before the first segment (from 0 to INT_MAX) (default 0)
  • strftime (boolean): set filename expansion with strftime at segment creation (default false)
  • increment_tc (boolean): increment timecode between each segment (default false)
  • break_non_keyframes (boolean): allow breaking segments on non-keyframes (default false)
  • individual_header_trailer (boolean): write header/trailer to each segment (default true)
  • write_header_trailer (boolean): write a header to the first segment and a trailer to the last one (default true)
  • reset_timestamps (boolean): reset timestamps at the beginning of each segment (default false)
  • initial_offset (duration): set initial timestamp offset (default 0)
  • write_empty_segments (boolean): allow writing empty 'filler' segments (default false)
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

tee(sources, target, options \\ [])

Multiple muxer tee

Declares an output in tee format. See FFix.Muxer for usage and option conventions.

Options

  • use_fifo (boolean): Use fifo pseudo-muxer to separate actual muxers from encoder (default false)
  • fifo_options (dictionary): fifo pseudo-muxer options
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

webm(sources, target, options \\ [])

WebM

Declares an output in webm format. See FFix.Muxer for usage and option conventions.

Options

  • reserve_index_space (int): reserve a given amount of space (in bytes) at the beginning of the file for the index (cues) (from 0 to INT_MAX) (default 0)
  • cues_to_front (boolean): move Cues (the index) to the front by shifting data if necessary (default false)
  • cluster_size_limit (int): store at most the provided amount of bytes in a cluster (from -1 to INT_MAX) (default -1)
  • cluster_time_limit (int64): store at most the provided number of milliseconds in a cluster (from -1 to I64_MAX) (default -1)
  • dash (boolean): create a WebM file conforming to WebM DASH specification (default false)
  • dash_track_number (int): track number for the DASH stream (from 1 to INT_MAX) (default 1)
  • live (boolean): write files assuming it is a live stream (default false)
  • allow_raw_vfw (boolean): allow raw VFW mode (default false)
  • flipped_raw_rgb (boolean): store raw RGB bitmaps in VFW mode in bottom-up mode (default false)
  • write_crc32 (boolean): write a CRC32 element inside every Level 1 element (default true)
  • default_mode (int): control how a track's FlagDefault is inferred (from 0 to 2) (default passthrough) Values: infer, infer_no_subs, passthrough.
  • avioflags (flags): (default 0) Values: direct.
  • fflags (flags): (default autobsf) Values: flush_packets, ignidx, genpts, nofillin, noparse, igndts, discardcorrupt, sortdts, fastseek, nobuffer, bitexact, shortest, autobsf.
  • max_delay (int): maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1)
  • flush_packets (int): enable flushing of the I/O context after each packet (from -1 to 1) (default -1)
  • avoid_negative_ts (int): shift timestamps so they start at 0 (from -1 to 2) (default auto) Values: auto, disabled, make_non_negative, make_zero.

Format and codec details

  • Common extensions: webm.
  • Mime type: video/webm.
  • Default video codec: vp9.
  • Default audio codec: opus.
  • Default subtitle codec: webvtt.