module

EasyFfmpeg::CodecSupport

Constants

CODEC_DISPLAY_NAMES = {"h264" => "H.264/AVC", "hevc" => "H.265/HEVC", "vp8" => "VP8", "vp9" => "VP9", "av1" => "AV1", "mpeg4" => "MPEG-4", "mpeg2video" => "MPEG-2", "mpeg1video" => "MPEG-1", "theora" => "Theora", "prores" => "ProRes", "mjpeg" => "MJPEG", "aac" => "AAC", "mp3" => "MP3", "ac3" => "AC3/Dolby Digital", "eac3" => "E-AC3/Dolby Digital+", "dts" => "DTS", "flac" => "FLAC", "opus" => "Opus", "vorbis" => "Vorbis", "alac" => "ALAC", "truehd" => "TrueHD", "pcm_s16le" => "PCM 16-bit", "pcm_s24le" => "PCM 24-bit", "pcm_s32le" => "PCM 32-bit", "subrip" => "SRT", "ass" => "ASS", "ssa" => "SSA", "mov_text" => "MOV_TEXT", "hdmv_pgs_subtitle" => "PGS", "dvd_subtitle" => "VobSub", "webvtt" => "WebVTT", "dvb_subtitle" => "DVB", "libx264" => "H.264/AVC", "libx265" => "H.265/HEVC", "libvpx-vp9" => "VP9", "libsvtav1" => "AV1", "libopus" => "Opus", "libvorbis" => "Vorbis", "libmp3lame" => "MP3", "libtheora" => "Theora"}

Friendly codec display names

CONTAINER_AUDIO_CODECS = {"mp4" => ["aac", "mp3", "ac3", "eac3", "flac", "alac", "opus"] of ::String, "matroska" => ["aac", "mp3", "ac3", "eac3", "dts", "flac", "opus", "vorbis", "alac", "pcm_s16le", "pcm_s24le", "pcm_s32le", "truehd", "pcm_f32le", "wavpack"] of ::String, "mov" => ["aac", "mp3", "ac3", "eac3", "alac", "pcm_s16le", "pcm_s24le", "pcm_s32le", "flac"] of ::String, "webm" => ["opus", "vorbis"] of ::String, "avi" => ["mp3", "ac3", "pcm_s16le", "pcm_s24le"] of ::String, "mpegts" => ["aac", "mp3", "ac3", "eac3", "dts"] of ::String, "ogg" => ["vorbis", "opus", "flac"] of ::String, "flv" => ["aac", "mp3"] of ::String}
CONTAINER_SUB_CODECS = {"mp4" => ["mov_text"] of ::String, "matroska" => ["subrip", "ass", "ssa", "srt", "webvtt", "hdmv_pgs_subtitle", "dvd_subtitle"] of ::String, "mov" => ["mov_text"] of ::String, "webm" => ["webvtt"] of ::String, "avi" => [] of String, "mpegts" => ["dvb_subtitle"] of ::String, "ogg" => [] of String, "flv" => [] of String}
CONTAINER_VIDEO_CODECS = {"mp4" => ["h264", "hevc", "mpeg4", "mpeg2video", "av1"] of ::String, "matroska" => ["h264", "hevc", "vp8", "vp9", "av1", "mpeg4", "mpeg2video", "theora", "prores", "mpeg1video", "wmv3", "msmpeg4v3", "ffv1", "rawvideo"] of ::String, "mov" => ["h264", "hevc", "prores", "mpeg4", "mjpeg", "dnxhd"] of ::String, "webm" => ["vp8", "vp9", "av1"] of ::String, "avi" => ["h264", "mpeg4", "msmpeg4v3", "mjpeg", "mpeg2video", "mpeg1video", "wmv3", "ffv1", "rawvideo"] of ::String, "mpegts" => ["h264", "hevc", "mpeg2video"] of ::String, "ogg" => ["theora"] of ::String, "flv" => ["h264", "flv1"] of ::String}

Maps container format → codecs that can be muxed without re-encoding

DEFAULT_AUDIO_CODEC = {"mp4" => "aac", "matroska" => "aac", "mov" => "aac", "webm" => "libopus", "avi" => "libmp3lame", "mpegts" => "aac", "ogg" => "libvorbis", "flv" => "aac"}

Default target audio codec per container

DEFAULT_SUB_CODEC = {"mp4" => "mov_text", "matroska" => "subrip", "mov" => "mov_text", "webm" => "webvtt"}

Default target subtitle codec per container

DEFAULT_VIDEO_CODEC = {"mp4" => "libx264", "matroska" => "libx264", "mov" => "libx264", "webm" => "libvpx-vp9", "avi" => "libx264", "mpegts" => "libx264", "ogg" => "libtheora", "flv" => "libx264"}

Default target video codec per container (when source is incompatible)

EXT_TO_FORMAT = {".mp4" => "mp4", ".m4v" => "mp4", ".mkv" => "matroska", ".mka" => "matroska", ".mov" => "mov", ".webm" => "webm", ".avi" => "avi", ".ts" => "mpegts", ".mts" => "mpegts", ".ogg" => "ogg", ".ogv" => "ogg", ".flv" => "flv"}

File extension → ffmpeg container format name

TEXT_SUB_CODECS = ["subrip", "ass", "ssa", "srt", "mov_text", "webvtt", "text"] of ::String

Text-based subtitle codecs that can be converted between each other

Class methods

audio_compatible?(codec : String, format : String) : Bool
Source
codec_display_name(codec : String) : String
Source
format_for_ext(ext : String) : String | Nil
Source
sub_compatible?(codec : String, format : String) : Bool
Source
supported_output_format?(ext : String) : Bool
Source
text_sub?(codec : String) : Bool
Source
video_compatible?(codec : String, format : String) : Bool
Source