Module for taking screenshots from video - nginx-video-thumbextractor-module

    Get screenshots from video via NGINX using ImageMagick and ffmpeg


    More recently, a new module appeared nginx-video-thumbextractor-module
    I wanted to publish as a link, but apparently there are no more topic links. and how the translation is no longer suitable for adding gag.
    In any case, I think it's worth sharing this wonderful module with the Khabrovchan.
    The status indicates that he is ready for production, which is very pleasing.

    Dependencies:


    • avformat - usually distributed with FFmpeg (but I had to install libavformat-dev on Ubuntu)
    • avcodec - usually distributed with ffmpeg
    • swscale - usually distributed with FFmpeg (but I had to install libswscale-dev on Ubuntu)
    • jpeg - libjpeg
    • MagickWand - usually distributed with ImageMagick


    Add 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 option “-disable-openmp", since it is not a good idea to use streaming 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 observing 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 forked 100px, the picture will be cropped in accordance with the proportion of the video.
    localhost / thumbs / video.mp4? second = 20 & height = 50 & width = 100

    We take it, look at the directives on the module page .

    I think this is a great solution for those who publish HTML videos to add poster:


    And also when commenting, refer to some time and get a picture like on Youtube a link for a certain time.

    Also popular now: