
-----------------------------------
manwinder
Sun Jan 10, 2010 8:05 pm

Turing Help, Puting Jpgs To Make Video
-----------------------------------
so for my grade 10 project i was doing;playing a movie in turing with .jpgs, and i have converted terminator 3 into jpgs(about 188396 files). My teacher help me start it but i am having trouble with the file(jpg) going on the screen.
this is part of the code:
 

   var frame11 : int
    var frame10 : string

    setscreen ("graphics:640;360")
    for x1 : 1 .. 188396

        frame10 := "T3 00000000" + intstr (x1) + ".jpg"

        frame11 := Pic.FileNew (frame10)
        Pic.Draw (frame11, 0, 0, picMerge)
        Pic.Free (frame11)
delay(40)
        frame11 := Pic.FileNew ("T3 000000001.jpg")
        Pic.Draw (frame11, 0, 0, picUnderMerge)
        Pic.Free (frame11)

    end for

the problem is that the program i used to convert the video to jpegs put zero's in front of the frame,this is one of the files "T3 000000001.jpg", when ever i start it , it stops at frame 10, i think it does this :

it get the frames:
gets frame on: T3 000000001.jpg then T3 000000002.jpg then T3 000000003.jpg in till 9, and since i have  frame10 := "T3 00000000 " + intstr (x1) + ".jpg", the zeros after the T3 are the problem, every time up to 10 or 100 or 1000 or 10000, it has to take away a zero from the 8 zeros, so like when it is at one it has 8 zeros(T3 000000001.jpg, when it is at 10, it has 7 zeroes(T3 000000010.jpg), etc.

i need it to take away a zero everytime it goes to 10,100,1000 or is there a different way to do this, i don't want to rename the files(takes too much time).

-----------------------------------
manwinder
Sun Jan 10, 2010 8:06 pm

RE:Turing Help, Puting Jpgs To Make Video
-----------------------------------
i forgot that is there a way i could use a variable to do that

-----------------------------------
manwinder
Sun Jan 10, 2010 8:07 pm

RE:Turing Help, Puting Jpgs To Make Video
-----------------------------------
i forgot to ask:
the video runs a 25 fps, so 40 milliseconds for each frame, i tried that(delay(40)) but it kind of runs slow, what should i do

-----------------------------------
Euphoracle
Sun Jan 10, 2010 8:19 pm

RE:Turing Help, Puting Jpgs To Make Video
-----------------------------------
use Time.DelaySinceLast (this accounts for the time it takes to actually draw the image)

Also note that turing might not be able to draw the images to speed depending on the size and complexity of the compression and whether your code is redundant or not.

-----------------------------------
Ktomislav
Mon Jan 11, 2010 9:16 am

Re: Turing Help, Puting Jpgs To Make Video
-----------------------------------
You can rename everything in just a few clicks with FileRenamer or something similar.
But if you are using Windows you can select all .jpg files and right click -> rename -> type for example image
and your files will be autorenamed like "image (1).jpg", "image (2).jpg".

-----------------------------------
ProgrammingFun
Mon Jan 11, 2010 10:41 pm

RE:Turing Help, Puting Jpgs To Make Video
-----------------------------------
If you are using Windows XP, you can rename all of the files really fast (depending on your CPU and  RAM) by following the instructions on the following link: http://www.downloadsquad.com/2007/02/24/rename-multiple-files-at-once-in-windows-xp/

-----------------------------------
Euphoracle
Tue Jan 12, 2010 12:25 am

RE:Turing Help, Puting Jpgs To Make Video
-----------------------------------
CPU and RAM has absolutely no impact.  The bottleneck is your hard drive.  Also, it'll take less than 30 seconds assuming files < 10, 000.

-----------------------------------
mirhagk
Tue Jan 12, 2010 12:49 pm

RE:Turing Help, Puting Jpgs To Make Video
-----------------------------------
lol you could create a turing program to rename them if you really wanted to. But if you don't want to rename them I suggest you create a function to return the number of the file (in a string of course). you'd call it by doing

frame10 := "T3 " + FILENUM (x1) + ".jpg"


and the function could like something like

function FILENUM(num:int):string
var filenum:=intstr(num)
if num