Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread wm4
On Mon, 29 Feb 2016 20:07:15 +0100
Clément Bœsch  wrote:

> On Mon, Feb 29, 2016 at 06:57:15PM +0100, wm4 wrote:
> [...]
> > > +static bool get_vt_profile_level(AVCodecContext *avctx,
> > > + CFStringRef*profile_level_val)
> > > +{
> > > +VTEncContext *vtctx = avctx->priv_data;
> > > +int64_t profile = vtctx->profile;
> > > +
> > > +if (profile == H264_PROF_AUTO && vtctx->level) {
> > > +//Need to pick a profile if level is not auto-selected.
> > > +profile = vtctx->has_b_frames ? H264_PROF_MAIN : 
> > > H264_PROF_BASELINE;
> > > +}
> > > +
> > > +*profile_level_val = NULL;
> > > +
> > > +switch (profile) {  
> 
> > > +case H264_PROF_AUTO:
> > > +return true;
> > > +  
> 
> We don't use bool in FFmpeg
> 
> > > +case H264_PROF_BASELINE:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_AutoLevel; break;
> > > +case 13: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_1_3;   break;
> > > +case 30: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_3_0;   break;
> > > +case 31: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_3_1;   break;
> > > +case 32: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_3_2;   break;
> > > +case 40: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_4_0;   break;
> > > +case 41: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_4_1;   break;
> > > +case 42: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_4_2;   break;
> > > +case 50: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_5_0;   break;
> > > +case 51: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_5_1;   break;
> > > +case 52: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_5_2;   break;
> > > +}
> > > +break;
> > > +
> > > +case H264_PROF_MAIN:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_AutoLevel; break;
> > > +case 30: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_3_0;   break;
> > > +case 31: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_3_1;   break;
> > > +case 32: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_3_2;   break;
> > > +case 40: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_4_0;   break;
> > > +case 41: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_4_1;   break;
> > > +case 42: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_4_2;   break;
> > > +case 50: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_5_0;   break;
> > > +case 51: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_5_1;   break;
> > > +case 52: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_5_2;   break;
> > > +}
> > > +break;
> > > +
> > > +case H264_PROF_HIGH:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_High_AutoLevel; break;
> > > +case 30: *profile_level_val = 
> > > kVTProfileLevel_H264_High_3_0;   break;
> > > +case 31: *profile_level_val = 
> > > kVTProfileLevel_H264_High_3_1;   break;
> > > +case 32: *profile_level_val = 
> > > kVTProfileLevel_H264_High_3_2;   break;
> > > +case 40: *profile_level_val = 
> > > kVTProfileLevel_H264_High_4_0;   break;
> > > +case 41: *profile_level_val = 
> > > kVTProfileLevel_H264_High_4_1;   break;
> > > +case 42: *profile_level_val = 
> > > kVTProfileLevel_H264_High_4_2;   break;
> > > +case 50: *profile_level_val = 
> > > kVTProfileLevel_H264_High_5_0;   break;
> > > +case 51: *profile_level_val = 
> > > kVTProfileLevel_H264_High_5_1;   break;
> > > +case 52: *profile_level_val = 
> > > kVTProfileLevel_H264_High_5_2;   break;
> > > +}
> > > +break;  
> 
> I don't understand: why don't you put the kVTProfileLevel_H264_* as const
> values? You won't have to do this mapping anymore.
> 
> [...]
> 

The level constants depend on the profile. Blame Apple.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Clément Bœsch
On Mon, Feb 29, 2016 at 08:14:10PM +0100, Nicolas George wrote:
> Le primidi 11 ventôse, an CCXXIV, Clement Boesch a écrit :
> > > > +case H264_PROF_BASELINE:
> > > > +switch (vtctx->level) {
> > > > +case  0: *profile_level_val = 
> > > > kVTProfileLevel_H264_Baseline_AutoLevel; break;
>   
> 
> 
> > > > +case H264_PROF_MAIN:
> > > > +switch (vtctx->level) {
> > > > +case  0: *profile_level_val = 
> > > > kVTProfileLevel_H264_Main_AutoLevel; break;
>   
> 
> > I don't understand: why don't you put the kVTProfileLevel_H264_* as const
> > values? You won't have to do this mapping anymore.
> 
> I wondered too, but I found an explanation. Apparently, the wrapped API
> combines the profile and level setting into a single constant. We could
> replicate that in FFmpeg, but the other codecs use separate profile and
> level options.
> 
> It could probably be done with an array instead of a switch; I do not know
> what results in the most compact code.
> 

Ah, my bad. OK

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Nicolas George
Le primidi 11 ventôse, an CCXXIV, Clement Boesch a écrit :
> > > +case H264_PROF_BASELINE:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Baseline_AutoLevel; break;
  


> > > +case H264_PROF_MAIN:
> > > +switch (vtctx->level) {
> > > +case  0: *profile_level_val = 
> > > kVTProfileLevel_H264_Main_AutoLevel; break;
  

> I don't understand: why don't you put the kVTProfileLevel_H264_* as const
> values? You won't have to do this mapping anymore.

I wondered too, but I found an explanation. Apparently, the wrapped API
combines the profile and level setting into a single constant. We could
replicate that in FFmpeg, but the other codecs use separate profile and
level options.

It could probably be done with an array instead of a switch; I do not know
what results in the most compact code.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Clément Bœsch
On Mon, Feb 29, 2016 at 06:57:15PM +0100, wm4 wrote:
[...]
> > +static bool get_vt_profile_level(AVCodecContext *avctx,
> > + CFStringRef*profile_level_val)
> > +{
> > +VTEncContext *vtctx = avctx->priv_data;
> > +int64_t profile = vtctx->profile;
> > +
> > +if (profile == H264_PROF_AUTO && vtctx->level) {
> > +//Need to pick a profile if level is not auto-selected.
> > +profile = vtctx->has_b_frames ? H264_PROF_MAIN : 
> > H264_PROF_BASELINE;
> > +}
> > +
> > +*profile_level_val = NULL;
> > +
> > +switch (profile) {

> > +case H264_PROF_AUTO:
> > +return true;
> > +

We don't use bool in FFmpeg

> > +case H264_PROF_BASELINE:
> > +switch (vtctx->level) {
> > +case  0: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_AutoLevel; break;
> > +case 13: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_1_3;   break;
> > +case 30: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_3_0;   break;
> > +case 31: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_3_1;   break;
> > +case 32: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_3_2;   break;
> > +case 40: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_4_0;   break;
> > +case 41: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_4_1;   break;
> > +case 42: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_4_2;   break;
> > +case 50: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_5_0;   break;
> > +case 51: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_5_1;   break;
> > +case 52: *profile_level_val = 
> > kVTProfileLevel_H264_Baseline_5_2;   break;
> > +}
> > +break;
> > +
> > +case H264_PROF_MAIN:
> > +switch (vtctx->level) {
> > +case  0: *profile_level_val = 
> > kVTProfileLevel_H264_Main_AutoLevel; break;
> > +case 30: *profile_level_val = 
> > kVTProfileLevel_H264_Main_3_0;   break;
> > +case 31: *profile_level_val = 
> > kVTProfileLevel_H264_Main_3_1;   break;
> > +case 32: *profile_level_val = 
> > kVTProfileLevel_H264_Main_3_2;   break;
> > +case 40: *profile_level_val = 
> > kVTProfileLevel_H264_Main_4_0;   break;
> > +case 41: *profile_level_val = 
> > kVTProfileLevel_H264_Main_4_1;   break;
> > +case 42: *profile_level_val = 
> > kVTProfileLevel_H264_Main_4_2;   break;
> > +case 50: *profile_level_val = 
> > kVTProfileLevel_H264_Main_5_0;   break;
> > +case 51: *profile_level_val = 
> > kVTProfileLevel_H264_Main_5_1;   break;
> > +case 52: *profile_level_val = 
> > kVTProfileLevel_H264_Main_5_2;   break;
> > +}
> > +break;
> > +
> > +case H264_PROF_HIGH:
> > +switch (vtctx->level) {
> > +case  0: *profile_level_val = 
> > kVTProfileLevel_H264_High_AutoLevel; break;
> > +case 30: *profile_level_val = 
> > kVTProfileLevel_H264_High_3_0;   break;
> > +case 31: *profile_level_val = 
> > kVTProfileLevel_H264_High_3_1;   break;
> > +case 32: *profile_level_val = 
> > kVTProfileLevel_H264_High_3_2;   break;
> > +case 40: *profile_level_val = 
> > kVTProfileLevel_H264_High_4_0;   break;
> > +case 41: *profile_level_val = 
> > kVTProfileLevel_H264_High_4_1;   break;
> > +case 42: *profile_level_val = 
> > kVTProfileLevel_H264_High_4_2;   break;
> > +case 50: *profile_level_val = 
> > kVTProfileLevel_H264_High_5_0;   break;
> > +case 51: *profile_level_val = 
> > kVTProfileLevel_H264_High_5_1;   break;
> > +case 52: *profile_level_val = 
> > kVTProfileLevel_H264_High_5_2;   break;
> > +}
> > +break;

I don't understand: why don't you put the kVTProfileLevel_H264_* as const
values? You won't have to do this mapping anymore.

[...]

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Michael Niedermayer
On Tue, Mar 01, 2016 at 01:30:58AM +0800, Rick Kern wrote:
> Autodetected by default. Encode using -codec:v vtenc.
> 
> Signed-off-by: Rick Kern 
[...]

> +/*
> + * contiguous_buf_size is 0 if not contiguous, and the size of the buffer
> + * containing all planes if so.
> + */
> +static int get_cv_pixel_info(
> +AVCodecContext *avctx,
> +const AVFrame  *frame,
> +int*color,
> +int*plane_count,
> +size_t *widths,
> +size_t *heights,
> +size_t *strides,
> +size_t *contiguous_buf_size)
> +{
> +VTEncContext *vtctx = avctx->priv_data;
> +int av_format   = frame->format;

> +int av_color_range  = frame->color_range;

needs av_frame_get_color_range() OR update to the API as documented
in libavutil/frame.h

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread wm4
On Tue,  1 Mar 2016 01:30:58 +0800
Rick Kern  wrote:

> Autodetected by default. Encode using -codec:v vtenc.
> 
> Signed-off-by: Rick Kern 
> ---
>  MAINTAINERS|1 +
>  configure  |   19 +
>  libavcodec/Makefile|1 +
>  libavcodec/allcodecs.c |1 +
>  libavcodec/vtenc.c | 1339 
> 
>  5 files changed, 1361 insertions(+)
>  create mode 100644 libavcodec/vtenc.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 155642b..650da3c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -289,6 +289,7 @@ Codecs:
>vp8   David Conrad, Jason Garrett-Glaser, 
> Ronald Bultje
>vp9   Ronald Bultje, Clément Bœsch
>vqavideo.cMike Melanson
> +  vtenc.c   Rick Kern
>wavpack.c Kostya Shishkov
>wmaprodec.c   Sascha Sommer
>wmavoice.cRonald S. Bultje
> diff --git a/configure b/configure
> index 8491fa1..c7af891 100755
> --- a/configure
> +++ b/configure
> @@ -289,6 +289,7 @@ External library support:
>--disable-sdldisable sdl [autodetect]
>--disable-securetransport disable Secure Transport, needed for TLS support
> on OSX if openssl and gnutls are not used 
> [autodetect]
> +  --disable-vtenc  disable VideoToolbox H.264 encoder [autodetect]
>--enable-x11grab enable X11 grabbing (legacy) [no]
>--disable-xlib   disable xlib [autodetect]
>--disable-zlib   disable zlib [autodetect]
> @@ -1509,6 +1510,7 @@ EXTERNAL_LIBRARY_LIST="
>  schannel
>  sdl
>  securetransport
> +vtenc
>  x11grab
>  xlib
>  zlib
> @@ -2672,6 +2674,9 @@ libzvbi_teletext_decoder_deps="libzvbi"
>  nvenc_encoder_deps="nvenc"
>  nvenc_h264_encoder_deps="nvenc"
>  nvenc_hevc_encoder_deps="nvenc"
> +vtenc_encoder_deps="vtenc VideoToolbox_VideoToolbox_h pthreads"
> +vtenc_encoder_select="bzlib zlib iconv"
> +vtenc_encoder_extralibs="-framework CoreFoundation -framework VideoToolbox 
> -framework CoreMedia"
>  
>  # demuxers / muxers
>  ac3_demuxer_select="ac3_parser"
> @@ -5695,6 +5700,20 @@ enabled openssl   && { use_pkg_config openssl 
> openssl/ssl.h SSL_library_
> check_lib openssl/ssl.h SSL_library_init 
> -lssl -lcrypto -lws2_32 -lgdi32 ||
> die "ERROR: openssl not found"; }
>  enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
> qtkit_indev; }
> +{ disabled vtenc_encoder && disable vtenc; } || 
> +{ disabled vtenc && 
> +  disable vtenc_encoder; } ||
> +{ enabled vtenc &&
> +  require VideoToolbox 
> VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames 
> -framework VideoToolbox &&
> +  enable vtenc_encoder; } ||
> +{ enabled vtenc_encoder &&
> +  check_lib VideoToolbox/VTCompressionSession.h 
> VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox &&
> +  enable vtenc; } ||
> +{ disable vtenc && 
> +  disable vtenc_encoder; }
> +enabled vtenc_encoder&& check_header "TargetConditionals.h" &&
> +{ check_cpp_condition "TargetConditionals.h" 
> "TARGET_OS_MAC && !TARGET_OS_IPHONE" &&
> +  vtenc_encoder_extralibs+=" -framework 
> VideoDecodeAcceleration"; }
>  
>  # libdc1394 check
>  if enabled libdc1394; then
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 5389725..63fbb80 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -120,6 +120,7 @@ OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
>  OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
>  OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
>  OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
> +OBJS-$(CONFIG_VTENC)   += vtenc.o
>  OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
>  OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
>  OBJS-$(CONFIG_VP8DSP)  += vp8dsp.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 2097db0..29724bb 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -610,6 +610,7 @@ void avcodec_register_all(void)
>  REGISTER_ENCODER(HEVC_QSV,  hevc_qsv);
>  REGISTER_ENCODER(LIBKVAZAAR,libkvazaar);
>  REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
> +REGISTER_ENCODER(VTENC, vtenc);
>  
>  /* parsers */
>  REGISTER_PARSER(AAC,aac);
> diff --git a/libavcodec/vtenc.c 

[FFmpeg-devel] [PATCH v8] VideoToolbox H.264 Encoder

2016-02-29 Thread Rick Kern
Autodetected by default. Encode using -codec:v vtenc.

Signed-off-by: Rick Kern 
---
 MAINTAINERS|1 +
 configure  |   19 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/vtenc.c | 1339 
 5 files changed, 1361 insertions(+)
 create mode 100644 libavcodec/vtenc.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 155642b..650da3c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -289,6 +289,7 @@ Codecs:
   vp8   David Conrad, Jason Garrett-Glaser, 
Ronald Bultje
   vp9   Ronald Bultje, Clément Bœsch
   vqavideo.cMike Melanson
+  vtenc.c   Rick Kern
   wavpack.c Kostya Shishkov
   wmaprodec.c   Sascha Sommer
   wmavoice.cRonald S. Bultje
diff --git a/configure b/configure
index 8491fa1..c7af891 100755
--- a/configure
+++ b/configure
@@ -289,6 +289,7 @@ External library support:
   --disable-sdldisable sdl [autodetect]
   --disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used 
[autodetect]
+  --disable-vtenc  disable VideoToolbox H.264 encoder [autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --disable-xlib   disable xlib [autodetect]
   --disable-zlib   disable zlib [autodetect]
@@ -1509,6 +1510,7 @@ EXTERNAL_LIBRARY_LIST="
 schannel
 sdl
 securetransport
+vtenc
 x11grab
 xlib
 zlib
@@ -2672,6 +2674,9 @@ libzvbi_teletext_decoder_deps="libzvbi"
 nvenc_encoder_deps="nvenc"
 nvenc_h264_encoder_deps="nvenc"
 nvenc_hevc_encoder_deps="nvenc"
+vtenc_encoder_deps="vtenc VideoToolbox_VideoToolbox_h pthreads"
+vtenc_encoder_select="bzlib zlib iconv"
+vtenc_encoder_extralibs="-framework CoreFoundation -framework VideoToolbox 
-framework CoreMedia"
 
 # demuxers / muxers
 ac3_demuxer_select="ac3_parser"
@@ -5695,6 +5700,20 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h SSL_library_
check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
+{ disabled vtenc_encoder && disable vtenc; } || 
+{ disabled vtenc && 
+  disable vtenc_encoder; } ||
+{ enabled vtenc &&
+  require VideoToolbox 
VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames 
-framework VideoToolbox &&
+  enable vtenc_encoder; } ||
+{ enabled vtenc_encoder &&
+  check_lib VideoToolbox/VTCompressionSession.h 
VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox &&
+  enable vtenc; } ||
+{ disable vtenc && 
+  disable vtenc_encoder; }
+enabled vtenc_encoder&& check_header "TargetConditionals.h" &&
+{ check_cpp_condition "TargetConditionals.h" 
"TARGET_OS_MAC && !TARGET_OS_IPHONE" &&
+  vtenc_encoder_extralibs+=" -framework 
VideoDecodeAcceleration"; }
 
 # libdc1394 check
 if enabled libdc1394; then
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5389725..63fbb80 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -120,6 +120,7 @@ OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
 OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
 OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
+OBJS-$(CONFIG_VTENC)   += vtenc.o
 OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
 OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
 OBJS-$(CONFIG_VP8DSP)  += vp8dsp.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2097db0..29724bb 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -610,6 +610,7 @@ void avcodec_register_all(void)
 REGISTER_ENCODER(HEVC_QSV,  hevc_qsv);
 REGISTER_ENCODER(LIBKVAZAAR,libkvazaar);
 REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
+REGISTER_ENCODER(VTENC, vtenc);
 
 /* parsers */
 REGISTER_PARSER(AAC,aac);
diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c
new file mode 100644
index 000..62770cf
--- /dev/null
+++ b/libavcodec/vtenc.c
@@ -0,0 +1,1339 @@
+/*
+ * copyright (c) 2015 Rick Kern 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the