diff options
author | John Stebbins <[email protected]> | 2016-05-27 08:05:53 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-05-27 13:53:16 -0600 |
commit | fe32414aef3a21fc7f42b38cc1f8eea8a62476a3 (patch) | |
tree | 6273f6cd63bee65f02555c825d3915aed2337f1f /libhb | |
parent | 9ec150b5461cc59eda93c5d3b3199fd97809972d (diff) |
enable libvpx VP9 encoder
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 5 | ||||
-rw-r--r-- | libhb/common.h | 1 | ||||
-rw-r--r-- | libhb/encavcodec.c | 7 | ||||
-rw-r--r-- | libhb/muxavformat.c | 6 | ||||
-rw-r--r-- | libhb/work.c | 4 |
5 files changed, 22 insertions, 1 deletions
diff --git a/libhb/common.c b/libhb/common.c index 32e0bc49a..c6a272cae 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -46,6 +46,7 @@ enum HB_GID_VCODEC_MPEG4, HB_GID_VCODEC_THEORA, HB_GID_VCODEC_VP8, + HB_GID_VCODEC_VP9, HB_GID_ACODEC_AAC, HB_GID_ACODEC_AAC_HE, HB_GID_ACODEC_AAC_PASS, @@ -240,6 +241,7 @@ hb_encoder_internal_t hb_video_encoders[] = { { "MPEG-4", "mpeg4", "MPEG-4 (libavcodec)", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG4, }, { { "MPEG-2", "mpeg2", "MPEG-2 (libavcodec)", HB_VCODEC_FFMPEG_MPEG2, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG2, }, { { "VP8", "VP8", "VP8 (libvpx)", HB_VCODEC_FFMPEG_VP8, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_VP8, }, + { { "VP9", "VP9", "VP9 (libvpx)", HB_VCODEC_FFMPEG_VP9, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_VP9, }, { { "Theora", "theora", "Theora (libtheora)", HB_VCODEC_THEORA, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_THEORA, }, }; int hb_video_encoders_count = sizeof(hb_video_encoders) / sizeof(hb_video_encoders[0]); @@ -258,6 +260,7 @@ static int hb_video_encoder_is_enabled(int encoder) case HB_VCODEC_FFMPEG_MPEG4: case HB_VCODEC_FFMPEG_MPEG2: case HB_VCODEC_FFMPEG_VP8: + case HB_VCODEC_FFMPEG_VP9: return 1; #ifdef USE_X265 @@ -1258,6 +1261,7 @@ void hb_video_quality_get_limits(uint32_t codec, float *low, float *high, break; case HB_VCODEC_FFMPEG_VP8: + case HB_VCODEC_FFMPEG_VP9: *direction = 1; *granularity = 1.; *low = 0.; @@ -1295,6 +1299,7 @@ const char* hb_video_quality_get_name(uint32_t codec) return "RF"; case HB_VCODEC_FFMPEG_VP8: + case HB_VCODEC_FFMPEG_VP9: return "CQ"; default: diff --git a/libhb/common.h b/libhb/common.h index 1b4cbc3fe..92cc1dadf 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -494,6 +494,7 @@ struct hb_job_s #define HB_VCODEC_FFMPEG_MPEG4 0x0000010 #define HB_VCODEC_FFMPEG_MPEG2 0x0000020 #define HB_VCODEC_FFMPEG_VP8 0x0000040 +#define HB_VCODEC_FFMPEG_VP9 0x0000080 #define HB_VCODEC_FFMPEG_MASK 0x00000F0 #define HB_VCODEC_QSV_H264 0x0000100 #define HB_VCODEC_QSV_H265 0x0000200 diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index 59c787326..677f8a22e 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -87,6 +87,10 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) { hb_log("encavcodecInit: VP8 encoder"); } break; + case AV_CODEC_ID_VP9: + { + hb_log("encavcodecInit: VP9 encoder"); + } break; default: { hb_error("encavcodecInit: unsupported encoder!"); @@ -201,7 +205,8 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) context->flags |= CODEC_FLAG_QSCALE; context->global_quality = FF_QP2LAMBDA * job->vquality + 0.5; //Set constant quality for libvpx - if ( w->codec_param == AV_CODEC_ID_VP8 ) + if ( w->codec_param == AV_CODEC_ID_VP8 || + w->codec_param == AV_CODEC_ID_VP9 ) { char quality[7]; snprintf(quality, 7, "%.2f", job->vquality); diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index 0a69d83f8..b7533d4dc 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -290,6 +290,12 @@ static int avformatInit( hb_mux_object_t * m ) priv_size = 0; break; + case HB_VCODEC_FFMPEG_VP9: + track->st->codec->codec_id = AV_CODEC_ID_VP9; + priv_data = NULL; + priv_size = 0; + break; + case HB_VCODEC_THEORA: { track->st->codec->codec_id = AV_CODEC_ID_THEORA; diff --git a/libhb/work.c b/libhb/work.c index 00573fce1..d318fe447 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -215,6 +215,10 @@ hb_work_object_t* hb_video_encoder(hb_handle_t *h, int vcodec) w = hb_get_work(h, WORK_ENCAVCODEC); w->codec_param = AV_CODEC_ID_VP8; break; + case HB_VCODEC_FFMPEG_VP9: + w = hb_get_work(h, WORK_ENCAVCODEC); + w->codec_param = AV_CODEC_ID_VP9; + break; case HB_VCODEC_X264_8BIT: case HB_VCODEC_X264_10BIT: w = hb_get_work(h, WORK_ENCX264); |