Generate thumbnails for video files on Synology NAS

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
User avatar
rednoah
The Source
Posts: 23064
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Generate thumbnails for video files on Synology NAS

Post by rednoah »

Media Indexing and video files

Media Indexing generates thumbnails for image files but does not generate thumbnails for video files (1, 2, 3) for some reason.


:!: File Station, DS File, Media Server and friends therefore cannot display thumbnails for video files:
Screenshot



:idea: Video Station does however generate thumbnails and those thumbnails are then available to File Station, DS File, Media Server and friends, even if the Video Station package is no longer installed. Looks like Video Station is simply using ffmpeg to generate a SYNOVIDEO_VIDEO_SCREENSHOT.jpg file in the @eaDir folder for each video file:

Console Output: Select all

$ while true; do ps -aefyl | grep ffmpeg | grep -v grep; sleep 0.1; done
/var/packages/CodecPack/target/bin/ffmpeg41 -timelimit 20 -an -ss 300 -i '/volume1/Media/Movies/The Man from Earth (2007).mkv' -vframes 1 -vf scale=size=hd480:force_original_aspect_ratio=decrease -f mjpeg -y '/volume1/Media/Movies/@eaDir/The Man from Earth (2007).mkv/SYNOVIDEO_TEMP.jpg'
$ find @eaDir
@eaDir/The Man from Earth (2007).mkv
@eaDir/The Man from Earth (2007).mkv/SYNOINDEX_MEDIA_INFO
@eaDir/The Man from Earth (2007).mkv/SYNOVIDEO_VIDEO_SCREENSHOT.jpg





Generate thumbnails for video files

The following filebot command uses -exec to execute ffmpeg for each video file to generate the missing thumbnail files:

Shell: Select all

filebot -find /path/to/input --filter 'def i = f.dir / "@eaDir" / f.name / "SYNOVIDEO_VIDEO_SCREENSHOT.jpg"; f.video && i.dir.exists() && !i.exists()' \
	-exec ffmpeg -timelimit 20 -an -ss 300 -i '{f}' -vframes 1 -vf scale=size=hd480:force_original_aspect_ratio=decrease -f mjpeg -y '{folder}/@eaDir/{f.name}/SYNOVIDEO_VIDEO_SCREENSHOT.jpg'
Screenshot





Generate thumbnails from movie posters

Fetch the movie poster for each movie file (see xattr metadata) and save it as SYNOVIDEO_VIDEO_SCREENSHOT.jpg file:

Shell: Select all

filebot -r /path/to/input --filter 'movie' -script g:'args.each{ f -> def i = f.dir / "@eaDir" / f.name / "SYNOVIDEO_VIDEO_SCREENSHOT.jpg"; if (i.dir.exists() && !i.exists()) println f.metadata.info.poster.saveAs(i) }'
Screenshot





Delete thumbnails for video files

Find and delete SYNOVIDEO_VIDEO_SCREENSHOT.jpg files:

Shell: Select all

find /path/to/input -name SYNOVIDEO_VIDEO_SCREENSHOT.jpg -print -delete
:idea: Please read the FAQ and How to Request Help.
Post Reply