Process 1 to create a basic thumbnails to video webam page

From MyWiki
Jump to: navigation, search

This is designed to be a very simple way to create thumbnails which are linked to the associated video. Its very basic as it will generate a lot of html files, one for each video ( most will not be of any interest ). We would prefer to generate the videos dynamically, but at least we can measure the time it takes to convert the videos. It might be in fact too long and cause a large delay in displaying the video, if we do the conversion dynamically.

Below is the syntax for creating thumbnails from a large jpg image.
In the case below we are reading all of the .jpg files in a directory :
mogrify -resize 200x200 -background white -gravity center -format jpg -quality 75 -path . full/*.jpg

There also is a command which can put annotations on pictures :
convert $FILENAME -background Khaki label:"${YEAR}/${MONTH}/${DAY} ${HOUR}:${MINUTE}:${SECOND}" -gravity Center -append label.jpg

To user html5 video we need to convert the .avi files generated by the webcam to .mp4 and .ogg
We use ffmpeg to do this.The syntax is as follows:
ffmpeg -i input.mp4 -vcodec mpeg4 output.mp4

While iterating through the directory images:

  1. Use script to select image which has not already got a thumbmail.
  2. Using the convert command create a thumbnail with a name prefixed by "thumb"
  3. From the associated .avi file create .ogg and .mp4 files using ffmpeg.
  4. Create the html file for displaying the movie in html format.
  5. Append to an index.html file which will be build up for each image.


Rough notes :
The following line gives an adequately sized image, but we need to add timestamp as text :
convert 01-20151004061034-00.jpg -resize 20% output.jpg --- This gives a shrinking of the image.
convert 01-20151004061034-00.jpg -resize 20% -background Khaki label:"this is label" -gravity Center -append output.jpg --!! this is good.

convert 32-20151020105753.png -background Khaki label:"this is label" -gravity Center -append output.png
Get the hour from the filename :
echo 46-20151020112856.png | awk 'BEGIN{FS="-"} { print $2}' | cut -c9-10
Get the minute
echo 46-20151020112856.png| awk 'BEGIN{FS="-"} { print $2}' | cut -c11-12