Translation notice
This page was translated with machine translation and may contain inaccuracies. If you can help improve it, please open an issue or submit a pull request.
See
[A little research on equipment mask (camera_overlay)
- CR_019](/en/resources/dust/2/2-装备遮罩.md)
Table of contents
- Table of contents
- Preface
- download
- Video Request
- dialog
- Configuration
- principle
- instruction
- About sequence pictures
- Notes
Preface
Based on the data pack, this project provides a sequence of images played in vanillaMinecraft to achieve pseudo-playing video effects.
Data pack mainly has the following uses
Automatically calculate frame rate and batch process frame files
Provide adaptive frame rate to improve performance. Provide interface for quick configuration and play sequence pictures in resource pack.
Some variables are also provided for quickly adding resource pack to achieve fast playback of sequence pictures
warn
This data pack uses the equipment head to trigger the equipment mask by default. If you don't want to use the head equipment bar, you can change it in dp (currently V2.0 requires this)
A transparent model has been added to the resource pack to provide equipment with mask items to achieve a "pseudo" effect of being playable without providing items.
Sequence pictures refers to a set of picture files that save each frame of video or animation as an independent static image file and are arranged in sequence by frame number. It is often used in film and television post-production, 3D animation, special effects production and other fields. It is widely used because of its high cross-platform compatibility and lossless image quality.
download
You can go to Modrinth and GithubDownload this prepackage
Video requirements
It needs to be a picture sequence (.png format)
Use accelerated gaming to play 60fps video
The best video is 20 frames. If you use 60 frames video, you need to change tick is set to 60
/tick rate 60Set goal game tickrate.
Use frame insertion to play 60-frame video
In the video configuration, frame_rate is the frame rate of the original video. If the video is 60 frames, it can be configured like this
frame_rate:60
dialog
You can use the shortcut key G or open it in the game menu
Video playback must be opened using the G key or the commanddialog show @s animations:open_menu
Player needs to select video size 19201080 is 16:9 25601080 is 16:10
If you want to use the video playback page, please first select the language in Language Settings
Configuration
* frame_zero: Automatically processes video frames, no need to fill in by default, automatically fills in according to the number of frames during playback
* frame: Frame number Item that controls the video frame currently played by the player
* path: Path specifies the location of the sequence image in the resource pack texture folder
* name: Video name matches the name before the frame number
* blender:Please turn this option on when using the image sequence output by blender
* blender_name: Please leave blank if using blender
* frame_rate: Frame rate is used to customize the frame rate
* sound: Video sound needs to be turned on to use sound_switch.
* sound_switch: Whether the sound is enabled
* max_frame: Maximum number of frames
* slot: Set the mask when the item is worn. This value should be one of: head, body, chest, feet, legs, mainhand, offhand, saddle.
* resolution: Video size
* switch: Whether to enable this function
* default_size: Default video size
* size_list: Whether to enable the size
* 1: Whether to support 16:9 playback size
* 2: Whether to support 16:10 playback size
* 3: Whether to support 3:2 playback size
* 4: Whether to support 4:3 playback size
* language: Video name display language
* default_language: Default display language (fill in the language code)
* zh-cn: Fill in the translation text, the same is true for other languages
Parameter analysis
frame_zero
Check the change of the first picture, which is generally all 0s. Check how many 0s there are before the last 0, and write these 0s into frame_zero. For example, video0000.png should write 000 like this, as follows
{frame_zero:"000"}
frame
Frames Used to control the video frame (picture) currently played by the player For example
path
path
Used to specify the item file location for video output For example
{video:text_video/}
name
Video name Used to match the name before the frame number, which needs to be consistent with the command storage name, that is, the name after video: Note: If you use blender, please fill in blender_name according to the situation For example, video0000.png video in front of the number is the name, so it should be written like this here
{name:"video"}
It is recommended that the shorter the name, the better (because macros are used, the fewer characters, the less performance consumption)
blender
Please turn this option on when using image sequences output by blender. {blender:"true/false"}
blender_name
If you use blender, please leave it blank (if you don’t use blender, fill in unlimitedly) If there is a name before the frame number, please fill it in as mentioned in the video name above{blender_name:""}
frame_rate
Frame rate
Used for custom frame rate, only supports server use, server use needs to be set function-permission-level=3 If ** it is not a server, you also need to fill in the actual frame rate of the video for adaptive frame rate . If the server needs to use it, please ** enable it yourself in start/start_macros0$tick rate $(frame_rate) Just delete the hash sign, If you need to restore the game, please write $tick rate 20 in stop.
sound
video sound Sound_switch needs to be turned on to use If the video has sound, you need to write the video sound playback defined by sounds.json here. Referenceplaysound to write
sound_switch
Is sound enabled? Enter false/true to control whether the sound is turned on/whether the video needs to play sound {sound_switch:"false/true"}
max_frame
Maximum number of frames Maximum number of frames for video
slot
Equipment slot
Set the mask when the item is worn. This value should be one of: head, body, chest, feet, legs, mainhand, offhand, saddle
For details, see equippable:camera_overlay
resolution
Video size settings
The video path should be path fills in the path/video size/picture sequence file like video:text_video/16:9/0001.png
switch
Whether to enable the multi-video size function (must support multiple video sizes to enable it) (true/false)
default_size
Default size, fill in the numeric code, which is the key name of size_list default_size:1
size_list
Whether to support the video size (true/false) Notice!1 represents 16:92 represents 16:103 stands for 3:24 stands for 4:3Please do not enable options at will
language
The language and text displayed by the video name in the dialog and the corresponding translation
default_language
Default language, the value is the following key name
1:"en-us",
2:"zh-cn",
3:"zh-hk",
4:"zh-mo",
5:"zh-sg",
6:"zh-tw",
7:"en-au",
8:"en-ca",
9:"en-in",
10:"en-gb",
11:"fr-fr",
12:"de-de",
13:"ja",
14:"kn",
15:"es-es",
16:"ar",
17:"ko",
18:"in-in"The key name corresponds to the supported language code, which is the same as the language code mentioned below.
language translation text
Should be filled in the language list Follow the following format: Language code: "Translated text" For example:en-us:"School"
Example
Video playback configuration
Function
data merge storage video:school \
{video:\
{frame_zero:"000",\
frame:"0",\
path:"animation:school/",\
name:"school",\
blender_name:"",\
frame_rate:"60",\
sound:"",\
sound_switch:false,\
max_frame:740,\
blender:true,\
slot:"head",\
resolution:{\
switch:false,\
default_size:1,\
size_list:{\
1:true,\
2:false,\
3:false,\
4:false\
}\
},\
language:{\
default_language:"en-us",\
en-us:"School",\
zh-cn:"学校"\
}\
}\
}
function animations:video_add/main with storage video:school videoThe last line of function must be written at the end of the configuration file, and the name after video: must be the same as the name value
resource pack configuration
sounds.json
{
"video_text":{
"sounds":[
{
"name": "animation:video/video_text",
"stream": true,
"volume": 0.8,
"weight": 1
}
]
},
"":{
"name": "",
"stream": true,
"volume": 0.8,
"weight": 1
}
}Among them, video_text should be written in the sound configuration item
{sound:"video_text"}
You can add a lot of this configuration to add new video sounds Below the case is a blank template
More configuration content can be seen
You can do this in resource pack in the texture folder to create a new video folder named Video to store the image sequence
video/video_text/video0000.png
video/video_text/video....
If namespace is video Then path can be written like this {video:video/video_text}
principle
Can refer to
A little research on equipment mask (camera_overlay)
By CR_019
instruction
play
Start playing
function animations:start {video_name:"video_name"}video_name is the string written in the data above
Terminate playback
function animations:stopPause playback
function animations:pausecontinue playing
function animations:continue_playDelete the playback settings of a single player
function animations:player_video_play/storages/delete/delete_player {name:"name"}name is the player name
Delete all player playback settings
function animations:player_video_play/storages/delete/all_storages/runDelete a single video configuration
function animations:video_list/delete_only {name:"name"}name is the name in the video configuration item
Delete all video configurations
function animations:video_list/delete_allAbout sequence pictures
How to export sequence images
Export PNG sequence diagram using Adobe Animate step: Open the project you want to export. Choose File > Export > Export Image Sequence. Choose an export format (such as PNG) and set the file name and save location. Click "Export" to finish.
Use Premiere Pro to export sequence images step: Open your project in Premiere Pro. Select File > Share > Export Image Sequence. In the pop-up window, select the export format (such as PNG, TIFF, etc.) and set relevant parameters. Click "Export" to save the image sequence.
Export image sequence using Apple Motion step: Open your Motion project. Select File > Share > Export Image Sequence. In the Export Image Sequence window, select the desired export format and color space. Click "Export" to finish.
Export image sequence using Processing step: Write code in Processing to process images. Use the saveFrame("frame-####.png"); command to export the image sequence. Run the program to generate a sequence of images.
Export image sequence using Aseprite step: Open your sprite file. Select File > Export > Save As. Enter a file name and select a file format (such as PNG), making sure the file name includes a number. Click "Export" to save the image sequence.
The above are several common software methods for exporting image sequences. You can choose the appropriate software and steps according to your needs.
Recommended size
Since my world supports adaptive textures, it is recommended to export smaller-sized images to save hard disk space and reduce resource pack size. It is recommended to export images with 960 * 540 size
Things to note
Due to the mojang Shishan code, the played pictures will always be in the memory and cannot be cleaned, which can easily trigger the problem of memory explosion. It is not recommended to use it when the memory is too small. Bug:MC-277837
