View Full Version :
returning a bitmap from an avs
TelemachusMH
1st January 2002, 09:01
Is it possible to return a bitmap image (or any image) from an avs script. I would like to make a script that will get a specific frame out of an mpeg-2 file, but I only want the script to return that one frame.
Thanks for the help,
TelemachusMH
TactX
1st January 2002, 18:03
Open your avs in VirtualDub.
Mark the frame(s) you want.
Save Image Sequence.
TelemachusMH
1st January 2002, 20:32
I would like to extract one frame and save it into a bitmap file without using other programs, just avisynth, if possible.
A little correction, I would like to get the bitmap from the avs with just avsynth I will save it into a file by other means.
TelemachusMH
3rd January 2002, 22:49
Does avisynth with no audio acually return a video or is a a series of bitmap images? If you set it to trim everything but one frame can you open it in paint or get it out some how so that it can?
dinesh
10th January 2002, 18:55
My understanding is that AVISynth is a video frame server and only returns an AVI File equivalent. Trimming it to One frame would result in an AVI File output of one frame.
Without the help of any other application (such as VDub or any other), I do not think you can get a BMP file from AVISynth output alone.
Rrrough
25th September 2002, 12:44
would a "snapshot-filter", that is taking snapshots at a configurable frame-distance be realizable ??? that would make image quality measuring a lot easier...
EDIT : favorable output format would be ppm (:))
cheers
Malcolm
25th September 2002, 14:35
an AVS is a 'file'. so it _always_ has to be opened by a program! AVISynth only operates on demand. That is the program with which you opened the AVS is requesting the next frame or audio.
If you opened an AVI, the codec decompresses the requested frame and gives it to the requesting program.
If you opened an AVS, AVISynth itself request a frame from the codec, processes it (through the functions and filters noted in the AVS) and then returns the processed frame to the requesting program.
bye, Malcolm
WarpEnterprises
25th September 2002, 15:07
In principal can AviSynth filter output something (Text,...) to a file.
But what would be the advantage of using a filter over using an application which does that already (as VD) ?
And using SelectEvery() outputs only some frames to VD which can then be saved via Save Image Sequence.
For image comparison open VD (preferably the VirtualDubAVS from Belgabor) twice and load your test scripts.
Rrrough
25th September 2002, 18:25
well, just as usual, I didn't make my idea clear. I know very well, what an avisynth script does, that's why I'm asking for a (scriptable) filter to do the output. i am trying to do image quality measure just like you did, warpenterprises with your compare()-script. i don't want to do that with PSNR (well, I consider using that too, as you get a big bunch of values with your script), but with a program called DCTune, as described in the following threads :
http://forum.doom9.org/showthread.php?threadid=34034
http://forum.doom9.org/showthread.php?threadid=33499&perpage=20&pagenumber=4
DCTune computes a perceptual error, which is supposedly better to evaluate picture (video) quality than PSNR (I'm no expert there...)
Therefore you need 2 pictures, the original and the decoded picture to compare, both needed as ppm file. Until now, Im doing this by jumping with VD to the frame number of interest, copying it to clipboard, pasting it in GIMP, saving it as BMP and converting it to PPM with Slowview. Doing that on a lot of pictures (to get a better statistic) is really painful... thus my question.
But I'll definetly try your script as well, warp !
cheers
Rrrough
25th September 2002, 19:18
And using SelectEvery() outputs only some frames to VD which can then be saved via Save Image Sequence
aaah, sunlight strikes my eyes, thanx man, that makes my day !!!
still no ppm, but a lot of pain less.
cheers !
jonas
26th September 2002, 10:15
well, this is basically the same question as the one that started the thread, but in other words,
but how much does a RGB24 frame differ from an BMP. BMP is plain a RGB file, isn't it?
So would it be possible to easily convert an RGB24 frame to BMP format?
jonas
WarpEnterprises
26th September 2002, 22:35
@Rrrough: hey, what about using TMPG to output to an image sequence? It natively supports PPM ;)
Rrrough
26th September 2002, 23:56
@Warp
didn't use it before, but thanx for another hint, will try it right away ! I guess, my image quality measuring gets fully automated soon !
Thanx again !!! :p
cheers
SILICON
28th September 2002, 00:36
I I have a program to measure the black bands of a film. But not like capturing a single frame (for AVS script to BMP format)
With that data I can calculate accurate resize. The height of IMAGE to be 16x (a exact number of macroblocks. This improvement the quality.
It can do it somebody?
Thanks...
Neoze
30th September 2002, 11:44
@Rrrough
>I guess, my image quality measuring gets fully automated soon !
Seem to be very promising. Tell us when you have success.
@SILICON
Fitcd do the job. It have an option to add border correspondind to your tv overscan. It's better for macroblock saving.
Rrrough
30th September 2002, 12:55
No big deal anymore, thanx again, warp !!! :)
Neoze, I'm already using it mainly for custom quantization matrices, look here :
http://forum.doom9.org/showthread.php?threadid=34493
but of course anything is possible, e.g. filter settings, codec settings, etc. I just like to have an objective view on these things.
cheers
SILICON
30th September 2002, 14:44
Originally posted by Neoze
@SILICON
Fitcd do the job. It have an option to add border correspondind to your tv overscan. It's better for macroblock saving. [/B]
Well, i know FITCD. I explain you all, for donīt mistake. Iīm sure that you know all this.
In a 2:35 aspectratio, we have a black border, a film and another black border. When we do resize we must take care of that the top and botoon black borders and the image have a height multiply of 16. That improvement the compression.
By example:
LoadPlugin("PATH\MPEG2DEC.DLL")
# load the film (resolution = 720x480)
Mpeg2Source("PATH\PELICULA.D2V")
# Resizes to 448x256 (16*16=256)
BilinearResize(448,256,27,72,666,336)
# add top and botoon black border (16x7=112). Add overscan (16).
AddBorders(16,112,16,112)
I want make a automatic FITCD. The new program measurin the top and botton black edge (they are not always equal)and, after, will make the calculate the correct value. This way I save the tedious work to measure them manually.
The problem is that I can't capture one image of avisynth.
You can see a actual aplication (in java) in
http://www.vcdsp.com/ripeo/calculadorarecorte/recorte.html . Itīs in Spanish languaje, but i can traslate to english if you like.
Bye
Neoze
30th September 2002, 17:23
@SILICON
if you want to export a few picture from a clip why not do:
clip=avisource...
picture1=trim(clip,500,-1)
picture2=trim(clip,1500,-1)
picture3=trim(clip,2500,-1)
picture4=trim(clip,3500,-1)
.../...
pictures=picture1+picture2+picture3+picture4
return pictures
and you open your file via tmpgenc and choose file/output to file/sequence
It's possible to automatise the process with tmpgenc with a little script you will name scriptxxx.vbs
dim osh
set osh = wscript.createobject("wscript.shell")
osh.run "C:\PROGRA~1\TMPGEN~2.146\TMPGEnc.exe",0
wscript.sleep 2000
osh.sendkeys "%F{u}"
wscript.sleep 500
osh.sendkeys "{DOWN}"
wscript.sleep 100
osh.sendkeys "{DOWN}"
wscript.sleep 100
osh.sendkeys "{DOWN}"
wscript.sleep 500
osh.sendkeys "{ENTER}"
osh.sendkeys "c:\temp\picture"
wscript.sleep 500
Maybee there is some tmpgenc command line who can do the job?
Or better to drive tmpgenc via dde or objects?
If somebody know a better way to do this job, if will appreciate any suggestion or reading.
Cheers
Neoze
2nd October 2002, 23:52
@SILICON
I want make a automatic FITCD. The new program measurin the top and botton black edge (they are not always equal)and, after,
Have you some news?
ronnylov
4th October 2002, 15:55
This is how I make a bitmap picture of one frame:
Open the avs in virtualdub, go to the frame you want.
Then copy input frame to clipboard.
Open Paint and paste to a new image.
Save the image in Paint as a bmp file.
SILICON
17th November 2002, 12:34
This exe make a bmp of AVS
For example, for capturing the frame 540:
devilop c:\film.avs 540
Only work in RGB.
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.