[FFmpeg-cvslog] lavc/videotoolboxenc: add concatentation properties
Rick Kern
git at videolan.org
Wed May 4 18:41:28 CEST 2016
ffmpeg | branch: master | Rick Kern <kernrj at gmail.com> | Wed Apr 27 10:53:12 2016 -0400| [4b806081b25ffa15e174a8c7a86343ea63f51670] | committer: wm4
lavc/videotoolboxenc: add concatentation properties
Add frames_before and frames_after as hints that there will be frames before
or after the frames produced in this session. This may help with
concatenation issues like bit rate spikes.
Signed-off-by: Rick Kern <kernrj at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b806081b25ffa15e174a8c7a86343ea63f51670
---
libavcodec/videotoolboxenc.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 45a6a33..e155383 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -77,6 +77,8 @@ typedef struct VTEncContext {
int64_t level;
int64_t entropy;
int64_t realtime;
+ int64_t frames_before;
+ int64_t frames_after;
int64_t allow_sw;
@@ -722,6 +724,30 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
}
}
+ if (vtctx->frames_before) {
+ status = VTSessionSetProperty(vtctx->session,
+ kVTCompressionPropertyKey_MoreFramesBeforeStart,
+ kCFBooleanTrue);
+
+ if (status == kVTPropertyNotSupportedErr) {
+ av_log(avctx, AV_LOG_WARNING, "frames_before property is not supported on this device. Ignoring.\n");
+ } else if (status) {
+ av_log(avctx, AV_LOG_ERROR, "Error setting frames_before property: %d\n", status);
+ }
+ }
+
+ if (vtctx->frames_after) {
+ status = VTSessionSetProperty(vtctx->session,
+ kVTCompressionPropertyKey_MoreFramesAfterEnd,
+ kCFBooleanTrue);
+
+ if (status == kVTPropertyNotSupportedErr) {
+ av_log(avctx, AV_LOG_WARNING, "frames_after property is not supported on this device. Ignoring.\n");
+ } else if (status) {
+ av_log(avctx, AV_LOG_ERROR, "Error setting frames_after property: %d\n", status);
+ }
+ }
+
if (!vtctx->has_b_frames) {
status = VTSessionSetProperty(vtctx->session,
kVTCompressionPropertyKey_AllowFrameReordering,
@@ -1534,6 +1560,11 @@ static const AVOption options[] = {
{ "realtime", "Hint that encoding should happen in real-time if not faster (e.g. capturing from camera).",
OFFSET(realtime), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+ { "frames_before", "Other frames will come before the frames in this session. This helps smooth concatenation issues.",
+ OFFSET(frames_before), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+ { "frames_after", "Other frames will come after the frames in this session. This helps smooth concatenation issues.",
+ OFFSET(frames_after), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+
{ NULL },
};
More information about the ffmpeg-cvslog
mailing list