-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from fuziki/refactor/remove-video-creator
Refactor/remove video creator
- Loading branch information
Showing
70 changed files
with
300 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-20.6 KB
...r.framework/Modules/UnityVideoCreator.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo
Binary file not shown.
Binary file removed
BIN
-20.6 KB
...ideoCreator.framework/Modules/UnityVideoCreator.swiftmodule/Project/arm64.swiftsourceinfo
Binary file not shown.
Binary file removed
BIN
-196 KB
...yVideoCreator.framework/Modules/UnityVideoCreator.swiftmodule/arm64-apple-ios.swiftmodule
Binary file not shown.
Binary file removed
BIN
-196 KB
...s/iOS/UnityVideoCreator.framework/Modules/UnityVideoCreator.swiftmodule/arm64.swiftmodule
Binary file not shown.
Binary file removed
BIN
-1.18 MB
...mple/Assets/Plugin/VideoCreator/Plugins/iOS/UnityVideoCreator.framework/UnityVideoCreator
Binary file not shown.
14 changes: 0 additions & 14 deletions
14
Examples/UnityExample/Assets/Plugin/VideoCreator/Scripts/VideoCreator/IVideoCreatorUnity.cs
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
Examples/UnityExample/Assets/Plugin/VideoCreator/Scripts/VideoCreator/VideoCreatorUnity.cs
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...es/UnityExample/Assets/Plugin/VideoCreator/Scripts/VideoCreator/VideoCreatorUnity.cs.meta
This file was deleted.
Oops, something went wrong.
70 changes: 0 additions & 70 deletions
70
...ples/UnityExample/Assets/Plugin/VideoCreator/Scripts/VideoCreator/VideoCreatorUnityIOS.cs
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...UnityExample/Assets/Plugin/VideoCreator/Scripts/VideoCreator/VideoCreatorUnityIOS.cs.meta
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...in/VideoCreator/Scripts/VideoCreator.meta → ...nityExample/Assets/VideoCreator/Demo.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# VideoCreator | ||
|
||
* iOS Native Plugin to Export Texture and pcm to movie file. | ||
* Support .mov, .wav, Live Photos, .png and .jpeg. | ||
|
||
# Usage | ||
## Setup | ||
### Setup MediaCreator for mov file (no audio) | ||
* Set the tmp file location as absolute path. | ||
* "h264" or "hevcWithAlpha" | ||
* If you want to record a video with an alpha channel, you need to specify the "hevcWithAlpha". | ||
* Set video width and height. | ||
|
||
```c# | ||
string cachePath = "file://" + Application.temporaryCachePath + "/tmp.mov"; | ||
MediaCreator.InitAsMovWithAudio(cachePath, "h264", width, height); | ||
``` | ||
|
||
### Setup MediaCreator for mov file (with audio) | ||
* In addition to no audio, set the number of channels and sampling rate for audio. | ||
|
||
```c# | ||
string cachePath = "file://" + Application.temporaryCachePath + "/tmp.mov"; | ||
MediaCreator.InitAsMovWithAudio(cachePath, "h264", texture.width, texture.height, 1, 48_000); | ||
``` | ||
|
||
### Setup MediaCreator for Live Photos | ||
* In addition to the usual mov, set Content Identifier. | ||
|
||
```c# | ||
string uuid = System.Guid.NewGuid().ToString(); | ||
string cachePath = "file://" + Application.temporaryCachePath + "/tmp.mov"; | ||
MediaCreator.InitAsMovWithAudio(cachePath, "h264", width, height, uuid); | ||
``` | ||
|
||
### Setup MediaCreator for wav file | ||
* In addition to the number of audio channels and sampling rate, set the Bit Depth. | ||
|
||
```c# | ||
string cachePath = "file://" + Application.temporaryCachePath + "/tmp.wav"; | ||
MediaCreator.InitAsWav(cachePath, 1, 48000, 32); | ||
``` | ||
|
||
## Start Recording | ||
|
||
* Set a start time in the timeline of the source samples. | ||
* The time unit is microseconds. | ||
|
||
```c# | ||
long startTimeOffset = 0; | ||
MediaCreator.Start(startTimeOffset); | ||
``` | ||
|
||
## Write Texture | ||
|
||
* Give a time based on start and any texture. | ||
* The time unit is microseconds. | ||
|
||
```c# | ||
Texture texture = Get Texture; | ||
long time = startTimeOffset + Elapsed time from Start; | ||
MediaCreator.WriteVideo(texture, time); | ||
``` | ||
|
||
## Write Audio PCM | ||
|
||
* Give a time based on start and pcm float array. | ||
* The time unit is microseconds. | ||
|
||
```c# | ||
float[] pcm = Get PCM float array; | ||
long time = startTimeOffset + Elapsed time from Start; | ||
MediaCreator.WriteAudio(pcm, time); | ||
``` | ||
|
||
## Finish Recording | ||
|
||
* Save recording files synchronously | ||
* This process may take some time. | ||
|
||
```c# | ||
MediaCreator.FinishSync(); | ||
``` | ||
|
||
## Save mov to album app (optional) | ||
|
||
* If you want to save your recorded videos to an album, you can use MediaSaver to do so. | ||
|
||
```c# | ||
MediaSaver.SaveVideo(cachePath); | ||
``` | ||
|
||
## Save Live Photos to album app | ||
|
||
* If you want to save your recorded Live Photos to an album, you can use MediaSaver to do so. | ||
* Set the thumbnail and the same Content Identifier as the video. | ||
|
||
```c# | ||
MediaSaver.SaveLivePhotos(texture, uuid, cachePath); | ||
``` | ||
|
||
## Save Texture to album app | ||
|
||
* You can choose the format from "jpeg", "jpg", "heif", and "png". | ||
|
||
```c# | ||
MediaSaver.SaveImage(texture, "png"); | ||
``` | ||
|
||
# Demo | ||
* Unity Version: 2020.3.5 | ||
* Build for iOS | ||
* Set `Privacy - Photo Library Additions Usage Description` and `Privacy - Photo Library Usage Description` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added
BIN
+17 KB
...r.framework/Modules/UnityVideoCreator.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo
Binary file not shown.
File renamed without changes.
Binary file added
BIN
+17 KB
...ideoCreator.framework/Modules/UnityVideoCreator.swiftmodule/Project/arm64.swiftsourceinfo
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added
BIN
+143 KB
...yVideoCreator.framework/Modules/UnityVideoCreator.swiftmodule/arm64-apple-ios.swiftmodule
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added
BIN
+143 KB
...s/iOS/UnityVideoCreator.framework/Modules/UnityVideoCreator.swiftmodule/arm64.swiftmodule
Binary file not shown.
File renamed without changes.
Binary file added
BIN
+959 KB
...ssets/VideoCreator/VideoCreator/Plugins/iOS/UnityVideoCreator.framework/UnityVideoCreator
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.