Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » How does the 5 MB json size limit work
- Fennikin115
-
Scratcher
59 posts
How does the 5 MB json size limit work
I saw a project with 72 songs in it, so it got me wondering how the json size limit works.
I put one 11 MB song into scratch and it wouldn't save, so I have no idea how they were able to fit 72 songs.
Does it allow certain things to be over 5 MB, while not others? I have a project that's around 30 MB (Just because of code, though, it only has 1 song in it) that was able to save perfectly fine, so I'm guessing it might allow certain file types but not others.
I put one 11 MB song into scratch and it wouldn't save, so I have no idea how they were able to fit 72 songs.
Does it allow certain things to be over 5 MB, while not others? I have a project that's around 30 MB (Just because of code, though, it only has 1 song in it) that was able to save perfectly fine, so I'm guessing it might allow certain file types but not others.
Last edited by Fennikin115 (Nov. 9, 2024 20:31:00)
- BigNate469
-
Scratcher
1000+ posts
How does the 5 MB json size limit work
It seems that you don't fully understand Scratch's file format (don't worry, it's a bit confusing).
All a .sb3 file is is a renamed zipped folder. Changing the file extension to .zip should allow you to unzip it.
The project.json file inside that folder stores all of your code, comments, sprite names, extension metadata, links to assets (which I'll explain next) and other metadata (such as what version of Scratch was used to make the project). It can be at most 5MB in size.
Assets are things like sounds and costumes/backdrops. Scratch stores these inside the folder alongside the project.json, and not as a part of the project.json file itself. They're usually stored as .png (bitmap costumes/backdrops), .svg (vector costumes/backdrops), .wav (most sounds), or .mp3 (some uploaded sounds if you don't modify them) files. All of these can be used outside of Scratch, and none of them are Scratch-specific*. Assets can be up to 10MB in size each.
There is no overall project size limit.
*This goes for .json files, too. .json files are actually used quite widely, but not on the user-facing end of things, so most people don't notice them.
note that where the project.json file is relative to the assets is slightly different on the Scratch website internally; assets are usually hosted on assets.scratch.mit.edu, and the project.json is hosted on projects.scratch.mit.edu. Regardless of if it's a .sb3 file or being hosted on Scratch's servers, the way the project.json links to assets always points to the right asset, even if there are multiple named the same thing.
If you want to learn more, including the fine details of the project.json format and how blocks are represented, see https://en.scratch-wiki.info/wiki/Scratch_File_Format
All a .sb3 file is is a renamed zipped folder. Changing the file extension to .zip should allow you to unzip it.
The project.json file inside that folder stores all of your code, comments, sprite names, extension metadata, links to assets (which I'll explain next) and other metadata (such as what version of Scratch was used to make the project). It can be at most 5MB in size.
Assets are things like sounds and costumes/backdrops. Scratch stores these inside the folder alongside the project.json, and not as a part of the project.json file itself. They're usually stored as .png (bitmap costumes/backdrops), .svg (vector costumes/backdrops), .wav (most sounds), or .mp3 (some uploaded sounds if you don't modify them) files. All of these can be used outside of Scratch, and none of them are Scratch-specific*. Assets can be up to 10MB in size each.
There is no overall project size limit.
*This goes for .json files, too. .json files are actually used quite widely, but not on the user-facing end of things, so most people don't notice them.
note that where the project.json file is relative to the assets is slightly different on the Scratch website internally; assets are usually hosted on assets.scratch.mit.edu, and the project.json is hosted on projects.scratch.mit.edu. Regardless of if it's a .sb3 file or being hosted on Scratch's servers, the way the project.json links to assets always points to the right asset, even if there are multiple named the same thing.
If you want to learn more, including the fine details of the project.json format and how blocks are represented, see https://en.scratch-wiki.info/wiki/Scratch_File_Format
Last edited by BigNate469 (Nov. 9, 2024 21:01:36)
- Fennikin115
-
Scratcher
59 posts
How does the 5 MB json size limit work
It seems that you don't fully understand Scratch's file format (don't worry, it's a bit confusing).Thanks!
All a .sb3 file is is a renamed zipped folder. Changing the file extension to .zip should allow you to unzip it.
The project.json file inside that folder stores all of your code, comments, sprite names, extension metadata, links to assets (which I'll explain next) and other metadata (such as what version of Scratch was used to make the project). It can be at most 5MB in size.
Assets are things like sounds and costumes/backdrops. Scratch stores these inside the folder alongside the project.json, and not as a part of the project.json file itself. They're usually stored as .png (bitmap costumes/backdrops), .svg (vector costumes/backdrops), .wav (most sounds), or .mp3 (some uploaded sounds if you don't modify them) files. All of these can be used outside of Scratch, and none of them are Scratch-specific*. Assets can be up to 10MB in size each.
There is no overall project size limit.
*This goes for .json files, too. .json files are actually used quite widely, but not on the user-facing end of things, so most people don't notice them.
note that where the project.json file is relative to the assets is slightly different on the Scratch website internally; assets are usually hosted on assets.scratch.mit.edu, and the project.json is hosted on projects.scratch.mit.edu. Regardless of if it's a .sb3 file or being hosted on Scratch's servers, the way the project.json links to assets always points to the right asset, even if there are multiple named the same thing.
If you want to learn more, including the fine details of the project.json format and how blocks are represented, see https://en.scratch-wiki.info/wiki/Scratch_File_Format
- Discussion Forums
- » Advanced Topics
-
» How does the 5 MB json size limit work