diff mbox

[FFmpeg-devel] ffmpeg_filter: enable stream_loop in HWAccel transcoding.

Message ID a4039c9c-9835-3a91-6373-ca7e5c1eebbb@gmail.com
State Superseded
Headers show

Commit Message

Jun Zhao March 14, 2018, 8:26 a.m. UTC
From 731b6cb1f3a13fa18cfe39c1ddba92050b999668 Mon Sep 17 00:00:00 2001
From: Jun Zhao <mypopydev@gmail.com>
Date: Wed, 14 Mar 2018 16:13:39 +0800
Subject: [PATCH] ffmpeg_filter: enable stream_loop in HWAccel transcoding.

use the cmd: ffmpeg -y -stream_loop 1 -hwaccel vaapi -hwaccel_device
/dev/dri/renderD128 -hwaccel_output_format vaapi -i
input.mp4 -c:v h264_vaapi output.mp4 can get the error like:

Error while decoding stream #0:1: Invalid data found when processing
input
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

the root cause is can't insert software scale filter in the hwaccel
transcoding pipeline.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 fftools/ffmpeg_filter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jun Zhao March 23, 2018, 12:26 a.m. UTC | #1
Ping?

The other thing: do we have a clean way to handle auto insert scale
filter in pipeline for HWaccel transcoding case in FFmpeg?

On 2018/3/14 16:26, Jun Zhao wrote:
Michael Niedermayer March 24, 2018, 12:14 a.m. UTC | #2
On Wed, Mar 14, 2018 at 04:26:54PM +0800, Jun Zhao wrote:
> 

>  ffmpeg_filter.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 170327a7137d3ce26124c86525566d32c523a948  0001-ffmpeg_filter-enable-stream_loop-in-HWAccel-transcod.patch
> From 731b6cb1f3a13fa18cfe39c1ddba92050b999668 Mon Sep 17 00:00:00 2001
> From: Jun Zhao <mypopydev@gmail.com>
> Date: Wed, 14 Mar 2018 16:13:39 +0800
> Subject: [PATCH] ffmpeg_filter: enable stream_loop in HWAccel transcoding.
> 
> use the cmd: ffmpeg -y -stream_loop 1 -hwaccel vaapi -hwaccel_device
> /dev/dri/renderD128 -hwaccel_output_format vaapi -i
> input.mp4 -c:v h264_vaapi output.mp4 can get the error like:
> 
> Error while decoding stream #0:1: Invalid data found when processing
> input
> 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
> 
> the root cause is can't insert software scale filter in the hwaccel
> transcoding pipeline.
> 
> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> ---
>  fftools/ffmpeg_filter.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index 877fd670e6..c85dd7ae8d 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -452,6 +452,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
>      int pad_idx = out->pad_idx;
>      int ret;
>      char name[255];
> +    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ofilter->format);
>  
>      snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
>      ret = avfilter_graph_create_filter(&ofilter->filter,
> @@ -461,7 +462,8 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
>      if (ret < 0)
>          return ret;
>  
> -    if (ofilter->width || ofilter->height) {
> +    if ((ofilter->width || ofilter->height) &&

> +        (!desc || (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)))) {

this can be simplified because after "!desc ||" desc is not NULL

about the patch itself, ill leave this to the people activly working on hwaccel

[...]
Jun Zhao March 26, 2018, 12:17 a.m. UTC | #3
On 2018/3/24 8:14, Michael Niedermayer wrote:
> On Wed, Mar 14, 2018 at 04:26:54PM +0800, Jun Zhao wrote:
>>  ffmpeg_filter.c |    4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 170327a7137d3ce26124c86525566d32c523a948  0001-ffmpeg_filter-enable-stream_loop-in-HWAccel-transcod.patch
>> From 731b6cb1f3a13fa18cfe39c1ddba92050b999668 Mon Sep 17 00:00:00 2001
>> From: Jun Zhao <mypopydev@gmail.com>
>> Date: Wed, 14 Mar 2018 16:13:39 +0800
>> Subject: [PATCH] ffmpeg_filter: enable stream_loop in HWAccel transcoding.
>>
>> use the cmd: ffmpeg -y -stream_loop 1 -hwaccel vaapi -hwaccel_device
>> /dev/dri/renderD128 -hwaccel_output_format vaapi -i
>> input.mp4 -c:v h264_vaapi output.mp4 can get the error like:
>>
>> Error while decoding stream #0:1: Invalid data found when processing
>> input
>> 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
>>
>> the root cause is can't insert software scale filter in the hwaccel
>> transcoding pipeline.
>>
>> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
>> ---
>>  fftools/ffmpeg_filter.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
>> index 877fd670e6..c85dd7ae8d 100644
>> --- a/fftools/ffmpeg_filter.c
>> +++ b/fftools/ffmpeg_filter.c
>> @@ -452,6 +452,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
>>      int pad_idx = out->pad_idx;
>>      int ret;
>>      char name[255];
>> +    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ofilter->format);
>>  
>>      snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
>>      ret = avfilter_graph_create_filter(&ofilter->filter,
>> @@ -461,7 +462,8 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
>>      if (ret < 0)
>>          return ret;
>>  
>> -    if (ofilter->width || ofilter->height) {
>> +    if ((ofilter->width || ofilter->height) &&
>> +        (!desc || (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)))) {
> this can be simplified because after "!desc ||" desc is not NULL
>
> about the patch itself, ill leave this to the people activly working on hwaccel
Yes, local have simplified the logic, will submit V2, Tks.
>
> [...]
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 877fd670e6..c85dd7ae8d 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -452,6 +452,7 @@  static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
     int pad_idx = out->pad_idx;
     int ret;
     char name[255];
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ofilter->format);
 
     snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
     ret = avfilter_graph_create_filter(&ofilter->filter,
@@ -461,7 +462,8 @@  static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
     if (ret < 0)
         return ret;
 
-    if (ofilter->width || ofilter->height) {
+    if ((ofilter->width || ofilter->height) &&
+        (!desc || (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)))) {
         char args[255];
         AVFilterContext *filter;
         AVDictionaryEntry *e = NULL;