qtmux: Implement muxing of AV1 into MP4 files

According to
https://aomediacodec.github.io/av1-isobmff/
This commit is contained in:
Olivier Crête 2018-07-25 18:37:48 -04:00
parent d641b37fcb
commit 6c478453a8
2 changed files with 33 additions and 2 deletions

View file

@ -5760,6 +5760,35 @@ gst_qt_mux_video_sink_set_caps (GstQTPad * qtpad, GstCaps * caps)
} else if (strcmp (mimetype, "video/x-cineform") == 0) { } else if (strcmp (mimetype, "video/x-cineform") == 0) {
entry.fourcc = FOURCC_cfhd; entry.fourcc = FOURCC_cfhd;
sync = FALSE; sync = FALSE;
} else if (strcmp (mimetype, "video/x-av1") == 0) {
gint presentation_delay;
guint8 presentation_delay_byte = 0;
GstBuffer *av1_codec_data;
if (gst_structure_get_int (structure, "presentation-delay",
&presentation_delay)) {
presentation_delay_byte = 1 << 5;
presentation_delay_byte |= MAX (0xF, presentation_delay & 0xF);
}
av1_codec_data = gst_buffer_new_allocate (NULL, 5, NULL);
/* Fill version and 3 bytes of flags to 0 */
gst_buffer_memset (av1_codec_data, 0, 0, 4);
gst_buffer_fill (av1_codec_data, 4, &presentation_delay_byte, 1);
if (codec_data)
av1_codec_data = gst_buffer_append (av1_codec_data,
gst_buffer_ref ((GstBuffer *) codec_data));
entry.fourcc = FOURCC_av01;
ext_atom = build_btrt_extension (0, qtpad->avg_bitrate, qtpad->max_bitrate);
if (ext_atom != NULL)
ext_atom_list = g_list_prepend (ext_atom_list, ext_atom);
ext_atom = build_codec_data_extension (FOURCC_av1C, av1_codec_data);
if (ext_atom != NULL)
ext_atom_list = g_list_prepend (ext_atom_list, ext_atom);
gst_buffer_unref (av1_codec_data);
} }
if (!entry.fourcc) if (!entry.fourcc)

View file

@ -204,7 +204,8 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = {
"video/x-vp9, " "video/x-vp9, "
COMMON_VIDEO_CAPS "; " COMMON_VIDEO_CAPS "; "
"video/x-dirac, " "video/x-dirac, "
COMMON_VIDEO_CAPS "; " "video/x-qt-part, " COMMON_VIDEO_CAPS), COMMON_VIDEO_CAPS "; " "video/x-qt-part, " COMMON_VIDEO_CAPS "; "
"video/x-av1, " COMMON_VIDEO_CAPS),
GST_STATIC_CAPS (PCM_CAPS_FULL "; " GST_STATIC_CAPS (PCM_CAPS_FULL "; "
PCM_CAPS_UNPOSITIONED " ; " PCM_CAPS_UNPOSITIONED " ; "
MP123_CAPS " ; " MP123_CAPS " ; "
@ -227,7 +228,8 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = {
"GstMP4Mux", "GstMP4Mux",
GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"), GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"),
GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS ";" H265_CAPS ";" GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS ";" H265_CAPS ";"
"video/x-mp4-part," COMMON_VIDEO_CAPS), "video/x-mp4-part," COMMON_VIDEO_CAPS "; "
"video/x-av1, " COMMON_VIDEO_CAPS),
GST_STATIC_CAPS (MP123_CAPS "; " GST_STATIC_CAPS (MP123_CAPS "; "
AAC_CAPS " ; " AC3_CAPS " ; " ALAC_CAPS " ; " OPUS_CAPS), AAC_CAPS " ; " AC3_CAPS " ; " ALAC_CAPS " ; " OPUS_CAPS),
GST_STATIC_CAPS (TEXT_UTF8), GST_STATIC_CAPS (TEXT_UTF8),