HOW-TO create video preview thumbnails automatically

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
rgviewer Offline
Junior Member
Posts: 7
Joined: May 2008
Reputation: 0
Post: #31
I was wondering if someone could help me create a batch file to create thumbs. I can create thumbs by opening a command window in my folder using the line (for %i in (*.dvr-ms) do ffmpeg -i "%i" -f mjpeg -t 0.001 -ss 5 -y "%~ni.tbn") but so far I can't seem to use any of the batch files you all have suggested. I want to create thumbs for dvr-ms files that are storred in C:\Users\Public\Recorded TV. I may be doing this wrong but what I have done is copy your scripts and put them in a text file, saved it as test.bat and when I double click on it nothing happens. I think I set up the dirrectories correct. Any help would be much appreciated.
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,879
Joined: Aug 2007
Reputation: 101
Location: Eastleigh, UK
Post: #32
Post the exact batch file.
find quote
rgviewer Offline
Junior Member
Posts: 7
Joined: May 2008
Reputation: 0
Post: #33
here is what I put in a txt document and saved as test.bat

@echo off

setlocal
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="*.dvr-ms"
set DIRS=C:\Users\Public\Recorded TV\Sample Media

for /r C:\Users\Public\Recorded TV\Sample Media %%i in ( %FILES% ) do if not exist %THUMB% %MAKETHUMB%

endlocal
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,879
Joined: Aug 2007
Reputation: 101
Location: Eastleigh, UK
Post: #34
Is ffmpeg.exe in the corrent directory? ie C:\Windows\System32\ffmpeg.exe
That was causing me problems.
find quote
rgviewer Offline
Junior Member
Posts: 7
Joined: May 2008
Reputation: 0
Post: #35
Hitcher Wrote:Is ffmpeg.exe in the corrent directory? ie C:\Windows\System32\ffmpeg.exe
That was causing me problems.

yes I checked that also. I have tried this on two different computers, one xp and one vista.

I appreciate you taking the time to help me. Any more suggestions would be great.
Thanks
find quote
kingtiger01 Offline
Junior Member
Posts: 6
Joined: Sep 2008
Reputation: 0
Post: #36
Quote:http://forum.xbmc.org/showthread.php?tid=29699
Wouldnt this all be easier to just make a Service installer, that Has a menu that contains "Directory's" "file types" and "Date/times to run".

And have it update a batch file written directly to system32, that would run on a service base, that would loop the end of the script, endlessly, until the time specified is reached(best if written in hex), then run the begining of the batch. containing the Thumbnail Creation script...

I dont know about you, but it make it alot easier on alot of people. id do it but i dont have a scriptable installer creator. only thing i have or ever used is install4j...

and that wont do anyone any good Laugh.

Just thoughts...

--

Some one should also write a Python script to parse these pictures as thumbnails for files, for XBMC Xbox Flavor.. dont you think!?..
find quote
CASHMON3Y Offline
Donor
Posts: 395
Joined: Sep 2008
Reputation: 14
Location: Detroit, MI
Post: #37
Are video thumb nails whats supposed to go in that blank icon in aeon when you highlight over a tv show?
find quote
CASHMON3Y Offline
Donor
Posts: 395
Joined: Sep 2008
Reputation: 14
Location: Detroit, MI
Post: #38
NVM, I thought this for for video preview like the PS3 has. Where it shows like 5 seconds OF the video.
find quote
PantsOnFire Offline
Fan
Posts: 621
Joined: Aug 2008
Reputation: 2
Post: #39
Would it be hard to implement this feature into xbmc tho?

I mean we already have a screengrab feature which captures to a BMP. Could xbmc be expanded to turn that into a TBN file with the same filename as the video?
find quote
matador4 Offline
Junior Member
Posts: 1
Joined: Jan 2009
Reputation: 0
Post: #40
Pls.I know that this post have a long time to activated but someone may help.

I have 2 computers and i run the script in both of them.

In the first comp is running perfect and i have have thumnail in the folder.

In the second one the thumnail is next to the folder.

ANY IDEAConfusedConfused? HELPPPPPP
find quote
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: 147
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: 164
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