Turing Help, Puting Jpgs To Make Video
Author |
Message |
manwinder
|
Posted: Sun Jan 10, 2010 8:05 pm Post subject: 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). |
|
|
|
|
|
Sponsor Sponsor
|
|
|
manwinder
|
Posted: Sun Jan 10, 2010 8:06 pm Post subject: RE:Turing Help, Puting Jpgs To Make Video |
|
|
i forgot that is there a way i could use a variable to do that |
|
|
|
|
|
manwinder
|
Posted: Sun Jan 10, 2010 8:07 pm Post subject: 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
|
Posted: Sun Jan 10, 2010 8:19 pm Post subject: 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
|
Posted: Mon Jan 11, 2010 9:16 am Post subject: 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
|
|
|
|
|
Euphoracle
|
Posted: Tue Jan 12, 2010 12:25 am Post subject: 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
|
Posted: Tue Jan 12, 2010 12:49 pm Post subject: 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
Turing: |
frame10 := "T3 " + FILENUM (x1) + ".jpg"
|
and the function could like something like
Turing: |
function FILENUM (num: int): string
var filenum:= intstr(num )
if num< 10 then
filenum: ="00000000"+filenum
elsif num< 100 then
filenum: ="0000000"+filenum
elsif .. ..
end if
return filenum
end FILENUM
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Ktomislav
|
Posted: Tue Jan 12, 2010 2:42 pm Post subject: Re: RE:Turing Help, Puting Jpgs To Make Video |
|
|
mirhagk @ 12.1.2010, 18:49 wrote: 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
Turing: |
frame10 := "T3 " + FILENUM (x1) + ".jpg"
|
and the function could like something like
Turing: |
function FILENUM (num: int): string
var filenum:= intstr(num )
if num< 10 then
filenum: ="00000000"+filenum
elsif num< 100 then
filenum: ="0000000"+filenum
elsif .. ..
end if
return filenum
end FILENUM
|
Brute forcing. What if he had more than 100 images? |
|
|
|
|
|
Euphoracle
|
Posted: Tue Jan 12, 2010 2:52 pm Post subject: RE:Turing Help, Puting Jpgs To Make Video |
|
|
The simple solution here would to find the logarithm base 10 of the number in question to determine to what decimal degree the number extends to. One can then create a filename knowing that. |
|
|
|
|
|
DemonWasp
|
Posted: Tue Jan 12, 2010 7:16 pm Post subject: RE:Turing Help, Puting Jpgs To Make Video |
|
|
What may prove to be a simpler solution is to use intstr ( int_value, width ) to create a space-prefixed string of the value, such as:
(note: seven preceeding spaces)
Which you can then replace with the digit 0 with a little bit of string manipulation: 000000010. There are always several ways to do something, exactly how is up to you. |
|
|
|
|
|
manwinder
|
Posted: Wed Jan 13, 2010 7:43 am Post subject: Re: Turing Help, Puting Jpgs To Make Video |
|
|
i found out how to do it
thanks |
|
|
|
|
|
|
|