Trekky12 / kburns-slideshow

generate slideshow movies with Ken Burns effect on images
MIT License
58 stars 15 forks source link

Creation of temporary files ffmpeg is hardcoded to fixed commandline (ultrafast etc.) #16

Closed jedcooper closed 9 months ago

jedcooper commented 1 year ago

As title. So the general settings for ffmpeg commandline is obsolete. As I don't think it's intentionally I file this as an issue. For example I'm using: "output_parameters": "-preset p7 -tune hq -profile:v high -multipass qres -rc vbr -cq 16 -qmin 16 -qmax 16 -b:v 0k", along with "output_codec": "h264_nvenc", which is working fine working without temporary files for 3-4 pictures. But with a bigger pictures count it soon gets out of memory (log shows FFMPEG cancel) so using temporary files gets mandatory and - as said - user's custom ffmpeg quality commandline obsolete, unfortunately.

In slideshow/Queue.py: snippet.txt

Trekky12 commented 1 year ago

Could you please explain this in more detail? Indeed the ffmpeg command needs high ressources without temporary files. So for many slides it is recommended to use the temporary files option.

The ffmpeg command for the temporary files is optimized for speed. Nevertheless the general settings are used for the final video creation

https://github.com/Trekky12/kburns-slideshow/blob/2ccaa8fed9fd25efc1171634b4324566a8b83a70/slideshow/SlideManager.py#L832-L870

jedcooper commented 1 year ago

Hello, first thank you for your effort making this software! Appreciated! :D

Encoding with user setting be it speed or quality, your method using temporary files renders user quality/commandline obsolete. The temp files created by hardcoded "-preset ultrafast" are always worse in quality and final reencoded in user commandline quality which can't be in good quality anymore, because the source (temp files) are of "ultrafast/quick quality" and not the user set quality (or better).

The source has to be same or better quality than target. This is not the case with your hardcoded "-preset ultrafast", default bitrate etc. for temporary files, if the user wants more quality than "ultrafast" and default bitrate.

I'd strongly recommend creating lossless or near lossless quality temporary files. You've had something in mind yet I guess with commented CRF = 0.

I don't know how to link code from Queue.py here. Therefore I put a snippet.txt in OP. It contains the hardcoded always same "-preset ultrafast" quality temporary file generation.

What else do you need to know in detail?

Trekky12 commented 1 year ago

You are right, I will look into it and maybe add a new setting field for the temporary files creation.

Feel free to add a PR for this feature.

Trekky12 commented 12 months ago

@jedcooper Could you please test the source from the latest development branch?