[FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: Fix error when both hwaccel and stream_loop applied

Leo Zhang leozhang at qiyi.com
Mon Apr 15 06:11:01 EEST 2019


For example:
 ./ffmpeg -hwaccel cuvid -c:v h264_cuvid -stream_loop -1 -i in.flv -c:v h264_nvenc  out.flv
will print below error messages after one loop:
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented

Add b_hwaccel check to fix the bug
Signed-off-by: Leo Zhang <leozhang at qiyi.com>
---
 fftools/ffmpeg_filter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 72838de..b8dd90a 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -460,6 +460,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
     int pad_idx = out->pad_idx;
     int ret;
     char name[255];
+    int b_hwaccel = ost->sync_ist && ost->sync_ist->hwaccel_id!=HWACCEL_NONE;
 
     snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
     ret = avfilter_graph_create_filter(&ofilter->filter,
@@ -469,7 +470,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
     if (ret < 0)
         return ret;
 
-    if (ofilter->width || ofilter->height) {
+    if (!b_hwaccel && (ofilter->width || ofilter->height)) {
         char args[255];
         AVFilterContext *filter;
         AVDictionaryEntry *e = NULL;
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list