Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Speed Up Function

Author
Message
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 24th Oct 2006 13:35
I've Written a Function, that Converts an AVI file into a VOB file (Video OBject), But its extremely SLOW i've set the sync rate to 0 and put a 'sync' statement in each loop to write each byte. Its working at about 100 bytes a second.

Maybe im giving it too much to do? as it tells the user how big the file is and how much has been written.

It went quicker when i had less info to do, but i didn't know how long it would take. Any pointers?
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 24th Oct 2006 13:53
Use an timer to up date the screen should make it faster.



About how long it would take is an little harder. Use an verible to check how many you do in 1 sec. Max_Time = (File_Size - Current_Size) / Per_Sec . That should give you how long it will take. Then convert that time to H:M:S .
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 24th Oct 2006 14:26
Thanx Alien, Just tried that, but its still taking an age! worked it out to take 26 hrs to convert a 8.95mb file. Though when i first wrote it i fink it took about 2mins.

Im gunna take the info out so it has less calculations to do and see how long it takes.
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 24th Oct 2006 14:42
OMG! I took out all the Syncs and User Info and it converted it in like less than a second!
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 24th Oct 2006 16:33
Wo0o0o0o Got it working Uberly well now! though the buttons r a bit of a pain. I'll attach a demo soonish.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Oct 2006 00:52
Yeah you don't need "sync" unless you want it to refresh the screen.
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 25th Oct 2006 13:41
ok, so i have an AVI to VOB converter, for my next feat my mate wanted me to make a WMA to MP3 converter. Hopefully it'll b a sinch.
Turoid
22
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 25th Oct 2006 13:49
can you post up some code?

Captain America
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 26th Oct 2006 06:21
great!

now can we see some code?

thanks


Cheers,
Capt. America
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 27th Oct 2006 14:29
Heres the code.


Make sure you have the program in the folder with the media, as its only a basic file search.

The 'CUT' Variable which is set at the top, is a cutoff for how many files you can choose at once. MAX 100

It may look really simple, but it does work, and i've already made a dvd thanx to this.
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Oct 2006 15:24
that looks really simple compared to the actual format.

this is from doom9.org

http://www.doom9.org/index.html?/dvd-structure.htm


VOBs - Video OBjects

A VOB contains several streams multiplexed together: Video, Audio and Subtitles. Video is MPEG-2, audio can be AC-3, Linear PCM, Mpeg 2 multichannel or MPEG1 layer2 2 channel audio. AC3 is pretty much the standard and MPEG-2 multichannel can only be found on very few discs (one example is "In the line of fire, PAL edition") as this format was initially considered to be the standard format in Region2 (Europe and Japan) but was later dropped. PCM is mostly found on music DVDs and MP2 on cheaper productions. PCM is high quality uncompressed audio which takes a lot of space, hence it's not an ideal choice for full length movies with extras and possibly multiple languages. AC3 streams have a bitrate between 192 and 448kbit/s. 192kbit/s is used for 2 channel sound, and 384-448kbit/s for 5.1channel surround.

A VOB can contain one main video stream and several multiangle streams, allowing you to switch (as an example) the perspective during the movie. This feature is mostly used to display storyboards or other extra features during playback. The maximum bitrate of the video stream is 9.8mbit/s. Together, video and audio stream must be below 10mbit/s at any given moment. It's possible to have up to 9 different audio streams and you can usually switch the audio stream during playback (this feature can be disabled during the authoring phase of a DVD). It's also possible to have up to 32 different subtitle streams. Subtitles are 4 color bitmaps which are overlayed over the video stream, they're usually not encoded into the video stream.

Let's have a closer look at a VOB using our old favorite vStrip:

Scanning for stream id's, press control-c to quit...
Found 0xBF = Private 2 [@LBA 0]
Found VOB-ID: 01/CELL-ID: 01 [@LBA 0]
Encountered encrypted sector, attempting key recovery [@LBA 1]
Deduced key: 0xC00374C61C (2/2 vkey(s))
Found 0xE0 = Video 0 [PTS 0:00:00.290 @LBA 1]
Width = 720
Height = 480
Aspect-ratio = [3] 16:9 display
Frame-rate = [4] 29.97 (30000/1001) fps
Found 0xBD = Private 1, sub 0x80 [PTS 0:00:00.224 @LBA 99]
Found 0xBD = Private 1, sub 0x81 [PTS 0:00:00.224 @LBA 100]
Found 0xBD = Private 1, sub 0x82 [PTS 0:00:00.224 @LBA 101]
Found 0xBD = Private 1, sub 0x83 [PTS 0:00:00.224 @LBA 102]
Found 0xBE = Padding [@LBA 117]
Found 0xBD = Private 1, sub 0x20 [PTS 0:00:00.724 @LBA 169]
Found 0xBD = Private 1, sub 0x21 [PTS 0:00:00.724 @LBA 170]
Found VOB-ID: 02/CELL-ID: 01 [@LBA 378]

As said before there's usually just one video stream and it always has ID 0xE0. PTS is the Program Time Stamp and states when a certain stream starts with respect to the beginning of the VOB. As you can see the resolution is 720x480 so it's an NTSC DVD. The frame-rate of 29.97 basically states the same fact. The DAR of the stream is 16:9. Then there's 4 audio streams: 0x80 - 0x83. Note that these are AC3 streams. All AC3 streams are in stream 0xBD, substreams 0x8x. When there's a DTS stream it usually has stream id 0xBD 0x88 or 0xBD 0x89. PCM streams are also located in stream 0xBD, they have stream IDs 0xAx, from 0xA0 up to 0xA9. MP2 audio finally is located in the stream 0xCx. Here's an example from a PCM and MP2 stream:

Found 0xBD = Private 1, sub 0xA0 [PTS 0:11:01.479 @LBA 4]
Found 0xC0 = Audio 0 [PTS 0:00:00.440 @LBA 25]

There are also 2 substreams, 0x20 and 0x21. All subtitle streams are located in the 0xBD stream as well.

Furthermore there are usually padding streams (0xBE) but they don't concern us.

You might also have noticed the VOB and Cell IDs. A Cell is the smallest unit on a DVD. On a simple DVD this usually represents a chapter but it gets more complicated in many discs. If you're interested about Cells on a DVD I suggest you start learning how to use Scenarist, because only then will you truly understand how these works. When it comes to VOB IDs I still haven't found how they are created exactly and to what kind of structure they correspond. Usually each unit on its own has its own VOB ID, for instance the main movie and the trailer. In multiangle and seamless branching titles each angle has its own VOB ID.


Good luck if it works, it appears your just reading the same file in and out and changing the filename.

Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 27th Oct 2006 15:31
i actually thought it was too simple as well, but it seems to work.

Login to post a reply

Server time is: 2026-07-07 00:09:59
Your offset time is: 2026-07-07 00:09:59