Avidemux Forum

Avidemux => Windows => Topic started by: Xaar on March 10, 2021, 12:16:51 PM

Title: Encoding speed slower in 2.7.8 than 2.6.21
Post by: Xaar on March 10, 2021, 12:16:51 PM
First of all, Thanks for a great piece of software.

I am trying to compress some presentation videos to x264 format, comprising of mostly animated slides with voice-over, on Windows 10 64bit. My video encoding configuration screenshot is attached.x264 encoding config.PNG

With 2.6.21, I get 300+ frames/sec while encoding, please see the attached screenshotencoding speed.PNG.
This drops to about 200 with 2.7.8 downloaded from http://www.avidemux.org/nightly/win64/

With release version 2.7.6, it drops to 70 frames per second, and quantiser is between 20-30, with same encoding settings.

Any idea why the drop in performance over old version?

I am keen to use newer version for - 1. better file loading speed, 2. better scripting support.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 10, 2021, 05:06:37 PM
Dozens of issues are fixed in the latest release compared to 2.7.6, much more issues were solved and features added compared to the 2.6.x generation. I don't think that using anything older than 2.7.8 can be even remotely considered.

I can only speculate about the reason why the "ultrafast" x264 preset in 2.6.21 was that fast. You could provide admlog.txt from encoding one and the same file with 2.6.21 and with 2.7.8.

By the way, the MP4v2 (libmp4v2) muxer is deprecated and effectively unsupported. All improvements go into the actively developed MP4 (libavformat) muxer.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: szlldm on March 10, 2021, 06:46:44 PM
Tested with the same settings, encoding fps is the same in 2.7.8 and 2.6.20 (almost 21 :) ).
What codec the source has? I did notice MPEG 1/2 decoding is faster in the old version, but modern codec decoding is significantly faster in 2.7.8
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: Xaar on March 11, 2021, 02:17:39 PM
Thank you for your replies.

Quote from: eumagga0x2a on March 10, 2021, 05:06:37 PMDozens of issues are fixed in the latest release compared to 2.7.6, much more issues were solved and features added compared to the 2.6.x generation. I don't think that using anything older than 2.7.8 can be even remotely considered.

I can only speculate about the reason why the "ultrafast" x264 preset in 2.6.21 was that fast. You could provide admlog.txt from encoding one and the same file with 2.6.21 and with 2.7.8.



By the way, the MP4v2 (libmp4v2) muxer is deprecated and effectively unsupported. All improvements go into the actively developed MP4 (libavformat) muxer.

Here are the logs for the same file encoded by 2.6.21 and 2.7.8
admlog-2-6-21-x264-AAC-fdk-MP4.txt
admlog-2-7-8-x264-AAC-fdk-MP4.txt


Quote from: szlldm on March 10, 2021, 06:46:44 PMTested with the same settings, encoding fps is the same in 2.7.8 and 2.6.20 (almost 21 :) ).
What codec the source has? I did notice MPEG 1/2 decoding is faster in the old version, but modern codec decoding is significantly faster in 2.7.8


Here is the source codec info from VLC
source file codec.PNG
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: szlldm on March 11, 2021, 03:06:28 PM
It looks like decoding of older MPEG4 codecs (DivX, Xvid, etc.) is slower.
In 2.7.1v2 the decoding is as fast as in 2.6.20.
In 2.7.2 the decoding is significantly slower (almost half fps).
In the new 2.7.8 the multithreaded decoding helps a lot, but still somewhat slower.

Even so, i suggest using 2.7.8.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 06:17:56 PM
Were you able to verify by benchmarking that decoding is the bottleneck?
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: szlldm on March 11, 2021, 06:22:06 PM
Using ultrafast preset, it looks like decoding is the botleneck.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 06:28:33 PM
Could you please benchmark decoding only (i.e. using null encoder and Dummy output)?
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: szlldm on March 11, 2021, 06:29:27 PM
QuoteIt looks like decoding of older MPEG4 codecs (DivX, Xvid, etc.) is slower.
In 2.7.1v2 the decoding is as fast as in 2.6.20.
In 2.7.2 the decoding is significantly slower (almost half fps).
In the new 2.7.8 the multithreaded decoding helps a lot, but still somewhat slower.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 06:33:22 PM
Thanks, I didn't miss that info, but it was not clear that you used null + dummy.

2.7.1 --> 2.7.2 is FFmpeg 3.x --> 4.x
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: szlldm on March 11, 2021, 06:38:24 PM
I was pretty sure ffmpeg change was the cause  ;D
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 06:50:49 PM
I've just benchmarked the legacy-compat branch (ffmpeg 3.3.9) and the current git master (ffmpeg 4.2.4) on Linux. With multi-threading disabled, I get fps ~ 500 with both, with a minimal advantage for 4.2.4 (maybe around 10 fps more). With multi-threading enabled on git master, I get a... significant (~30) fps drop!

Tested with a 856x480 divx clip about 8 min in duration.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 06:53:47 PM
Now it would be interesting to compare MinGW with VC++.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: szlldm on March 11, 2021, 06:56:29 PM
720p .mov file, fourCC DIVX
2.7.1v2 --> 690 fps
2.7.2 --> 390 fps
2.7.8 w/o MT --> 380 fps
2.7.8 w MT --> 510 fps

(2.7.8 buit from source)
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 07:04:44 PM
Benchmarked on Linux?

I get moderately faster results with 2.7.1v2 for the clip I mentioned earlier, ~ 550 fps.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 07:10:30 PM
I'm going to create a 1280x720 sample and retry. The size can actually matter.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 11, 2021, 07:35:29 PM
With a 1280x720 sample of ~10 minutes duration, I can fully confirm your findings.

2.7.8 with MT: 222 fps
2.7.8 w/o MT: 174 fps
2.7.1 MT n/a: 309 fps

Pretty remarkable.
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: Xaar on March 29, 2021, 09:40:36 AM
So, any suggestion to make 2.7.8 as fast as 2.6.21?
Title: Re: Encoding speed slower in 2.7.8 than 2.6.21
Post by: eumagga0x2a on March 29, 2021, 03:38:01 PM
No, the performance degradation seems to be related to upstream changes in FFmpeg during the 3.x.x --> 4.0 transition. It is beyond my skills to investigate this and the importance of the issue cannot be lower (the output is not corrupted, the speed is still good, the affected codecs are obsolete).

Unless a future update to FFmpeg 4.4 or 4.3.x improves the speed, I don't think I am going to take any action.