[FFmpeg-devel] [PATCH] ffmpeg: always init output stream before reaping filters

Hendrik Leppkes h.leppkes at gmail.com
Sat Oct 7 11:20:58 EEST 2017


On Wed, Oct 4, 2017 at 12:48 AM, Marton Balint <cus at passwd.hu> wrote:
> Otherwise the frame size of the codec is not set in the buffersink.
>
> Fixes ticket #6603 and the following simpler case:
>
> ffmpeg -c aac -filter_complex "sine=d=0.1,asetnsamples=1025" out.aac
>
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  fftools/ffmpeg.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 1d248bc269..5be8788ea8 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -4528,6 +4528,15 @@ static int transcode_step(void)
>      }
>
>      if (ost->filter && ost->filter->graph->graph) {
> +        if (!ost->initialized) {
> +            char error[1024] = {0};
> +            ret = init_output_stream(ost, error, sizeof(error));
> +            if (ret < 0) {
> +                av_log(NULL, AV_LOG_ERROR, "Error initializing output stream %d:%d -- %s\n",
> +                       ost->file_index, ost->index, error);
> +                exit_program(1);
> +            }
> +        }
>          if ((ret = transcode_from_filter(ost->filter->graph, &ist)) < 0)
>              return ret;
>          if (!ist)

Doesn't this basically void all the work that was done to get proper
output frame information before initializing the output, so its
created with the proper info at all times?

- Hendrik


More information about the ffmpeg-devel mailing list