summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 41c709d681..1a0e909fb0 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -47,6 +47,7 @@
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/fifo.h"
+#include "libavutil/hwcontext.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
@@ -3421,7 +3422,9 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
!av_dict_get(ost->encoder_opts, "ab", NULL, 0))
av_dict_set(&ost->encoder_opts, "b", "128000", 0);
- if (ost->filter && av_buffersink_get_hw_frames_ctx(ost->filter->filter)) {
+ if (ost->filter && av_buffersink_get_hw_frames_ctx(ost->filter->filter) &&
+ ((AVHWFramesContext*)av_buffersink_get_hw_frames_ctx(ost->filter->filter)->data)->format ==
+ av_buffersink_get_format(ost->filter->filter)) {
ost->enc_ctx->hw_frames_ctx = av_buffer_ref(av_buffersink_get_hw_frames_ctx(ost->filter->filter));
if (!ost->enc_ctx->hw_frames_ctx)
return AVERROR(ENOMEM);