Saturday, January 23, 2016

Creating thumbnails for remote videos

You have some video files stored on some remote storage (dropbox, google drive) and you want to create thumbnails without downloading the whole file.

As a solution for this issue you can use libav and it's utility called avconv in order to extract a thumbnail from a video stored remotely, using the following command:
avconv -i http://url_to_video -r 1 -vframes 1 -s 256x256 -f image2 thumbnail.jpg
This will get you a 256x256 thumbnail from the first frame of the video.
avconv can be found in the libav-tools package in ubuntu.
avconv will download only ranges of bytes until it has enough information to extract the thumbnail from the required frame.

If, however, your video resource is stored somewhere with secure access only (https) - as most of the storage services use - you will need to build libav with SSL support in order to use avconv with the https url.
This can be done by following these steps, in the unzipped source code folder got from here:
sudo apt-get install build-essential yasm libx264-dev
./configure --enable-openssl --enable-gpl --enable-nonfree --enable-libx264 --prefix=<install dir prefix>
make 
make install
At this point you can use the first command line with the https protocol.

References:



No comments:

Post a Comment