[FFmpeg-devel] [PATCH 09/13] lavc/videotoolboxenc: Add keyframes_only property
Rick Kern
kernrj at gmail.com
Sun Apr 10 05:50:14 CEST 2016
Outputs only I-frames when set.
Signed-off-by: Rick Kern <kernrj at gmail.com>
---
libavcodec/videotoolboxenc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 5430479..c9a60b7 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -77,6 +77,7 @@ typedef struct VTEncContext {
int64_t level;
int64_t entropy;
+ int64_t keyframes_only;
int64_t realtime;
bool flushing;
@@ -728,6 +729,16 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
}
}
+ if (vtctx->keyframes_only == 1) {
+ status = VTSessionSetProperty(vtctx->session,
+ kVTCompressionPropertyKey_AllowTemporalCompression,
+ kCFBooleanFalse);
+
+ if (status) {
+ av_log(avctx, AV_LOG_ERROR, "Error setting keyframes_only property: %d\n", status);
+ }
+ }
+
if (!vtctx->has_b_frames) {
status = VTSessionSetProperty(vtctx->session,
kVTCompressionPropertyKey_AllowFrameReordering,
@@ -1532,6 +1543,7 @@ static const AVOption options[] = {
{ "cavlc", "CAVLC entropy coding", 0, AV_OPT_TYPE_CONST, { .i64 = VT_CAVLC }, INT_MIN, INT_MAX, VE, "entropy" },
{ "cabac", "CABAC entropy coding", 0, AV_OPT_TYPE_CONST, { .i64 = VT_CABAC }, INT_MIN, INT_MAX, VE, "entropy" },
+ { "keyframes_only", "Output only I-frames", OFFSET(keyframes_only), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
{ "realtime", "Hint that encoding should happen in real-time if not faster (e.g. capturing from camera).",
OFFSET(realtime), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
--
2.7.4
More information about the ffmpeg-devel
mailing list