📜 ⬆️ ⬇️

The module for receiving screenshots from the video - nginx-video-thumbextractor-module

We get screenshots from the video through NGINX using ImageMagick and ffmpeg


More recently, a new module nginx-video-thumbextractor-module
I wanted to publish as a link, but as you can see, there are no more topical links. Yes, and as a translation is no longer suitable for added ad-libbing.
In any case, I think that it is worth sharing this wonderful module with the Habrovites.
The status indicates that it is ready for production, which is very pleasing.

Dependencies:




Add a module when configuring / compiling ::


./configure --add-module=../nginx-video-thumbextractor-module --with-cc-opt='-I /usr/include/ImageMagick' 


Recommendation:


By default, ImageMagick uses OpenMP to stream images.
The author recommends configuring / compiling ImageMagick with the "—disable-openmp" option, as it is not a good idea to use stream processing inside workflows.
')

Configuration:


 location ~ /thumbs(.*) { video_thumbextractor; video_thumbextractor_video_filename $1; video_thumbextractor_video_second $arg_second; video_thumbextractor_image_width $arg_width; video_thumbextractor_image_height $arg_height; } 


Examples of using the above configuration:


# we get a picture from the 10th second of the original size.
localhost / thumbs / video.mp4? second = 10

# we get a picture from the 20th second and a height of 50px and a length of respecting the proportions of the video.
localhost / thumbs / video.mp4? second = 10 & height = 50

# we get a picture from the 30th second with a height of 50px and a 100px dilna, the picture will be cropped keeping the proportions of the video.
localhost / thumbs / video.mp4? second = 20 & height = 50 & width = 100

We are taking, we are looking at the directives on the module page .

I think this is a great solution for those who publish HTML video to add poster:
 <video controls="controls" poster="http://localhost/thumbs/movie.mp4?second=10"> <source src="movie.mp4" type="video/mp4" /> Your browser does not support the video tag. </video> 


And also, when commenting, refer to for a while and receive a picture of the type as a Youtube link for a specific time.

Source: https://habr.com/ru/post/134123/


All Articles