#if TOOLS using Godot; using Rokojori; using System.Diagnostics; using System.Collections.Generic; using System.Threading.Tasks; using System; namespace Rokojori.Tools; [Tool] [GlobalClass] public partial class FFmpegTool:Node { [ExportToolButton("Download FFmpeg")] public Callable downloadButton => Callable.From( ()=> { var downloadPath = "https://ffmpeg.org/download.html"; OS.ShellOpen( downloadPath ); } ); [Export( PropertyHint.GlobalFile, "exe" ) ] public string ffmpegPath = ""; [Export] public string result = ""; [ExportGroup("Convert MP4 to OGV")] [Export( PropertyHint.GlobalFile, "mp4" ) ] public string mp4Path; [Export] public FFmpegQuality videoQuality = FFmpegQuality._8_Good; [Export] public FFmpegQuality audioQuality = FFmpegQuality._8_Good; [Export] public int keyFrames = 64; [ExportToolButton("Convert")] public Callable convert_MP4_to_OGV_Button => Callable.From( ()=> { result = "Converting"; Convert(); } ); async Task Convert() { var response = await FFmpeg.Convert_MP4_to_OGV( mp4Path, ffmpegPath, videoQuality, audioQuality, keyFrames ); result = response.exitCode + ">> " + response.rawResponse; } // [ExportGroup("Show Video Info")] // [Export( PropertyHint.GlobalFile, "mp4" ) ] // public string videoPath; // [ExportToolButton("Convert")] // public Callable showVideoInfoButton => Callable.From( // ()=> // { // ShowInfo(); // } // ); // async Task ShowInfo() // { // var response = await FFmpeg.Convert_MP4_to_OGV( mp4Path, ffmpegPath ); // result = response.exitCode + ">> " + response.rawResponse; // } } #endif