Thursday, September 18, 2008

Asset conversion

One of the problems with moving over to a Flash is that we can only import a finite set of file types at run-time. Flash doesn't support WAV or OGG or animated GIFs natively so part of the move is to clean out the asset system and convert file types where needed.

Originally when YTMND was created, there was no file type checking at all, people could basically upload anything and we would save it. Then we added simple file name checks, which removed a good portion of the miss-clicks, but people who had the proper file endings with invalid files still got through. The next variation of checks used mime-magic to actually check the file types to see if they were valid, but with the millions of different possibilities when encoding sound and images, mime-magic still wasn't perfect. In addition to that, the original mime-magic setup checked if the user uploaded a sound and an image, but didn't make sure they put them in the right fields.

Today, there are literally thousands of sites using images as sounds and vice versa, hundreds of sites using files we don't support like MIDI, OGG, etc. Hundreds more use word documents, zip files, executables, mpeg clips, etc. So far I've found some pretty interesting file types, once I do an initial pass on the whole file system I will post up statistics.


Now that I am at the stage where we need to convert the entire site over to work in Flash, I have written a much more thorough file type checking routine. One of the nice things about the fact that we are forced to do conversion on a lot of assets is that once we are in there converting, adding new file types will be easy. Hundreds of people have uploaded MIDI as sound files on their sites, which currently don't work at all. In the new conversion routine, MIDI files are converted to WAV and then compressed to MP3, so we can allow people to upload MIDI files if they want.

The new system will be basically be backwards compatible to the old system, so SWF versions of WAV files are just treated as children of the original asset, i.e. the original asset is archived. This means if we allowed MIDI files, they would be converted to MP3 to be heard in Flash, but users would still be able to download the original MIDI file from the site's asset pages.

So what sort of files do you think it would be beneficial to add to the allowed upload list? OGG? MOD? NSF or all the other 8 bit music types? What about image types?

I have thought about allowing SWF/FLV since a lot of people make their animated GIFs in Flash, but not only do I think the compression requires a human hand, I am concerned that YTMND would become even more of a YouTube clone than it is now.

Anyway that's all for now. Post a comment if you have any ideas or questions or hit up the IRC if you want to chat about it.

15 comments:

Anonymous said...

allow .mod so i can upload some hot chiptunes yo

Ochobobo said...

lol max

will-i-am said...

bloggged

keatonkeaton999 said...

4th

NICE EDITS said...

Nice Edits!

MasterP4000 said...

Thanks for starting up the blog. I would like to see you keep the .gif the standard image file. I'll second your worry about the site becoming a youtube knockoff. I believe part of the appeal to ytmnd is how poor some of the sites look. At least that's how I look at it. You truly see the artists talent when their pallet is limited.

Dr-L337 said...

6th and thanks for making the blog, and yes i agree keep .gif we do NOT need another youtube, that's what makes ytmnd unique. also, i'm totally getting laid right now.

Anonymous said...

Jut wanted to say that I fully support the full-flash site.

Anonymous said...

urgh dont turn ytmnd into another funnyflashvideoz.com

DaveTheRave said...

I'd Like To Not Use .flv, But We Are At A Point That We Kinda Do.

.Gif Was Never Indented To Be Sync'd Up With Sound, Hence All The Problems We Users Have To Go Through To Sync Something Up.

Some People Says "Thats The Fun In Making YTMNDs" .. No, The Fun Is Taking An Original Idea, Making A Kickass Animation For It, And Accompanying It With A Sound. Or The Opposite.

If You Don't Want The Youtube Direction, Just Don't Allow Any Other Video Types But .flv! There's Alot Of Retards Out There That Can't Convert Shit.

Or, If You REALLY Wanted To Keep .flv Out Of The Picture, Allow Animated .Png For The Love Of God! It Would Make My Day Sooo Much Easier

Just My 2 Cents

Anonymous said...

Allowing SWF files would be sweet but present something of a security issue. How do you ensure that no one is adding malicious script to their stuff? Or would you just strip out all the ActionScript?

I'll agree with the first anon though, that .mod files would be a cool addition.

Anonymous said...

I Don't Like It When You Needlessly Capitalize Every Word You Type Out.

Anonymous said...

If you did NSF, there'd have to be a way to choose which song in the NSF would be used. It might be more complicated than it's worth, but it would be a great way to put original chiptune music in a YTMND with little effort on the user's part (albeit great effort on the programmer's part).

Anonymous said...

Another thing I'd like to add: if you allow SWF, you'd make this Newgrounds. Newgrounds is its own thing, and YTMND is its own thing as well. Let's keep them separate.

FLV would naturally make this more about videos than creations.

So, I vote to keep SWF and FLV out.

max said...

isnt animated png backwards compatible? theoretically in the current system, apng should work fine. i dont know about flash though.