Having tried to generate a thumbnail of an MP4 video, I noticed that running ffmpeg took a lot of time to retrieve a thumbnail from a given time in the video. Upon inquiring, I found this comment interesting (https://superuser.com/a/821680)
Each invocation of above ffmpeg command takes a fraction of second (!) for ~1GB H.264. That is because it instantly jumps to
For the following test script with an MP4 file of 23m40s and 188Mb I give you the total execution time of this same script with the original order and the one I propose.
My tests were performed on a Windows 10 Pro 64bits with an Intel Core i7-10510U.
The order of the parameters definitely seems to have an importance on the performance of ffmpeg, unfortunately I don't have time to do more tests but I'll let you try on your side too.
This is my first issue and I hope I have respected the rules as much as possible 😢
Having tried to generate a thumbnail of an MP4 video, I noticed that running ffmpeg took a lot of time to retrieve a thumbnail from a given time in the video. Upon inquiring, I found this comment interesting (https://superuser.com/a/821680)
Currently in the creation of arguments for ffmpeg the argument
-ss
is placed after the definition of the source file. https://github.com/ScottyFillups/simple-thumbnail/blob/44379e88307c1aa2c8efee518dd2c1d4861eb566/index.js#L60-L68I have therefore rearranged the order of the arguments to put the
-ss
before the-i
as suggested in the comment above.For the following test script with an MP4 file of 23m40s and 188Mb I give you the total execution time of this same script with the original order and the one I propose.
The script:
The characteristics of the MP4 file (the return of ffprobe):
The execution time of the script with the original order:
The execution time of the script with the proposed order:
The time saving is huge for me, and I see the same time saving if I provide the MP4 file via a URL and not as a local file.
The execution time of the script with the file over the internet with the original order:
The execution time of the script with the file over the internet with the proposed order:
My tests were performed on a Windows 10 Pro 64bits with an Intel Core i7-10510U.
The order of the parameters definitely seems to have an importance on the performance of ffmpeg, unfortunately I don't have time to do more tests but I'll let you try on your side too.
This is my first issue and I hope I have respected the rules as much as possible 😢
Have a nice day !