Discuss Scratch

asdf1546
Scratcher
33 posts

Uploading 3MB of text data onto a project... Is it possible?

For context, I've been able to distill a video into pure raw data, and have also compressed the data to the best of my ability.


However, the size of said data is still, at best, 3~4MB , after lots of lossy compression. After experimenting, Scratch refused to let me save any individual list with a file size of over 500 KB .


Does anyone have any tricks that might allow me to be able to upload the data, whilst not getting rejected by Scratch? I'm perfectly fine if the data is disjointed or moved around, just as long as I'm able to retrieve the full data through the code somehow. Do note that there is also a ~2MB .mp3 file too. Could it be the reason why?


Here are some things that have been tried:


  • Directly importing it into a list.
  • Turning it into a string and pasting it into a variable/ list.
  • Splitting up the data into smaller lists and importing them all in.


Is there still hope? Or do I have to decrease the quality / file size of the video, and if so, by how much?


when green flag clicked
think ["It's so over"] for (3) secs
say ["We're so back"] for (3) secs

Last edited by asdf1546 (June 26, 2024 03:22:02)

-_-Onscratch
Scratcher
100+ posts

Uploading 3MB of text data onto a project... Is it possible?

Try naming costumes with little bits of the data then loop through all the costumes and get the name of them to get the data.
asdf1546
Scratcher
33 posts

Uploading 3MB of text data onto a project... Is it possible?

-_-Onscratch wrote:

Try naming costumes with little bits of the data then loop through all the costumes and get the name of them to get the data.

I literally tried this moments before you posted… The problem is I either have to have hundreds, maybe thousands of costumes, or the costume names get to large, and Scratch literally crashes.

I thank you for your suggestion, however! I've nerfed the resolution by HALF, halved the framerate and compressed the colour data, and now Scratch has no complaints! It looks choppy and somewhat unintelligible now but it's probably fine.
awesome-llama
Scratcher
1000+ posts

Uploading 3MB of text data onto a project... Is it possible?

There is a file size limit of 5MB for project.json and 10MB per asset (costume, sound).

project.json is the file that defines the project and stores everything except for the asset data itself. You can see it yourself by extracting the files from the .sb3 file (which is just a .zip file) or opening it up in a file archiver (e.g. 7zip).
Look through the file, it will be clear what is taking up all the space. 3MB of text will fit as long as you don't have thousands of blocks or other data. Note that costume names are stored here too so it is not a solution to avoiding the limit.

You mentioned list which means I should say 2 things:
- Note that each list item has extra quotes and commas (due to its JSON representation). The best way to pack data into a project is to store it as a single string in a variable. If the data has to be split back into list items, do it when the project is run.
- Scratch stores 2 copies of the list. 1 is the data and the other is the list monitor you see on the screen. Whatever the list was last seen as (even after it was hidden) is what the copy will contain. There are a few solutions. The scratch method would be to delete the contents of the list, show it, hide it, and then add the data back. Do not show the list again. Alternatively you could use a Scratch mod like TurboWarp which does not save the extra copy.

Last edited by awesome-llama (June 27, 2024 02:07:21)

asdf1546
Scratcher
33 posts

Uploading 3MB of text data onto a project... Is it possible?

awesome-llama wrote:

Scratch stores 2 copies of the list. 1 is the data and the other is the list reporter you see on the screen. Whatever the list was last seen as (even after it was hidden) is what the copy will contain. There are a few solutions. The scratch method would be to delete the contents of the list, show it, hide it, and then add the data back. Do not show the list again. Alternatively you could use a Scratch mod like TurboWarp which does not save the extra copy.

AWESOME-LLAMA ONCE AGAIN PROVES HE IS THE GOAT

No wonder I could save 3MB on data on some projects, but not others. That really clears things up. I tried storing the data in variables, but only in the project that did not clear the list cache. Thanks once again for making Scratch a much better place to be!

when green flag clicked
if <(username) = [awesome-llama]> then
cook
end

Powered by DjangoBB