transcoding: added intial support for VP8 (matroska container only)

This commit is contained in:
John Törblom 2013-07-17 16:04:06 +02:00
parent b7e4f3f064
commit e4b9f5960d
5 changed files with 32 additions and 2 deletions

View file

@ -62,6 +62,9 @@ streaming_component_type2codec_id(streaming_component_type_t type)
case SCT_MPEG2VIDEO:
codec_id = CODEC_ID_MPEG2VIDEO;
break;
case SCT_VP8:
codec_id = CODEC_ID_VP8;
break;
case SCT_AC3:
codec_id = CODEC_ID_AC3;
break;
@ -107,6 +110,9 @@ codec_id2streaming_component_type(enum CodecID id)
case CODEC_ID_MPEG2VIDEO:
type = SCT_MPEG2VIDEO;
break;
case CODEC_ID_VP8:
type = SCT_VP8;
break;
case CODEC_ID_AC3:
type = SCT_AC3;
break;

View file

@ -227,6 +227,11 @@ mk_build_tracks(mk_mux_t *mkm, const streaming_start_t *ss)
codec_id = "V_MPEG4/ISO/AVC";
break;
case SCT_VP8:
tracktype = 1;
codec_id = "V_VP8";
break;
case SCT_MPEG2AUDIO:
tracktype = 2;
codec_id = "A_MPEG/L2";

View file

@ -107,7 +107,8 @@ typedef struct transcoder {
#define WORKING_ENCODER(x) (x == CODEC_ID_H264 || x == CODEC_ID_MPEG2VIDEO || \
x == CODEC_ID_AAC || x == CODEC_ID_MP2)
x == CODEC_ID_VP8 || x == CODEC_ID_AAC || \
x == CODEC_ID_MP2)
uint32_t transcoding_enabled = 0;
@ -532,6 +533,20 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt)
octx->rc_buffer_size = 2 * octx->rc_max_rate;
break;
case SCT_VP8:
octx->codec_id = CODEC_ID_VP8;
octx->pix_fmt = PIX_FMT_YUV420P;
octx->qmin = 10;
octx->qmax = 20;
av_dict_set(&opts, "quality", "realtime", 0);
octx->bit_rate = 3 * octx->width * octx->height;
octx->rc_buffer_size = 8 * 1024 * 224;
octx->rc_max_rate = 2 * octx->bit_rate;
break;
case SCT_H264:
octx->codec_id = CODEC_ID_H264;
octx->pix_fmt = PIX_FMT_YUV420P;

View file

@ -945,6 +945,7 @@ static struct strtab streamtypetab[] = {
{ "TEXTSUB", SCT_TEXTSUB },
{ "EAC3", SCT_EAC3 },
{ "AAC", SCT_MP4A },
{ "VP8", SCT_VP8 },
};

View file

@ -199,9 +199,12 @@ typedef enum {
SCT_TEXTSUB,
SCT_EAC3,
SCT_MP4A,
SCT_VP8,
} streaming_component_type_t;
#define SCT_ISVIDEO(t) ((t) == SCT_MPEG2VIDEO || (t) == SCT_H264)
#define SCT_ISVIDEO(t) ((t) == SCT_MPEG2VIDEO || (t) == SCT_H264 || \
(t) == SCT_VP8)
#define SCT_ISAUDIO(t) ((t) == SCT_MPEG2AUDIO || (t) == SCT_AC3 || \
(t) == SCT_AAC || (t) == SCT_MP4A || \
(t) == SCT_EAC3)