Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.sinclair > #2520
| From | Matthew Westcott <gasman@raww.org> |
|---|---|
| Newsgroups | comp.sys.sinclair |
| Subject | Re: Speccy video player in C?!! |
| Date | 2011-02-08 23:04 +0000 |
| Message-ID | <8re0ggFrrrU1@mid.individual.net> (permalink) |
| References | <e4e3c6fa-cd0c-4de7-b588-57fb290cdcb3@q2g2000pre.googlegroups.com> <8r23fpFjp6U1@mid.individual.net> <e5f41f0d-92d2-41fc-aaaa-8e91053053e0@8g2000prt.googlegroups.com> <8r29onFudkU1@mid.individual.net> <92e43e27-e2a2-492b-b144-37a28239b9a5@m16g2000prc.googlegroups.com> |
On 08/02/2011 14:20, BitNaughty wrote: > OK, had a read but..... how do you do the *video* compression? > The page says you need FFMPEG to build the converter - are you coding > the video into something MPEG related or something?!! I'm using FFMPEG to read in the original source video, since it handles every video format you're likely to encounter (not just MPEG) and returns a list of plain uncompressed images and wave audio. From there, the steps are: 1) Resize to 256x192 and adjust brightness / contrast according to the settings passed on the command line 2) Convert to Spectrum screen format (by looking at each attribute cell and trying every possible pair of colours in turn, dithering down to those two colours, measuring how far the result differs from the original, and selecting the closest one) 3) Compare that screen with the previous one*, making a list of all the runs of continuous bytes that differ between them (but with some tricky special cases: for example, if you've got two runs that are only a few bytes apart, it's better to treat them as one long run rather than having the extra overhead of reading two data chunks) 4) Write those chunks out to the file, while carefully reshuffling them so that they don't cross the ends of disk sectors. (This isn't something you'd usually worry about in a file format, because normally you'd have some low-level routines that check for that every time they read from disk... but here we don't have that luxury, because we're doing everything as quickly and cheaply as possible.) At the same time, keep a rough count of how long it's going to take the Spectrum to process the stuff you're generating, so that you can pick out the right sample from the audio stream that will be played at that point. The 'compression' step is step 3, which ensures that we're only storing the bits of screen data that change from one frame to the next. This is not so much about reducing file size, more about reducing the amount of work the Spectrum has to do. * actually, it's the one before previous, because we're doing double-buffering using the 128K's second screen, which means that we're updating the screen from two frames ago...
Back to comp.sys.sinclair | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Speccy video player in C?!! Matthew Westcott <gasman@raww.org> - 2011-02-04 12:29 +0000
Re: Speccy video player in C?!! "Paul E Collins" <find_my_real_address@CL4.org> - 2011-02-10 21:53 +0000
Re: Speccy video player in C?!! "Daniel Mandic" <daniel_mandic@hotmail.com> - 2011-02-10 22:29 +0000
Re: Speccy video player in C?!! Matthew Westcott <gasman@raww.org> - 2011-02-11 00:17 +0000
Re: Speccy video player in C?!! Matthew Westcott <gasman@raww.org> - 2011-02-13 16:26 +0000
Re: Speccy video player in C?!! Matthew Westcott <gasman@raww.org> - 2011-02-08 23:04 +0000
Re: Speccy video player in C?!! BitNaughty <bit-naughty@hotmail.com> - 2011-02-10 05:09 -0800
Re: Speccy video player in C?!! BitNaughty <bit-naughty@hotmail.com> - 2011-02-08 06:20 -0800
csiph-web