Opened 6 days ago

Last modified 2 days ago

#7542 new defect

Low encoding performance depending on input method with filter complex

Reported by: daneelveloper Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords:
Cc: cus Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

For testing video encoding performance (audio is negligible) I'm using command line ffmpeg.exe (4.0.2) and a single video clip. 1920x1080, 29.97 fps, h264 video, aac audio 48000khz stereo.

The following command encodes at an average 4.5x speed:

ffmpeg -i input.mp4 -filter_complex "negate" -c:v mpeg4 -y output.mpeg

But the next command only gets to 1.7x speed:

ffmpeg -filter_complex "movie=input.mp4,negate" -c:v mpeg4 -y output.mpeg

The difference is quite remarkable considering both are basically the same process. Maybe movie filter could be improved to speed encoding up.

Thank you.

Change History (6)

comment:1 Changed 4 days ago by cus

  • Analyzed by developer set
  • Cc cus added
  • Component changed from undetermined to avfilter
  • Reproduced by developer set
  • Version changed from unspecified to git-master

The movie source does not set the thread count to auto, therefore it uses a single threaded video decoder.

comment:2 Changed 3 days ago by daneelveloper

Let me add that split filter derived sources seems to be also single threaded. It be great if both input methods could be multithreaded as -i ones.

comment:3 Changed 3 days ago by richardpl

Can you please give example for split filter?

comment:4 Changed 3 days ago by daneelveloper

In this examples I'm splitting the input clip (1920x1080, 29.97 fps, h264 video, aac audio 48000khz stereo. Audio negligible) into two separate inputs.

Speed values as reported by ffmpeg.exe (4.0.2)

This one runs at 4.15x speed.

ffmpeg -i input.mp4 -filter_complex "split[v0][v1],[v0][v1]blend=extremity" -c:v mpeg4 -y output.mp4

And the next just goes up to 1.65x speed.

ffmpeg -filter_complex "movie=input.mp4,split[v0][v1];[v0][v1]blend=extremity" -c:v mpeg4 -y output.mp4

In the second example it's obvious the slowness comes from movie filter but it also states that split filter derived inputs won't improve speed.

Thank you.

Last edited 3 days ago by daneelveloper (previous) (diff)

comment:5 follow-up: Changed 3 days ago by richardpl

Sorry, but how split filter could improve speed over movie slowness?

comment:6 in reply to: ↑ 5 Changed 2 days ago by daneelveloper

Replying to richardpl:

Sorry, but how split filter could improve speed over movie slowness?

As you point out, I agree it seems split filter is not a bottleneck but the non-optimized operation of movie filter source compared to -i input alternative.

Note: See TracTickets for help on using tickets.