Log in

View Full Version : output video to ascii text


yair
12th April 2010, 20:54
hi,
i have a jpg sequence i want to convert to text file with 3 values per line,
x,y,value
is this possible with avisnyth?
if not, what should i search for.

Midzuki
13th April 2010, 03:58
hi,
i have a jpg sequence i want to convert to text file with 3 values per line,
x,y,value

:confused:

Need more info!

Stephen R. Savage
13th April 2010, 04:14
I will assume he means that he wants one line for each pixel, with the values x, y being the coordinates of the pixel and value being a representation of the data of the pixel. This is not possible in Avisynth without a plugin because Avisynth does not provide any interface for a script to access the individual pixels of a clip.

yair
13th April 2010, 07:11
Stephen understood,
i manged this using some other channel.
shame there isn't a plugin for this, seems trivial too.

Gavino
13th April 2010, 10:12
Avisynth does not provide any interface for a script to access the individual pixels of a clip.
Not directly, but I think it could be done in a script using PointResize with appropriate offsets, along with runtime functions (eg AverageLuma) to extract the data. But this would probably be horribly slow, so a plugin would be the way to go.

Midzuki
13th April 2010, 12:46
I have found this:

http://forum.doom9.org/showthread.php?t=64192

however I haven't ever tested the plugin,

play at your own risk. :)

Midzuki
13th April 2010, 14:45
OK, I've just tested the ShowPixelValues plugin,
and even though it works as it should on my PC,
its usefulness is rather limited —
— of course, the source-code needs to be rewritten in order to allow a "pure-text" output.

tin3tin
13th April 2010, 16:00
Yeah, get and set pixel values would be a very useful plugin especially in combination with gscript. :)

Gavino
13th April 2010, 17:07
This code shows the kind of thing that is possible using only the script language.
It gets the luma of a specified pixel (x, y) from a YV12 clip.
In a similar way, you could also write code to get U and V values, or the channels of an RGB clip.
ScriptClip("""
x = ...
y = ...
pixel = c.PointResize(4, 4, x/2*2, y/2*2, 2, 2).Crop(x%2*2, y%2*2, 2, 2)
luma = int(pixel.AverageLuma())
# now 'luma' is available to be shown in a subtitle or written to a file...
...
""")

However, using this (with GScript looping) to write out all pixels from even one frame of a normal-sized clip (that's a lot of pixels!) is extremely slow, so it's only practical for small areas of a frame.

tin3tin
13th April 2010, 22:13
On this site: http://www.vjamm.com/support_freeframe.php

Download this freeframe plugin:
http://camart-downloads.com/freeframe/AsciiArt2.zip

And try to find the FreeFrame Avisynth plugin in these forums.

Then use something like this to convert your video into ascii:
LoadPlugin("freeframe.dll")
converttorgb24()
Freeframe("AsciiArt2.dll",false,0.075,0,0)

(It is also included as a post effect in DVD slideshow GUI)

yair
13th April 2010, 22:26
freeframe FTW (but not this time)

btw,
has anyone got to play with freeframeGL > http://bit.ly/freeframeGL
oh i envy the audio guys for their VSTs

tin3tin
13th April 2010, 22:40
Here is the Avisynth plugin which will allow you to use FreeFrame 1.0 plugins in Avisynth:
http://avisynth.org/warpenterprises/files/freeframe_25_dll_20050426.zip

Works fine... :)

tin3tin
13th April 2010, 23:09
Here's a Youtube clip I just made for you to see with that effect done as descriped above:
http://www.youtube.com/watch?v=qJsmQjIqzAE&feature=player_embedded

yair
14th April 2010, 07:08
thanks for the effort tin3tin,

but this outputs an image and im looking for a txt file output
im looking for txt based image like > http://www.asciimation.co.nz/#

tin3tin
14th April 2010, 07:28
but this outputs an image and im looking for a txt file output
im looking for txt based image like > http://www.asciimation.co.nz/#
I don't think you'll find any shortcuts to do ascii animation like that - my guess is that it is "hand made".

Good luck