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

Submitted by Leo Zhang on April 15, 2019, 3:11 a.m.

Details

Message ID 1555297861-30577-1-git-send-email-leozhang@qiyi.com
State New
Headers show

Commit Message

Leo Zhang April 15, 2019, 3:11 a.m.
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@qiyi.com>
---
 fftools/ffmpeg_filter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

mypopy@gmail.com April 15, 2019, 3:20 a.m.
On Mon, Apr 15, 2019 at 11:11 AM Leo Zhang <leozhang@qiyi.com> wrote:
>
> 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@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
>
Please refer to the link: https://patchwork.ffmpeg.org/patch/8173/,
Mark given a comments for this patch.

Patch hide | download patch | download mbox

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;