Log in

View Full Version : Can avisynth export thumbnails?


dallas_dan
14th July 2006, 21:15
What would you use, in combination with avisynth, to export say three frames from an avi, resize them, and save them?

Gerard V
14th July 2006, 21:31
If you are only going to do this a few times, it would be much easier just to do the whole thing in Virtualdub. Ctrl-2 exports a frame from the output stream to the Windows clipboard.

So set up the filters to deinterlace, resize etc. and then clip the 3 particular frames you want to the clip board, paste into Gimp or Photoshop or whatever.

Gerard V
14th July 2006, 21:38
If you really want to do this in Avisynth you could look at http://www.avisynth.org/ImageWriter

Use trim to turn your entire movie into one that is only 3 frames long containing just the frames you want. Deinterlace, resize etc. to thumbnail size and then use Imagewriter to output the frames.

(Just a thought, 'cos I haven't tested this)

dallas_dan
14th July 2006, 22:40
Well, the idea is that I will be processing thousands of videos. I would like to set three capture points, say 15 secs. apart, to capture frames. That way I would have three chances to capture a decent frame. Then I would manually go through and select the frame I want to use. For the 20% or so of videos that don't get good frame selections, I would go back and manually export frames.

Gerard V
15th July 2006, 06:13
Try
AVISource("V:\Clips\Snaps3.avi").Trim(0,1130) # Make it quite short
Killaudio()
SeparateFields() # Not needed if not interlaced video
SelectOdd() # Not needed if not interlaced video
BicubicResize(100,80) # Make thumbnail size
ConvertToRGB()
ImageWriter(file="c:\temp\Thumb",start=0375,end=0375,type="jpg")
ImageWriter(file="c:\temp\Thumb",start=0750,end=0750,type="jpg")
ImageWriter(file="c:\temp\Thumb",start=1125,end=1125,type="jpg")


And play it. Change the folders and file names to suit of course.
:cool:

anonymez
15th July 2006, 06:17
maybe something like

avisource("video.avi")
selectevery(375,0) #select frame every 15 sec, for PAL
lanczosresize(w,h) #if you wish to resize
imagewriter("C:\path")

or simply use the first three lines only, open the script in vdub, file-->save image sequence

:)

dallas_dan
18th July 2006, 20:31
Try


And play it. Change the folders and file names to suit of course.
:cool:
This looks like this will do the trick, but what do I process the avs file with? I opened in vdub, and tried saving image sequence, but it started saving every frame.

I'm testing a combination of what you and anonymez posted.

dallas_dan
18th July 2006, 21:02
You guys rock...I pieced together bits from both of your ideas, and this seems to do the trick perfectly! Now what if I want to take two sizes 120x90 and 240x180 and save thumbs? Is it best to run two seperate scripts, or is this something that can be ran once?

avisource("D:video.avi")
Killaudio()
SeparateFields() # Not needed if not interlaced video
SelectOdd() # Not needed if not interlaced video
BicubicResize(120,90) # Make thumbnail size
ConvertToRGB()
selectevery(450,0) #select frame every 15 sec
imagewriter("D:\thumbs\",type="jpg")

hanfrunz
18th July 2006, 21:44
Of course you can :)

try:
avisource("D:video.avi")
Killaudio()
SeparateFields() # Not needed if not interlaced video
SelectOdd() # Not needed if not interlaced video
selectevery(450,0) #select frame every 15 sec
ConvertToRGB()

size1=BicubicResize(120,90) # Make thumbnail size 1
size2=BicubicResize(240,180) # Make thumbnail size 2

size1.imagewriter("D:\thumbs1\",type="jpg")
size2.imagewriter("D:\thumbs2\",type="jpg")

return 1 # you have to return something...



Now what if I want to take two sizes 120x90 and 240x180 and save thumbs? Is it best to run two seperate scripts, or is this something that can be ran once?

avisource("D:video.avi")
Killaudio()
SeparateFields() # Not needed if not interlaced video
SelectOdd() # Not needed if not interlaced video
BicubicResize(120,90) # Make thumbnail size
ConvertToRGB()
selectevery(450,0) #select frame every 15 sec
imagewriter("D:\thumbs\",type="jpg")

dallas_dan
18th July 2006, 21:56
Of course you can :)

try:
avisource("D:video.avi")
Killaudio()
SeparateFields() # Not needed if not interlaced video
SelectOdd() # Not needed if not interlaced video
selectevery(450,0) #select frame every 15 sec
ConvertToRGB()

size1=BicubicResize(120,90) # Make thumbnail size 1
size2=BicubicResize(240,180) # Make thumbnail size 2

size1.imagewriter("D:\thumbs1\",type="jpg")
size2.imagewriter("D:\thumbs2\",type="jpg")

return 1 # you have to return something...

Hmmm, I get "The script's return value was not a video clip"

dallas_dan
19th July 2006, 18:31
Sorry, I am still new to this script. Can anybody help point out what I am doing wrong?

smok3
19th July 2006, 18:38
try:
return ()

dallas_dan
19th July 2006, 19:16
try:
return ()
That throws an error too "Script error: syntax error (C:\thumbnail4.avs, line 11, column 9)"

Here is my script:avisource("D:video.avi")
Killaudio()
SeparateFields() # Not needed if not interlaced video
SelectOdd() # Not needed if not interlaced video
selectevery(90,0) #select frame every 3 sec
ConvertToRGB()
size1=BicubicResize(120,90) # Make thumbnail size 1
size2=BicubicResize(240,180) # Make thumbnail size 2
size1.imagewriter("D:\thumbs\120\",type="jpg")
size2.imagewriter("D:\thumbs\240\",type="jpg")
return ()

LocalH
19th July 2006, 19:23
Try return size1. If you're using ImageWriter to output your stills, then you really don't care what you return as the video clip.

smok3
19th July 2006, 19:36
yeah, right, now i see nothing gets through by default....

dallas_dan
19th July 2006, 19:38
Try return size1. If you're using ImageWriter to output your stills, then you really don't care what you return as the video clip.
That doesn't error, but it also doesn't create any thumbnails. Maybe I should just create two seperate scripts? :confused: