HOW-TO create video preview thumbnails automatically

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
theophile Offline
Fan
Posts: 569
Joined: Jan 2009
Reputation: 30
Post: #41
I just worked up a bash script for Linux that will generate thumbs. Let me know if it works:

Code:
#!/bin/bash
ls *.wmv *.avi *.mkv *.ogm *.mpg | while read file; do
        ffmpeg -itsoffset -5 -i $file -vcodec mjpeg -vframes 1 -an -f rawvideo ${file:0:${#file}-3}tbn </dev/null
done

It assumes the video file extension is three characters, so it won't work on, say, a *.mpeg file.
find quote
rgviewer Offline
Junior Member
Posts: 7
Joined: May 2008
Reputation: 0
Post: #42
I have a Win MCE2005 that I record all my shows on to D:\Recorded TV (they have a .dvr-ms extension) and would like to be able to auto create thumbs to play back on xbmc. I am able to run this line in a cmd prompt to create thumbs using the following: but only by opening up a cmd prompt in the folder D:\Recorded TV and then pasting the line in.This works but I cann't run a task schedual.

"for /r %i in (*.dvr-ms) do ffmpeg -i "%i" -f mjpeg -t 0.001 -ss 5 -y "%~di%~pi%~ni.tbn"



I am able to run a batch file like this and use task schedual and it works perfect, but only if I move a recording inot a folder "C:\test" but if I subsitute "C:\test" with "D:\Recorded TV" it doesn't work. I don't want to manually move all my recording daily and plus the d:\recorded tv is where mce reads the file from.

@echo off

set FFMPEG=C:\Windows\System32\ffmpeg.exe
set THUMB="%%~di%%~pi%%~ni.tbn"
set MAKETHUMB=%FFMPEG% -i "%%i" -f mjpeg -t 0.001 -ss 5 -y %THUMB%
set FILES="*.mov" "*.dvr-ms" "*.avi" "*.flv" "*.wmv" "*.mp4"

for /r C:\test %%i in ( %FILES% ) do if not exist %THUMB% %MAKETHUMB%



Does anyone have any suggestions? Do I need to move all my recordings into another folder because of some permissions not allowing me to run a batch file into my recorded tv folder in MCE2005.
Hope this all makes sense.
Thanks Agian
find quote
LaTropa64 Offline
Fan
Posts: 649
Joined: Nov 2005
Reputation: 0
Post: #43
jaredharley Wrote:Vista's registry is just a little bit different. Place the below code into a normal text file, and save as a .reg file (should have the little blue cube of blocks icon).
Code:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.tbn\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
@="{3F30C968-480A-4C6C-862D-EFC0897BB84B}"
This does work on Vista.

Sorry for pulling up an old thread but I can't seem to get this to work. It did add to my registry but all tbn's still show as a generic icon in explorer instead of a preview of the pic like regular jpeg's do.



edit: Nevermind. I restarted the computer and it's working now.
(This post was last modified: 2009-04-06 00:28 by LaTropa64.)
find quote
neal73 Offline
Senior Member
Posts: 145
Joined: Apr 2008
Reputation: 12
Post: #44
Just a little bump on this thread - it works fine doing it this way, but has something been done that makes it easier yet? A nice little GUI version perhaps?
find quote
Hammi Offline
Senior Member
Posts: 156
Joined: Dec 2009
Reputation: 0
Post: #45
theophile Wrote:I just worked up a bash script for Linux that will generate thumbs. Let me know if it works:

Code:
#!/bin/bash
ls *.wmv *.avi *.mkv *.ogm *.mpg | while read file; do
        ffmpeg -itsoffset -5 -i $file -vcodec mjpeg -vframes 1 -an -f rawvideo ${file:0:${#file}-3}tbn </dev/null
done

It assumes the video file extension is three characters, so it won't work on, say, a *.mpeg file.

It basically works good, except for cases where there's a space in the name of the movie. The below version fixes that:

Code:
#!/bin/bash
ls *.wmv *.avi *.mkv *.ogm *.mpg | while read file; do
        ffmpeg -itsoffset -5 -i "$file" -vcodec mjpeg -vframes 1 -an -f rawvideo "${file:0:${#file}-3}tbn" </dev/null
done

The problem I still have is that while tbns are created, XBMC seems to ignore them, and rather automatically creates its own (which are broken and just show a grey box).

I have deleted the previously auto-created tbns from the cache, but they're just recreated...
find quote
Hammi Offline
Senior Member
Posts: 156
Joined: Dec 2009
Reputation: 0
Post: #46
Ok - another revision of the script, setting the time when the tbns are created to 2 mins into the movie, and checking if the tbn already exists, so that only new tbns are created.

Code:
#!/bin/bash
ls *.wmv *.avi *.mkv *.ogm *.mpg | while read file; do
if [ ! -f  "${file:0:${#file}-3}tbn" ]; then
   ffmpeg -itsoffset -120 -i "$file" -vcodec mjpeg -vframes 1 -an -f rawvideo "${file:0:${#file}-3}tbn" </dev/null
fi
chmod og+w *
done

If the movie has been stored in XBMC before, the new tbns are only used by XBMC, if the information for all episodes is updated in XBMC.
find quote
sourbob Offline
Member
Posts: 67
Joined: Jun 2011
Reputation: 0
Post: #47
joebrady Wrote:Yea, that's on my agenda for tonight. Too bad tvdb doesn't have a section for "Chilly Willy" cartoons tho....

It does now. Added it myself. Now if we can get someone to make some banners...
find quote
feerlessleadr Offline
Fan
Posts: 310
Joined: Oct 2007
Reputation: 0
Post: #48
Hate resurrecting an old thread, but I am trying to use the following batch file to create my thumbnails on my windows system, and I am getting empty tbn images with mkv files and tbn images that are hundreds of mb with avi files:

Code:
setlocal
set FFMPEG=C:\Users\Kevin\Stuff\ffmpeg\ffmpeg.exe
set THUMB="%%~di%%~pi%%~ni.tbn"
set MAKETHUMB=%FFMPEG% -i "%%i" -f mjpeg -t 0.001 -ss 10 -y %THUMB%

set FILES="*.mkv" "*.avi"

for /r %1 %%i in ( %FILES% ) do if not exist %THUMB% %MAKETHUMB%
endlocal

I am passing "F:\Test" as the %1 parameter in the above file

I have even tried just using the following and I am still get empty tbn files for mkv an huge tbn files for avi:

Code:
for %i in (*.avi) do ffmpeg -i "%i" -f mjpeg -t 0.001 -ss 5 -y "%~ni.tbn"

Code:
for %i in (*.mkv) do ffmpeg -i "%i" -f mjpeg -t 0.001 -ss 5 -y "%~ni.tbn"

Any ideas?

::EDIT:: Well I just upgraded to the latest static build of ffmpeg for windows and my avi problem is fixed, but the mkv tbn is still coming up as zero.
(This post was last modified: 2011-07-28 22:21 by feerlessleadr.)
find quote
Manta99 Offline
Junior Member
Posts: 5
Joined: Jun 2009
Reputation: 0
Post: #49
Code:
set MAKETHUMB=%FFMPEG% -i "%%i" -f mjpeg -vframes 1 -ss 10 -y %THUMB%

I think this will work. Thanks for the windows port btw! I'm running the script every time my HTPC wakes op from sleep to fill in missing thumbnails.
find quote
krasymir Offline
Junior Member
Posts: 1
Joined: Apr 2012
Reputation: 0
Post: #50
Nod
(2007-11-15 07:40)Calmiche Wrote:  Okay, I just found out about one of these and the other one I wrote. If you have seen them before, then don't complain. They are new to me.

---------------------------------------
Creating XBMC Thumbnails Automatically
---------------------------------------

I wanted to have thumbnails for all my television episodes. (All my episodes are on my windows PC, sheared over my network.) Instead of downloading each file individually, I found a tip on the XBMC wiki page.

http://www.xboxmediacenter.com/wiki/inde...thumbnails

1. Download this file:
http://ffdshow.faireal.net/mirror/ffmpeg...ev10908.7z

2. Extract that file (Including the DLL) into your \\Windows\System32 folder.

3. Open up a command prompt window in the root folder of your television shows and then type this command

for /r %i in (*.avi) do ffmpeg -i "%i" -f mjpeg -t 0.001 -ss 5 -y "%~di%~pi%~ni.tbn"

You can replace the (*.avi) with different file formats, including mp4, divx, rmvb, ogm and rm.

This will open up your episodes, skip 5 seconds in, take a screen shot, rename it to *.tbn and then go to the next file. It will also do any sub folder.

---------------------------------------
Seeing *.tbn files in Windows Explorer
---------------------------------------

I bet that you know that you can go into a folder in Windows XP, switch to Thumbnail view, and be presented with an icon of the first screen from a movie. It works for images as well. Unfortunately, it doesn't work for *.tbn files. Until now, that is.

1. Create a new text document.

2. Paste the following block of text into it.

REGEDIT4

[HKEY_CLASSES_ROOT\.tbn\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
@="{3F30C968-480A-4C6C-862D-EFC0897BB84B}"

3. Rename the file so that the extension is .reg (I named mine "tbn thumbnails.reg")

4. Double-click the file and you are all set. Windows XP will now see TBN thumbnails as images and create a windows thumbnail for them. You can see them in your folders on your computer.
<? php
exec ('for / r C :/ xampp / htdocs / public / uploads /% i in (*. flv, *. avi, *. mp4) do ffmpeg-i "% i"-f mjpeg-t 0.050-ss 20 -y "% ~ di% ~ pi% ~ ni.jpg" ')
?>
This record Thumbnail in C :/ xampp / htdocs / public / uploads /
Thumbnail How to write in C :/ xampp / htdocs / public / uploads / thumb /
sorry for bad English.
find quote
Post Reply