quality slider + UI

This commit is contained in:
colorplease 2024-02-03 22:56:27 -08:00
parent de43c9b93d
commit a62ce9d1c5
18 changed files with 4702 additions and 57 deletions

View file

@ -15,6 +15,7 @@ namespace FFmpegOut
SerializedProperty _height;
SerializedProperty _preset;
SerializedProperty _frameRate;
SerializedProperty _bitRate;
GUIContent[] _presetLabels;
int[] _presetOptions;
@ -37,6 +38,7 @@ namespace FFmpegOut
_height = serializedObject.FindProperty("_height");
_preset = serializedObject.FindProperty("_preset");
_frameRate = serializedObject.FindProperty("_frameRate");
_bitRate = serializedObject.FindProperty("_bitRate");
var presets = FFmpegPreset.GetValues(typeof(FFmpegPreset));
_presetLabels = presets.Cast<FFmpegPreset>().

View file

@ -39,6 +39,8 @@ namespace FFmpegOut
set { _frameRate = value; }
}
public int bitRate;
#endregion
#region Private members
@ -88,6 +90,7 @@ namespace FFmpegOut
{
_width = Mathf.Max(8, _width);
_height = Mathf.Max(8, _height);
// bitRate = 100; //SET BITRATE NOT ON TOP IT DOESNT WORK LIKE THAT :SOB:
}
void OnDisable()
@ -145,11 +148,12 @@ namespace FFmpegOut
}
// Start an FFmpeg session.
Debug.Log("i'm not" + bitRate);
_session = FFmpegSession.Create(
gameObject.name,
camera.targetTexture.width,
camera.targetTexture.height,
_frameRate, preset
_frameRate, bitRate, preset
);
_startTime = Time.time;

View file

@ -17,7 +17,8 @@ namespace FFmpegOut
VP9Default,
Hap,
HapAlpha,
HapQ
HapQ,
H265
}
static public class FFmpegPresetExtensions
@ -39,6 +40,7 @@ namespace FFmpegOut
case FFmpegPreset.Hap: return "HAP (QuickTime)";
case FFmpegPreset.HapAlpha: return "HAP Alpha (QuickTime)";
case FFmpegPreset.HapQ: return "HAP Q (QuickTime)";
case FFmpegPreset.H265: return "H265";
}
return null;
}
@ -52,6 +54,7 @@ namespace FFmpegOut
case FFmpegPreset.H264Lossless420:
case FFmpegPreset.H264Lossless444:
case FFmpegPreset.HevcDefault:
case FFmpegPreset.H265:
case FFmpegPreset.HevcNvidia: return ".mp4";
case FFmpegPreset.ProRes422:
case FFmpegPreset.ProRes4444: return ".mov";
@ -59,7 +62,7 @@ namespace FFmpegOut
case FFmpegPreset.VP8Default: return ".webm";
case FFmpegPreset.Hap:
case FFmpegPreset.HapQ:
case FFmpegPreset.HapAlpha: return ".mov";
case FFmpegPreset.HapAlpha: return ".mov";
}
return null;
}
@ -81,6 +84,7 @@ namespace FFmpegOut
case FFmpegPreset.Hap: return "-c:v hap";
case FFmpegPreset.HapAlpha: return "-c:v hap -format hap_alpha";
case FFmpegPreset.HapQ: return "-c:v hap -format hap_q";
case FFmpegPreset.H265: return "-c:v libx265";
}
return null;
}

View file

@ -13,27 +13,29 @@ namespace FFmpegOut
public static FFmpegSession Create(
string name,
int width, int height, float frameRate,
int width, int height, float frameRate, int bitRate,
FFmpegPreset preset
)
{
name += System.DateTime.Now.ToString(" yyyy MMdd HHmmss");
var path = name.Replace(" ", "_") + preset.GetSuffix();
return CreateWithOutputPath(path, width, height, frameRate, preset);
return CreateWithOutputPath(path, width, height, frameRate, bitRate, preset);
}
public static FFmpegSession CreateWithOutputPath(
string outputPath,
int width, int height, float frameRate,
int width, int height, float frameRate, int bitRate,
FFmpegPreset preset
)
{
Debug.Log("I'm" + bitRate);
return new FFmpegSession(
"-y -f rawvideo -vcodec rawvideo -pixel_format rgba"
+ " -colorspace bt709"
+ " -video_size " + width + "x" + height
+ " -framerate " + frameRate
+ " -loglevel warning -i - " + preset.GetOptions()
+ " -b:v " + (bitRate * 75) + "k"
+ " \"" + "C:/Users/pikmi/Downloads/temp.mp4" + "\"" //hijacked this. basically i dont want some fancy output file name (which is what the old code did) so it's just temp now lol
);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 974
m_Height: 547
m_Width: 981
m_Height: 552
m_AntiAliasing: 2
m_MipCount: -1
m_DepthStencilFormat: 92

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1461
m_Height: 820
m_Width: 1471
m_Height: 828
m_AntiAliasing: 1
m_MipCount: -1
m_DepthStencilFormat: 92

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,123 @@
fileFormatVersion: 2
guid: bc0e9e9271a74b6428150d7a4783b8f8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -52,6 +52,7 @@ SpriteAtlas:
m_PackedSprites:
- {fileID: 21300000, guid: 49e59e302f4a24a4da56bd63185fcb01, type: 3}
- {fileID: 21300000, guid: 6f76ee0157ff5854295d8d0b12b5f165, type: 3}
- {fileID: 21300000, guid: bc0e9e9271a74b6428150d7a4783b8f8, type: 3}
- {fileID: 21300000, guid: 9ae7ecf2cc001d14595ec03e1d4d86a6, type: 3}
- {fileID: 21300000, guid: 6dd981c3e3319f243b56549e3f26fb72, type: 3}
- {fileID: 21300000, guid: 99dd78d3f365c0b498bc65b192951aa7, type: 3}
@ -84,6 +85,7 @@ SpriteAtlas:
m_PackedSpriteNamesToIndex:
- cog
- zoom-out
- video-export
- save
- add-music
- clock

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@ using UnityEngine;
using UnityEngine.UI;
using TMPro;
using SFB;
using FFmpegOut;
using HeavenStudio.Common;
using HeavenStudio.Editor.Track;
@ -36,6 +37,7 @@ namespace HeavenStudio.Editor
[SerializeField] private TMP_Text GameEventSelectorTitle;
[SerializeField] private TMP_Text BuildDateDisplay;
[SerializeField] public StudioDanceManager StudioDanceManager;
[SerializeField] private HeavenRecorderController heavenRecorder;
[Header("Toolbar")]
[SerializeField] private Button NewBTN;
@ -383,6 +385,23 @@ namespace HeavenStudio.Editor
});
}
public void SaveRemixMP4() //hiiii :3
{
var extensions = new[]
{
new ExtensionFilter("H264 Encoded Video File", "mp4")
};
StandaloneFileBrowser.SaveFilePanelAsync("Save Recording As", "", "remix_recording", extensions, (string path) =>
{
if (path != String.Empty)
{
heavenRecorder.pathHeavenRecorder = path;
heavenRecorder.GetUsablePath();
}
});
}
private void SaveRemixFile(string path)
{
try

View file

@ -1,8 +1,10 @@
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using FFmpegOut;
using System.IO;
using HeavenStudio.Editor;
namespace FFmpegOut
{
@ -10,6 +12,10 @@ public class HeavenRecorderController : MonoBehaviour
{
public CameraCapture recorder;
public AudioRenderer audioRenderer;
public string pathHeavenRecorder;
[SerializeField]HeavenRecorderDialog dialog;
bool exporting = true;
// Start is called before the first frame update
@ -63,7 +69,54 @@ public class HeavenRecorderController : MonoBehaviour
_session = null;
File.Delete("C:/Users/pikmi/Downloads/temp.wav");
File.Delete("C:/Users/pikmi/Downloads/temp.mp4");
}
public void GetUsablePath()
{
int numberOfSlashes = 0;
int tempNumberOfSlashes = 0;
int index = 0;
int charsAfterSlash = 0;
//hello guys i am a cs student and this is the most thinking i've had to do so far
//yo guys i cant even lie if astrl or minenice see this it would so horribly embarassing that i would crawl up into a hole and die just pretend that AI wrote this
//this implementation is such an eyesore there's prob a better way to implment it but my brain cannot think hard enough
foreach (char c in pathHeavenRecorder)
{
if(c=='\\')
{
numberOfSlashes++;
}
}
foreach (char c in pathHeavenRecorder)
{
if(c=='\\')
{
tempNumberOfSlashes++;
}
if(tempNumberOfSlashes == numberOfSlashes)
{
charsAfterSlash++;
}
else
{
index++;
}
}
pathHeavenRecorder = pathHeavenRecorder.Remove(index+1,charsAfterSlash-1);
pathHeavenRecorder = pathHeavenRecorder.Replace("\\", "\\\\");
WritePathToDialogue();
}
public void WritePathToDialogue()
{
dialog.pathDialog = pathHeavenRecorder;
dialog.SetPathText();
}
public void SetBitRate(int bitrate)
{
recorder.bitRate = bitrate;
// print(recorder.bitRate);
}
}
}

View file

@ -0,0 +1,54 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using SFB;
using TMPro;
using FFmpegOut;
namespace HeavenStudio.Editor
{
public class HeavenRecorderDialog : Dialog
{
public string pathDialog;
[SerializeField]HeavenRecorderController heavenRecorder;
[SerializeField]TextMeshProUGUI directoryText;
[SerializeField]TextMeshProUGUI qualityNum;
[SerializeField]Slider qualitySlide;
// Start is called before the first frame update
void Start()
{
UpdateQualityNum();
}
// Update is called once per frame
void Update()
{
}
public void SwitchTempoDialog()
{
if (dialog.activeSelf)
{
dialog.SetActive(false);
}
else
{
ResetAllDialogs();
dialog.SetActive(true);
}
}
public void SetPathText()
{
directoryText.SetText("Directory: " + pathDialog);
}
public void UpdateQualityNum()
{
qualityNum.SetText(" " + qualitySlide.value.ToString());
heavenRecorder.SetBitRate((int)qualitySlide.value);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2cd17e5326f28b14a9f3687376168cd9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -17,9 +17,97 @@ MonoBehaviour:
DenseViewWidthThreshold: 512
_disableAutoReloadInBackground: 0
ImportedScriptPaths:
- Assets/Scripts/LevelEditor/HeavenRecorder/HeavenRecorderController.cs
- Assets/FFmpegOut/Runtime/FFmpegSession.cs
- Assets/FFmpegOut/AudioRenderer.cs
- Assets/Scripts/Minigames.cs
- Assets/Editor/CreateAssetBundles.cs
- Assets/Editor/CreateMinigameScriptTemplate.cs
- Assets/Scripts/Games/Minigame.cs
- Assets/Scripts/Games/FanClub/FanClub.cs
- Assets/Scripts/GameManager.cs
- Assets/Editor/SpritesheetScaler.cs
- Assets/Scripts/USG.g/LoadMinigames.Minigames.MinigameLoaderGenerator.g.cs
- Assets/Scripts/Games/TheDazzles/TheDazzles.cs
- Assets/Scripts/Games/FirstContact/FirstContact.cs
- Assets/Scripts/SourceGenerators/ControllerLoaderGenerator.cs
- Assets/Scripts/InputSystem/PlayerInput.cs
- Assets/Scripts/JudgementManager.cs
- Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/RatingScreenPropertyDialog.cs
- Assets/Scripts/GlobalGameManager.cs
- Assets/Scripts/Games/KarateMan/KarateMan.cs
- Assets/Scripts/Games/KarateMan/KarateManJoe.cs
- Assets/Scripts/Games/KarateMan/KarateManNoriController.cs
- Assets/Scripts/Util/BeatAction.cs
- Assets/Scripts/Games/TossBoys/TossBoys.cs
- Assets/Scripts/Games/DoubleDate/DoubleDate.cs
- Assets/Scripts/Games/AirRally/AirRally.cs
- Assets/Scripts/LevelEditor/Editor.cs
- Assets/Scripts/Common/MemRenderer.cs
- Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs
- Assets/Scripts/PersistentDataManager.cs
- Assets/Scripts/UI/Overlays/OverlaysManager.cs
- Assets/Scripts/TitleManager.cs
- Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SectionDialog.cs
- Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/SectionTimelineObj.cs
- Assets/Scripts/Games/DJSchool/Student.cs
- Assets/Scripts/UI/PauseMenu.cs
- Assets/Scripts/Util/Sound.cs
- Assets/Scripts/Conductor.cs
- Assets/Scripts/EventCaller.cs
- Assets/Scripts/Games/TrickClass/TrickClass.cs
- Assets/Scripts/GameInitializer.cs
- Assets/Scripts/LevelEditor/Timeline/Timeline.cs
- Assets/Scripts/Games/PlayerActionEvent.cs
- Assets/Scripts/Games/KarateMan/KarateManPot.cs
- Assets/Scripts/Games/DJSchool/DJSchool.cs
- Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs
- Assets/Scripts/LevelEditor/WaveformVisual.cs
- Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowser.cs
- Assets/Scripts/AppInfo.cs
- Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowserLinux.cs
- Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs
- Assets/Plugins/StandaloneFileBrowser/IStandaloneFileBrowser.cs
- Assets/Scripts/Util/AnimationHelpers.cs
- Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowserEditor.cs
- Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowserMac.cs
- Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs
- Assets/Plugins/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs
- Assets/Scripts/LevelEditor/HeavenRecorder/HeavenRecorderDialog.cs
- Assets/Scripts/Games/Manzai/Manzai.cs
- Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs
- Assets/Scripts/Games/TotemClimb/TCBackgroundManager.cs
- Assets/FFmpegOut/AudioRenderer.cs
- Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs
- Assets/Scripts/Games/TotemClimb/TCTotemManager.cs
- Assets/FFmpegOut/Runtime/AssemblyInfo.cs
- Assets/Scripts/Games/MonkeyWatch/WatchMonkeyHandler.cs
- Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs
- Assets/Scripts/Games/TotemClimb/TCEndTotem.cs
- Assets/Scripts/Games/MonkeyWatch/WatchBackgroundHandler.cs
- Assets/Scripts/Games/NightWalkRvl/RvlNightWalk.cs
- Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs
- Assets/Scripts/Games/MonkeyWatch/MonkeyClockArrow.cs
- Assets/FFmpegOut/Editor/FrameRateControllerEditor.cs
- Assets/FFmpegOut/Runtime/Internal/Blitter.cs
- Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
- Assets/Scripts/Games/MannequinFactory/MannequinFactory.cs
- Assets/Scripts/Games/TotemClimb/TCFrog.cs
- Assets/Scripts/Games/NightWalkAgb/AgbStar.cs
- Assets/Scripts/Games/MannequinFactory/MannequinHead.cs
- Assets/Scripts/Games/TotemClimb/TCTotem.cs
- Assets/Scripts/Games/TotemClimb/TCDragon.cs
- Assets/FFmpegOut/Runtime/Internal/FFmpegPipe.cs
- Assets/Scripts/LevelEditor/HeavenRecorder/HeavenRecorderController.cs
- Assets/Scripts/Games/NightWalkAgb/AgbPlayYan.cs
- Assets/FFmpegOut/Runtime/FFmpegSession.cs
- Assets/Scripts/Games/MonkeyWatch/BalloonHandler.cs
- Assets/FFmpegOut/Runtime/CameraCapture.cs
- Assets/Scripts/Games/MonkeyWatch/WatchMonkey.cs
- Assets/Scripts/Games/TotemClimb/TCPillarManager.cs
- Assets/FFmpegOut/Runtime/FrameRateController.cs
- Assets/FFmpegOut/Editor/CameraCaptureEditor.cs
- Assets/Scripts/Games/TotemClimb/TCGroundManager.cs
- Assets/Scripts/Games/TotemClimb/TCJumper.cs
- Assets/FFmpegOut/Runtime/FFmpegPreset.cs
- Assets/Scripts/Games/TotemClimb/TotemClimb.cs
- Assets/Scripts/Games/TotemClimb/TCBirdManager.cs
PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: []