├── .gitignore ├── App.config ├── Helper.cs ├── MasterOfWebM.csproj ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── fonts └── fonts.conf ├── formMain.Designer.cs ├── formMain.cs ├── formMain.resx ├── icon.ico ├── license.md ├── readme.md └── update.xml /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # MSTest test Results 20 | [Tt]est[Rr]esult*/ 21 | [Bb]uild[Ll]og.* 22 | 23 | #NUNIT 24 | *.VisualState.xml 25 | TestResult.xml 26 | 27 | # Build Results of an ATL Project 28 | [Dd]ebugPS/ 29 | [Rr]eleasePS/ 30 | dlldata.c 31 | 32 | *_i.c 33 | *_p.c 34 | *_i.h 35 | *.ilk 36 | *.meta 37 | *.obj 38 | *.pch 39 | *.pdb 40 | *.pgc 41 | *.pgd 42 | *.rsp 43 | *.sbr 44 | *.tlb 45 | *.tli 46 | *.tlh 47 | *.tmp 48 | *.tmp_proj 49 | *.log 50 | *.vspscc 51 | *.vssscc 52 | .builds 53 | *.pidb 54 | *.svclog 55 | *.scc 56 | 57 | # Chutzpah Test files 58 | _Chutzpah* 59 | 60 | # Visual C++ cache files 61 | ipch/ 62 | *.aps 63 | *.ncb 64 | *.opensdf 65 | *.sdf 66 | *.cachefile 67 | 68 | # Visual Studio profiler 69 | *.psess 70 | *.vsp 71 | *.vspx 72 | 73 | # TFS 2012 Local Workspace 74 | $tf/ 75 | 76 | # Guidance Automation Toolkit 77 | *.gpState 78 | 79 | # ReSharper is a .NET coding add-in 80 | _ReSharper*/ 81 | *.[Rr]e[Ss]harper 82 | *.DotSettings.user 83 | 84 | # JustCode is a .NET coding addin-in 85 | .JustCode 86 | 87 | # TeamCity is a build add-in 88 | _TeamCity* 89 | 90 | # DotCover is a Code Coverage Tool 91 | *.dotCover 92 | 93 | # NCrunch 94 | _NCrunch_* 95 | .*crunch*.local.xml 96 | 97 | # MightyMoose 98 | *.mm.* 99 | AutoTest.Net/ 100 | 101 | # Web workbench (sass) 102 | .sass-cache/ 103 | 104 | # Installshield output folder 105 | [Ee]xpress/ 106 | 107 | # DocProject is a documentation generator add-in 108 | DocProject/buildhelp/ 109 | DocProject/Help/*.HxT 110 | DocProject/Help/*.HxC 111 | DocProject/Help/*.hhc 112 | DocProject/Help/*.hhk 113 | DocProject/Help/*.hhp 114 | DocProject/Help/Html2 115 | DocProject/Help/html 116 | 117 | # Click-Once directory 118 | publish/ 119 | 120 | # Publish Web Output 121 | *.[Pp]ublish.xml 122 | *.azurePubxml 123 | ## TODO: Comment the next line if you want to checkin your web deploy settings but do note that will include unencrypted passwords 124 | *.pubxml 125 | 126 | # NuGet Packages Directory 127 | packages/ 128 | ## TODO: If the tool you use requires repositories.config uncomment the next line 129 | #!packages/repositories.config 130 | 131 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 132 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) 133 | !packages/build/ 134 | 135 | # Windows Azure Build Output 136 | csx/ 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.dbproj.schemaview 151 | *.pfx 152 | *.publishsettings 153 | node_modules/ 154 | 155 | # RIA/Silverlight projects 156 | Generated_Code/ 157 | 158 | # Backup & report files from converting an old project file to a newer 159 | # Visual Studio version. Backup files are not needed, because we have git ;-) 160 | _UpgradeReport_Files/ 161 | Backup*/ 162 | UpgradeLog*.XML 163 | UpgradeLog*.htm 164 | 165 | # SQL Server files 166 | *.mdf 167 | *.ldf 168 | 169 | # Business Intelligence projects 170 | *.rdl.data 171 | *.bim.layout 172 | *.bim_*.settings 173 | 174 | # Microsoft Fakes 175 | FakesAssemblies/ -------------------------------------------------------------------------------- /App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using System.Xml; 11 | 12 | namespace MasterOfWebM 13 | { 14 | class Helper 15 | { 16 | private const int BITCONVERSION = 8 * 1024; // Converts the filesize to Kilobits 17 | 18 | // Version check variables 19 | private static String downloadUrl = ""; 20 | private static Version newVersion = null; 21 | private static String xmlUrl = "https://raw.githubusercontent.com/MasterOfWebM/WebM-Converter/master/update.xml"; 22 | private static XmlTextReader reader = null; 23 | 24 | /// 25 | /// This function intakes the time format, so it can convert it to flat seconds 26 | /// 27 | /// A string that is formatted as HH:MM:SS 28 | /// The seconds. 29 | public static double convertToSeconds(String input) { 30 | string[] time = input.Split(':'); 31 | return Convert.ToDouble(time[0]) * 3600 + Convert.ToDouble(time[1]) * 60 + Convert.ToDouble(time[2]); 32 | } 33 | 34 | /// 35 | /// This function calculates the bitrate required to fit into a file size. 36 | /// 37 | /// The requested file size in MB 38 | /// The length of the footage in seconds 39 | /// The bitrate in kilobits 40 | public static double calcBitrate(String size, String length) 41 | { 42 | return Math.Floor(Convert.ToDouble(size) * BITCONVERSION / Convert.ToDouble(length)); 43 | } 44 | 45 | /// 46 | /// Obtains the file size of a given file 47 | /// 48 | /// The file that needs to be calculated 49 | /// The file size of a given file 50 | public static double getFileSize(String file) 51 | { 52 | FileInfo fi = new FileInfo(@file); 53 | 54 | double fileSize = fi.Length; 55 | 56 | return Math.Round(fileSize / 1024, 2); 57 | } 58 | 59 | /// 60 | /// Calls ffmpeg to encode the video 61 | /// 62 | /// The base command string (passes are entered automatically by this class) 63 | /// The path to the output 64 | public static void encodeVideo(String command, String fileOutput) 65 | { 66 | String commandPass1 = "-pass 1 -f webm NUL"; 67 | String commandPass2 = "-pass 2 "; 68 | 69 | // Pass 1 70 | var pass1 = Process.Start("ffmpeg", command + commandPass1); 71 | pass1.WaitForExit(); 72 | 73 | // Pass 2 74 | var pass2 = Process.Start("ffmpeg", command + commandPass2 + "\"" + fileOutput + "\""); 75 | pass2.WaitForExit(); 76 | } 77 | 78 | /// 79 | /// Checks to see if ffmpeg has a font.conf installed, and if it doesn't 80 | /// it will install one for the user to support subtitles 81 | /// 82 | /// If the current FFmpeg installation has a font config installed 83 | public static bool checkFFmpegFontConfig() 84 | { 85 | // Spawn process to check if ffmpeg is installed and find out where it is 86 | Process p = new Process(); 87 | p.StartInfo.UseShellExecute = false; 88 | p.StartInfo.RedirectStandardOutput = true; 89 | p.StartInfo.FileName = "cmd"; 90 | p.StartInfo.Arguments = "/k where ffmpeg & exit"; 91 | p.StartInfo.CreateNoWindow = true; 92 | p.Start(); 93 | 94 | string output = p.StandardOutput.ReadToEnd(); 95 | 96 | p.WaitForExit(); 97 | 98 | if (output == "") 99 | { 100 | MessageBox.Show("FFmpeg is not installed, please either put it in the same directory\n"+ 101 | "as this program or in your 'PATH' Environment Variable.", "Error", 102 | MessageBoxButtons.OK, MessageBoxIcon.Error); 103 | 104 | return false; 105 | } 106 | else 107 | { 108 | // Get rid of the newline at the end of the output 109 | output = output.Replace(Environment.NewLine, ""); 110 | 111 | // Get the root directory of ffmpeg 112 | output = Path.GetDirectoryName(@output); 113 | 114 | if (File.Exists(output + "\\fonts\\fonts.conf")) 115 | { 116 | return true; 117 | } 118 | else 119 | { 120 | if (Directory.Exists(output + "\\fonts")) 121 | { 122 | // If the directory actually exists, just write the config file 123 | try 124 | { 125 | File.Copy("fonts\\fonts.conf", output + "\\fonts\\fonts.conf"); 126 | 127 | return true; 128 | } 129 | catch (Exception ex) 130 | { 131 | if (ex is UnauthorizedAccessException) 132 | { 133 | MessageBox.Show("Failed to create the fonts config due to\n" + 134 | "Unathorized Access. Please start this program with Administrator\n" + 135 | "privileges.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 136 | 137 | return false; 138 | } 139 | else 140 | { 141 | MessageBox.Show("Something went wrong with writing the config\n" + 142 | "file. Please message Master Of WebM to figure it out.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 143 | 144 | return false; 145 | } 146 | } 147 | } 148 | else 149 | { 150 | // If neither the directory, or file exists, then create them both 151 | try 152 | { 153 | Directory.CreateDirectory(output + "\\fonts"); 154 | File.Copy("fonts\\fonts.conf", output + "\\fonts\\fonts.conf"); 155 | 156 | return true; 157 | } 158 | catch (Exception ex) 159 | { 160 | if (ex is UnauthorizedAccessException) 161 | { 162 | MessageBox.Show("Failed to create the fonts config due to\n" + 163 | "Unathorized Access. Please start this program with Administrator\n" + 164 | "privileges.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 165 | 166 | return false; 167 | } 168 | else 169 | { 170 | MessageBox.Show("Something went wrong with writing the config\n" + 171 | "file. Please message Master Of WebM to figure it out.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 172 | 173 | return false; 174 | } 175 | } 176 | } 177 | } 178 | } 179 | } 180 | 181 | /// 182 | /// Verifies the version of the program. 183 | /// It will prompt the user if the program is 184 | /// outdated. 185 | /// 186 | public static void checkUpdate() 187 | { 188 | try 189 | { 190 | reader = new XmlTextReader(xmlUrl); 191 | reader.MoveToContent(); 192 | string elementName = ""; 193 | 194 | if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "webmconverter")) 195 | { 196 | while (reader.Read()) 197 | { 198 | if (reader.NodeType == XmlNodeType.Element) 199 | { 200 | elementName = reader.Name; 201 | } 202 | else 203 | { 204 | if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue)) 205 | { 206 | switch (elementName) 207 | { 208 | case "version": 209 | newVersion = new Version(reader.Value); 210 | break; 211 | case "url": 212 | downloadUrl = reader.Value; 213 | break; 214 | } 215 | } 216 | } 217 | } 218 | } 219 | } 220 | catch (Exception ex) 221 | { 222 | // Error out to not disrupt the user 223 | Debug.WriteLine(ex.Message); 224 | } 225 | finally 226 | { 227 | if (reader != null) 228 | { 229 | reader.Close(); 230 | } 231 | } 232 | 233 | // Current version of the application 234 | Version appVersion = Assembly.GetExecutingAssembly().GetName().Version; 235 | 236 | if (appVersion.CompareTo(newVersion) < 0) 237 | { 238 | if (MessageBox.Show("You are currently out of date.\nWould you like to update now?", "Version out of date", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) 239 | { 240 | var update = Process.Start(downloadUrl); 241 | } 242 | } 243 | } 244 | 245 | /// 246 | /// Checks if a subtitle (subs.ass | subs.srt) exists 247 | /// and deletes it. 248 | /// 249 | public static void subsCheck() 250 | { 251 | if(File.Exists("subs.ass")) 252 | { 253 | File.Delete("subs.ass"); 254 | } 255 | else if (File.Exists("subs.srt")) 256 | { 257 | File.Delete("subs.srt"); 258 | } 259 | } 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /MasterOfWebM.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4ABF1D9F-17E4-4E5F-8ABE-3E6609DBC3C5} 8 | WinExe 9 | Properties 10 | MasterOfWebM 11 | MasterOfWebM 12 | v4.0 13 | 512 14 | false 15 | 16 | publish\ 17 | false 18 | Disk 19 | false 20 | Foreground 21 | 7 22 | Days 23 | false 24 | false 25 | true 26 | 2 27 | 0.1.0.%2a 28 | false 29 | true 30 | true 31 | 32 | 33 | AnyCPU 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | 51 | 52 | A72361DCB8900C1D969CB9DD9B81A1A10D6867D9 53 | 54 | 55 | MasterOfWebM_TemporaryKey.pfx 56 | 57 | 58 | true 59 | 60 | 61 | true 62 | 63 | 64 | icon.ico 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Form 82 | 83 | 84 | formMain.cs 85 | 86 | 87 | 88 | 89 | formMain.cs 90 | 91 | 92 | ResXFileCodeGenerator 93 | Resources.Designer.cs 94 | Designer 95 | 96 | 97 | True 98 | Resources.resx 99 | True 100 | 101 | 102 | 103 | 104 | SettingsSingleFileGenerator 105 | Settings.Designer.cs 106 | 107 | 108 | True 109 | Settings.settings 110 | True 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | False 119 | Microsoft .NET Framework 4.5 %28x86 and x64%29 120 | true 121 | 122 | 123 | False 124 | .NET Framework 3.5 SP1 Client Profile 125 | false 126 | 127 | 128 | False 129 | .NET Framework 3.5 SP1 130 | false 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | xcopy /Y /S "$(ProjectDir)fonts" "$(TargetDir)fonts\" 143 | 144 | 151 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace MasterOfWebM 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new formMain()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MasterOfWebM")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MasterOfWebM")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a324b046-536a-4f14-9173-9ad5c552e82b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.1.0.0")] 36 | [assembly: AssemblyFileVersion("1.1.0.0")] 37 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34011 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MasterOfWebM.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MasterOfWebM.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34011 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MasterOfWebM.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /fonts/fonts.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | C:\WINDOWS\Fonts 5 | 6 | 7 | mono 8 | monospace 9 | 10 | 11 | 12 | sans-serif 13 | serif 14 | monospace 15 | sans-serif 16 | 17 | 18 | 19 | Times 20 | Times New Roman 21 | serif 22 | 23 | 24 | Helvetica 25 | Arial 26 | sans 27 | 28 | 29 | Courier 30 | Courier New 31 | monospace 32 | 33 | 34 | serif 35 | Times New Roman 36 | 37 | 38 | sans 39 | Arial 40 | 41 | 42 | monospace 43 | Andale Mono 44 | 45 | 46 | 47 | Courier New 48 | 49 | 50 | monospace 51 | 52 | 53 | 54 | 55 | Courier 56 | 57 | 58 | monospace 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /formMain.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace MasterOfWebM 2 | { 3 | partial class formMain 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(formMain)); 32 | this.btnOutput = new System.Windows.Forms.Button(); 33 | this.btnInput = new System.Windows.Forms.Button(); 34 | this.txtOutput = new System.Windows.Forms.TextBox(); 35 | this.txtInput = new System.Windows.Forms.TextBox(); 36 | this.label5 = new System.Windows.Forms.Label(); 37 | this.txtWidth = new System.Windows.Forms.TextBox(); 38 | this.txtLength = new System.Windows.Forms.TextBox(); 39 | this.txtTimeStart = new System.Windows.Forms.TextBox(); 40 | this.label4 = new System.Windows.Forms.Label(); 41 | this.label3 = new System.Windows.Forms.Label(); 42 | this.btnConvert = new System.Windows.Forms.Button(); 43 | this.inputFileDialog = new System.Windows.Forms.OpenFileDialog(); 44 | this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); 45 | this.statusStrip1 = new System.Windows.Forms.StatusStrip(); 46 | this.lblThreads = new System.Windows.Forms.ToolStripStatusLabel(); 47 | this.label1 = new System.Windows.Forms.Label(); 48 | this.txtMaxSize = new System.Windows.Forms.TextBox(); 49 | this.label2 = new System.Windows.Forms.Label(); 50 | this.label6 = new System.Windows.Forms.Label(); 51 | this.txtCrop = new System.Windows.Forms.TextBox(); 52 | this.comboQuality = new System.Windows.Forms.ComboBox(); 53 | this.btnSubs = new System.Windows.Forms.Button(); 54 | this.txtSubs = new System.Windows.Forms.TextBox(); 55 | this.subsFileDialog = new System.Windows.Forms.OpenFileDialog(); 56 | this.btnClear = new System.Windows.Forms.Button(); 57 | this.label7 = new System.Windows.Forms.Label(); 58 | this.checkAudio = new System.Windows.Forms.CheckBox(); 59 | this.label8 = new System.Windows.Forms.Label(); 60 | this.txtTitle = new System.Windows.Forms.TextBox(); 61 | this.statusStrip1.SuspendLayout(); 62 | this.SuspendLayout(); 63 | // 64 | // btnOutput 65 | // 66 | this.btnOutput.Location = new System.Drawing.Point(11, 36); 67 | this.btnOutput.Name = "btnOutput"; 68 | this.btnOutput.Size = new System.Drawing.Size(51, 23); 69 | this.btnOutput.TabIndex = 2; 70 | this.btnOutput.Text = "Output"; 71 | this.btnOutput.UseVisualStyleBackColor = true; 72 | this.btnOutput.Click += new System.EventHandler(this.btnOutput_Click); 73 | // 74 | // btnInput 75 | // 76 | this.btnInput.Location = new System.Drawing.Point(11, 10); 77 | this.btnInput.Name = "btnInput"; 78 | this.btnInput.Size = new System.Drawing.Size(51, 23); 79 | this.btnInput.TabIndex = 1; 80 | this.btnInput.Text = "Input"; 81 | this.btnInput.UseVisualStyleBackColor = true; 82 | this.btnInput.Click += new System.EventHandler(this.btnInput_Click); 83 | // 84 | // txtOutput 85 | // 86 | this.txtOutput.Location = new System.Drawing.Point(75, 38); 87 | this.txtOutput.Name = "txtOutput"; 88 | this.txtOutput.ReadOnly = true; 89 | this.txtOutput.Size = new System.Drawing.Size(216, 20); 90 | this.txtOutput.TabIndex = 2; 91 | // 92 | // txtInput 93 | // 94 | this.txtInput.Location = new System.Drawing.Point(75, 12); 95 | this.txtInput.Name = "txtInput"; 96 | this.txtInput.ReadOnly = true; 97 | this.txtInput.Size = new System.Drawing.Size(216, 20); 98 | this.txtInput.TabIndex = 1; 99 | // 100 | // label5 101 | // 102 | this.label5.AutoSize = true; 103 | this.label5.Location = new System.Drawing.Point(17, 146); 104 | this.label5.Name = "label5"; 105 | this.label5.Size = new System.Drawing.Size(38, 13); 106 | this.label5.TabIndex = 4; 107 | this.label5.Text = "Width:"; 108 | // 109 | // txtWidth 110 | // 111 | this.txtWidth.Location = new System.Drawing.Point(75, 143); 112 | this.txtWidth.MaxLength = 4; 113 | this.txtWidth.Name = "txtWidth"; 114 | this.txtWidth.Size = new System.Drawing.Size(69, 20); 115 | this.txtWidth.TabIndex = 5; 116 | this.txtWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 117 | // 118 | // txtLength 119 | // 120 | this.txtLength.Location = new System.Drawing.Point(75, 117); 121 | this.txtLength.MaxLength = 3; 122 | this.txtLength.Name = "txtLength"; 123 | this.txtLength.Size = new System.Drawing.Size(69, 20); 124 | this.txtLength.TabIndex = 4; 125 | this.txtLength.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 126 | // 127 | // txtTimeStart 128 | // 129 | this.txtTimeStart.ForeColor = System.Drawing.Color.Silver; 130 | this.txtTimeStart.Location = new System.Drawing.Point(75, 91); 131 | this.txtTimeStart.MaxLength = 8; 132 | this.txtTimeStart.Name = "txtTimeStart"; 133 | this.txtTimeStart.Size = new System.Drawing.Size(69, 20); 134 | this.txtTimeStart.TabIndex = 3; 135 | this.txtTimeStart.Text = "HH:MM:SS"; 136 | this.txtTimeStart.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 137 | this.txtTimeStart.Enter += new System.EventHandler(this.txtTimeStart_Enter); 138 | this.txtTimeStart.Leave += new System.EventHandler(this.txtTimeStart_Leave); 139 | // 140 | // label4 141 | // 142 | this.label4.AutoSize = true; 143 | this.label4.Location = new System.Drawing.Point(15, 120); 144 | this.label4.Name = "label4"; 145 | this.label4.Size = new System.Drawing.Size(43, 13); 146 | this.label4.TabIndex = 1; 147 | this.label4.Text = "Length:"; 148 | // 149 | // label3 150 | // 151 | this.label3.AutoSize = true; 152 | this.label3.Location = new System.Drawing.Point(7, 94); 153 | this.label3.Name = "label3"; 154 | this.label3.Size = new System.Drawing.Size(58, 13); 155 | this.label3.TabIndex = 0; 156 | this.label3.Text = "Time Start:"; 157 | // 158 | // btnConvert 159 | // 160 | this.btnConvert.Location = new System.Drawing.Point(41, 200); 161 | this.btnConvert.Name = "btnConvert"; 162 | this.btnConvert.Size = new System.Drawing.Size(75, 23); 163 | this.btnConvert.TabIndex = 9; 164 | this.btnConvert.Text = "Convert"; 165 | this.btnConvert.UseVisualStyleBackColor = true; 166 | this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click); 167 | // 168 | // inputFileDialog 169 | // 170 | this.inputFileDialog.Filter = "Video Files (*.mp4,*.mkv,*.avi)|*.mp4;*.mkv;*.avi|All Files (*.*)|*.*"; 171 | this.inputFileDialog.RestoreDirectory = true; 172 | // 173 | // saveFileDialog1 174 | // 175 | this.saveFileDialog1.DefaultExt = "webm"; 176 | this.saveFileDialog1.FileName = "out.webm"; 177 | this.saveFileDialog1.Filter = "WebM File (*.webm)|*.webm"; 178 | this.saveFileDialog1.RestoreDirectory = true; 179 | // 180 | // statusStrip1 181 | // 182 | this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 183 | this.lblThreads}); 184 | this.statusStrip1.Location = new System.Drawing.Point(0, 231); 185 | this.statusStrip1.Name = "statusStrip1"; 186 | this.statusStrip1.Size = new System.Drawing.Size(303, 22); 187 | this.statusStrip1.SizingGrip = false; 188 | this.statusStrip1.TabIndex = 5; 189 | this.statusStrip1.Text = "statusStrip1"; 190 | // 191 | // lblThreads 192 | // 193 | this.lblThreads.Name = "lblThreads"; 194 | this.lblThreads.Size = new System.Drawing.Size(52, 17); 195 | this.lblThreads.Text = "Threads:"; 196 | // 197 | // label1 198 | // 199 | this.label1.AutoSize = true; 200 | this.label1.Location = new System.Drawing.Point(156, 94); 201 | this.label1.Name = "label1"; 202 | this.label1.Size = new System.Drawing.Size(53, 13); 203 | this.label1.TabIndex = 0; 204 | this.label1.Text = "Max Size:"; 205 | // 206 | // txtMaxSize 207 | // 208 | this.txtMaxSize.ForeColor = System.Drawing.SystemColors.WindowText; 209 | this.txtMaxSize.Location = new System.Drawing.Point(222, 91); 210 | this.txtMaxSize.MaxLength = 4; 211 | this.txtMaxSize.Name = "txtMaxSize"; 212 | this.txtMaxSize.Size = new System.Drawing.Size(69, 20); 213 | this.txtMaxSize.TabIndex = 6; 214 | this.txtMaxSize.Text = "3"; 215 | this.txtMaxSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 216 | // 217 | // label2 218 | // 219 | this.label2.AutoSize = true; 220 | this.label2.Location = new System.Drawing.Point(166, 120); 221 | this.label2.Name = "label2"; 222 | this.label2.Size = new System.Drawing.Size(32, 13); 223 | this.label2.TabIndex = 0; 224 | this.label2.Text = "Crop:"; 225 | // 226 | // label6 227 | // 228 | this.label6.AutoSize = true; 229 | this.label6.Location = new System.Drawing.Point(161, 146); 230 | this.label6.Name = "label6"; 231 | this.label6.Size = new System.Drawing.Size(42, 13); 232 | this.label6.TabIndex = 0; 233 | this.label6.Text = "Quality:"; 234 | // 235 | // txtCrop 236 | // 237 | this.txtCrop.ForeColor = System.Drawing.Color.Silver; 238 | this.txtCrop.Location = new System.Drawing.Point(222, 117); 239 | this.txtCrop.MaxLength = 19; 240 | this.txtCrop.Name = "txtCrop"; 241 | this.txtCrop.Size = new System.Drawing.Size(69, 20); 242 | this.txtCrop.TabIndex = 7; 243 | this.txtCrop.Text = "o_w:o_h:x:y"; 244 | this.txtCrop.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 245 | this.txtCrop.Enter += new System.EventHandler(this.txtCrop_Enter); 246 | this.txtCrop.Leave += new System.EventHandler(this.txtCrop_Leave); 247 | // 248 | // comboQuality 249 | // 250 | this.comboQuality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 251 | this.comboQuality.FormattingEnabled = true; 252 | this.comboQuality.Items.AddRange(new object[] { 253 | "Best", 254 | "Ultra", 255 | "Good"}); 256 | this.comboQuality.Location = new System.Drawing.Point(222, 143); 257 | this.comboQuality.Name = "comboQuality"; 258 | this.comboQuality.Size = new System.Drawing.Size(69, 21); 259 | this.comboQuality.TabIndex = 8; 260 | this.comboQuality.SelectedIndexChanged += new System.EventHandler(this.comboQuality_SelectedIndexChanged); 261 | // 262 | // btnSubs 263 | // 264 | this.btnSubs.Location = new System.Drawing.Point(11, 62); 265 | this.btnSubs.Name = "btnSubs"; 266 | this.btnSubs.Size = new System.Drawing.Size(51, 23); 267 | this.btnSubs.TabIndex = 10; 268 | this.btnSubs.Text = "Subs"; 269 | this.btnSubs.UseVisualStyleBackColor = true; 270 | this.btnSubs.Click += new System.EventHandler(this.btnSubs_Click); 271 | // 272 | // txtSubs 273 | // 274 | this.txtSubs.Location = new System.Drawing.Point(75, 64); 275 | this.txtSubs.Name = "txtSubs"; 276 | this.txtSubs.ReadOnly = true; 277 | this.txtSubs.Size = new System.Drawing.Size(216, 20); 278 | this.txtSubs.TabIndex = 11; 279 | // 280 | // subsFileDialog 281 | // 282 | this.subsFileDialog.Filter = "SubStation Alpha Subtitles (*.ass)|*.ass|SubRip Text (*.srt)|*.srt"; 283 | this.subsFileDialog.RestoreDirectory = true; 284 | // 285 | // btnClear 286 | // 287 | this.btnClear.Location = new System.Drawing.Point(189, 199); 288 | this.btnClear.Name = "btnClear"; 289 | this.btnClear.Size = new System.Drawing.Size(75, 23); 290 | this.btnClear.TabIndex = 12; 291 | this.btnClear.Text = "Clear"; 292 | this.btnClear.UseVisualStyleBackColor = true; 293 | this.btnClear.Click += new System.EventHandler(this.btnClear_Click); 294 | // 295 | // label7 296 | // 297 | this.label7.AutoSize = true; 298 | this.label7.Location = new System.Drawing.Point(164, 172); 299 | this.label7.Name = "label7"; 300 | this.label7.Size = new System.Drawing.Size(37, 13); 301 | this.label7.TabIndex = 13; 302 | this.label7.Text = "Audio:"; 303 | // 304 | // checkAudio 305 | // 306 | this.checkAudio.AutoSize = true; 307 | this.checkAudio.Location = new System.Drawing.Point(249, 172); 308 | this.checkAudio.Name = "checkAudio"; 309 | this.checkAudio.Size = new System.Drawing.Size(15, 14); 310 | this.checkAudio.TabIndex = 14; 311 | this.checkAudio.UseVisualStyleBackColor = true; 312 | // 313 | // label8 314 | // 315 | this.label8.AutoSize = true; 316 | this.label8.Location = new System.Drawing.Point(21, 172); 317 | this.label8.Name = "label8"; 318 | this.label8.Size = new System.Drawing.Size(30, 13); 319 | this.label8.TabIndex = 15; 320 | this.label8.Text = "Title:"; 321 | // 322 | // txtTitle 323 | // 324 | this.txtTitle.Location = new System.Drawing.Point(75, 170); 325 | this.txtTitle.Name = "txtTitle"; 326 | this.txtTitle.Size = new System.Drawing.Size(69, 20); 327 | this.txtTitle.TabIndex = 16; 328 | this.txtTitle.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 329 | // 330 | // formMain 331 | // 332 | this.AllowDrop = true; 333 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 334 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 335 | this.ClientSize = new System.Drawing.Size(303, 253); 336 | this.Controls.Add(this.txtTitle); 337 | this.Controls.Add(this.label8); 338 | this.Controls.Add(this.checkAudio); 339 | this.Controls.Add(this.label7); 340 | this.Controls.Add(this.btnClear); 341 | this.Controls.Add(this.txtSubs); 342 | this.Controls.Add(this.btnSubs); 343 | this.Controls.Add(this.comboQuality); 344 | this.Controls.Add(this.txtCrop); 345 | this.Controls.Add(this.label5); 346 | this.Controls.Add(this.btnOutput); 347 | this.Controls.Add(this.txtWidth); 348 | this.Controls.Add(this.statusStrip1); 349 | this.Controls.Add(this.txtLength); 350 | this.Controls.Add(this.btnInput); 351 | this.Controls.Add(this.txtMaxSize); 352 | this.Controls.Add(this.txtTimeStart); 353 | this.Controls.Add(this.label4); 354 | this.Controls.Add(this.btnConvert); 355 | this.Controls.Add(this.label6); 356 | this.Controls.Add(this.label2); 357 | this.Controls.Add(this.label1); 358 | this.Controls.Add(this.label3); 359 | this.Controls.Add(this.txtOutput); 360 | this.Controls.Add(this.txtInput); 361 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 362 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 363 | this.MaximizeBox = false; 364 | this.Name = "formMain"; 365 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 366 | this.Text = "!WebM.y.TsM Converter"; 367 | this.Load += new System.EventHandler(this.formMain_Load); 368 | this.DragDrop += new System.Windows.Forms.DragEventHandler(this.formMain_DragDrop); 369 | this.DragEnter += new System.Windows.Forms.DragEventHandler(this.formMain_DragEnter); 370 | this.statusStrip1.ResumeLayout(false); 371 | this.statusStrip1.PerformLayout(); 372 | this.ResumeLayout(false); 373 | this.PerformLayout(); 374 | 375 | } 376 | 377 | #endregion 378 | 379 | private System.Windows.Forms.Button btnOutput; 380 | private System.Windows.Forms.Button btnInput; 381 | private System.Windows.Forms.TextBox txtOutput; 382 | private System.Windows.Forms.TextBox txtInput; 383 | private System.Windows.Forms.TextBox txtLength; 384 | private System.Windows.Forms.TextBox txtTimeStart; 385 | private System.Windows.Forms.Label label4; 386 | private System.Windows.Forms.Label label3; 387 | private System.Windows.Forms.Button btnConvert; 388 | private System.Windows.Forms.OpenFileDialog inputFileDialog; 389 | private System.Windows.Forms.SaveFileDialog saveFileDialog1; 390 | private System.Windows.Forms.Label label5; 391 | private System.Windows.Forms.TextBox txtWidth; 392 | private System.Windows.Forms.StatusStrip statusStrip1; 393 | private System.Windows.Forms.Label label1; 394 | private System.Windows.Forms.TextBox txtMaxSize; 395 | private System.Windows.Forms.Label label2; 396 | private System.Windows.Forms.Label label6; 397 | private System.Windows.Forms.TextBox txtCrop; 398 | private System.Windows.Forms.ToolStripStatusLabel lblThreads; 399 | private System.Windows.Forms.ComboBox comboQuality; 400 | private System.Windows.Forms.Button btnSubs; 401 | private System.Windows.Forms.TextBox txtSubs; 402 | private System.Windows.Forms.OpenFileDialog subsFileDialog; 403 | private System.Windows.Forms.Button btnClear; 404 | private System.Windows.Forms.Label label7; 405 | private System.Windows.Forms.CheckBox checkAudio; 406 | private System.Windows.Forms.Label label8; 407 | private System.Windows.Forms.TextBox txtTitle; 408 | } 409 | } 410 | 411 | -------------------------------------------------------------------------------- /formMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Diagnostics; 4 | using System.Drawing; 5 | using System.IO; 6 | using System.Text.RegularExpressions; 7 | using System.Windows.Forms; 8 | 9 | namespace MasterOfWebM 10 | { 11 | public partial class formMain : Form 12 | { 13 | // ******************** 14 | // Variables 15 | // ******************** 16 | private String THREADS = Environment.ProcessorCount.ToString(); // Obtains the number of threads the computer has 17 | private String runningDirectory = AppDomain.CurrentDomain.BaseDirectory; // Obtains the root directory 18 | 19 | Regex verifyLength = new Regex(@"^\d{1,3}"); // Regex to verify if txtLength is properly typed in 20 | Regex verifyTimeStart = new Regex(@"^[0-6]\d:[0-6]\d:[0-6]\d"); // Regex to verify if txtStartTime is properly typed in 21 | Regex verifyWidth = new Regex(@"^\d{1,4}"); // Regex to verify if txtWidth is properly typed in 22 | Regex verifyMaxSize = new Regex(@"^\d{1,4}"); // Regex to verify if txtMaxSize is properly typed in 23 | Regex verifyCrop = new Regex(@"^\d{1,4}:\d{1,4}:\d{1,4}:\d{1,4}"); // Regex to verify if txtCrop is properly typed in 24 | 25 | // ******************** 26 | // Functions 27 | // ******************** 28 | public formMain() 29 | { 30 | InitializeComponent(); 31 | } 32 | 33 | // As soon as the user clicks on txtTimeStart, get rid of the informational text 34 | private void txtTimeStart_Enter(object sender, EventArgs e) 35 | { 36 | if (txtTimeStart.Text == "HH:MM:SS") 37 | { 38 | txtTimeStart.Text = ""; 39 | txtTimeStart.ForeColor = Color.Black; 40 | } 41 | 42 | } 43 | 44 | // Check if the user clicks away without typing anything into txtTimeStart 45 | private void txtTimeStart_Leave(object sender, EventArgs e) 46 | { 47 | if (txtTimeStart.Text == "") 48 | { 49 | txtTimeStart.Text = "HH:MM:SS"; 50 | txtTimeStart.ForeColor = Color.Silver; 51 | } 52 | } 53 | 54 | private void btnConvert_Click(object sender, EventArgs e) 55 | { 56 | // Delete any existing temp subtitle file 57 | Helper.subsCheck(); 58 | 59 | // Disable btnConvert so user's cant click on it multiple times 60 | btnConvert.Enabled = false; 61 | 62 | // Base command where each element gets replaced 63 | String baseCommand = "-y {time1} -i \"{input}\" {time2} -t {length} -c:v libvpx -b:v {bitrate} {scale} -threads {threads} {metadata} {quality} {audio} "; 64 | String filterCommands = null; 65 | 66 | // Verification boolean just incase the user messes up 67 | bool verified = true; 68 | bool filters = false; 69 | 70 | double bitrate = 0; 71 | 72 | // Validates if the user input a value for txtInput 73 | if (txtInput.Text == "") 74 | { 75 | verified = false; 76 | MessageBox.Show("An input file needs to be selected", "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 77 | } 78 | else 79 | { 80 | baseCommand = baseCommand.Replace("{input}", txtInput.Text); 81 | } 82 | 83 | // Validates if the user input a value for txtOutput 84 | if (txtOutput.Text == "") 85 | { 86 | verified = false; 87 | MessageBox.Show("An output file needs to be selected", "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 88 | } 89 | 90 | // Validates if the user input a value for txtTimeStart 91 | if (!verifyTimeStart.IsMatch(txtTimeStart.Text)) 92 | { 93 | verified = false; 94 | MessageBox.Show("The time format is messed up.\nPlease use HH:MM:SS", "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 95 | } 96 | else 97 | { 98 | // Calculates the seconds from the time-code 99 | double seconds = Helper.convertToSeconds(txtTimeStart.Text); 100 | 101 | if (seconds > 30) 102 | { 103 | if (txtSubs.Text == "") 104 | { 105 | // If not subtitles exist 106 | baseCommand = baseCommand.Replace("{time1}", "-ss " + Convert.ToString(seconds - 30)); 107 | baseCommand = baseCommand.Replace("{time2}", "-ss 30"); 108 | } 109 | else 110 | { 111 | // If subtitles exist 112 | baseCommand = baseCommand.Replace(" {time1}", ""); 113 | baseCommand = baseCommand.Replace("{time2}", "-ss " + Convert.ToString(seconds)); 114 | } 115 | } 116 | else 117 | { 118 | baseCommand = baseCommand.Replace(" {time1}", ""); 119 | baseCommand = baseCommand.Replace("{time2}", "-ss " + seconds); 120 | } 121 | } 122 | 123 | // Validates if the user input a value for txtLength 124 | if (!verifyLength.IsMatch(txtLength.Text)) 125 | { 126 | verified = false; 127 | MessageBox.Show("The length of the video is not properly set", "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 128 | } 129 | else 130 | { 131 | baseCommand = baseCommand.Replace("{length}", txtLength.Text); 132 | } 133 | 134 | // Validates if the user input a value for txtCrop 135 | if (!verifyCrop.IsMatch(txtCrop.Text)) 136 | { 137 | if (txtCrop.Text != "o_w:o_h:x:y") 138 | { 139 | verified = false; 140 | MessageBox.Show("The crop field is not properly set\nSyntax:\nout_x:out_y:x:y\n\nout_x & out_y is the output size\nx & y are where you begin your crop", 141 | "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 142 | } 143 | } 144 | else 145 | { 146 | filters = true; 147 | filterCommands += filterCommands == null ? "crop=" + txtCrop.Text : ",crop=" + txtCrop.Text; 148 | } 149 | 150 | // Check if we need to add subtitles 151 | if (txtSubs.Text != "") 152 | { 153 | switch (Path.GetExtension(txtSubs.Text)) 154 | { 155 | case ".ass": 156 | filters = true; 157 | File.Copy(txtSubs.Text, runningDirectory + "subs.ass"); 158 | filterCommands += filterCommands == null ? "ass=subs.ass" : ",ass=subs.ass"; 159 | break; 160 | case ".srt": 161 | filters = true; 162 | File.Copy(txtSubs.Text, runningDirectory + "subs.srt"); 163 | filterCommands += filterCommands == null ? "subtitles=subs.srt" : ",subtitles=subs.srt"; 164 | break; 165 | } 166 | } 167 | 168 | // Validates if the user input a value for txtWidth 169 | if (!verifyWidth.IsMatch(txtWidth.Text)) 170 | { 171 | if (txtWidth.Text != "") 172 | { 173 | verified = false; 174 | MessageBox.Show("The width is not properly set", "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 175 | } 176 | } 177 | else 178 | { 179 | filters = true; 180 | filterCommands += filterCommands == null ? "scale=" + txtWidth.Text + ":-1" : ",scale=" + txtWidth.Text + ":-1"; 181 | } 182 | 183 | // Validates if the user input a value for txtMaxSize 184 | if (!verifyMaxSize.IsMatch(txtMaxSize.Text)) 185 | { 186 | verified = false; 187 | MessageBox.Show("The maxium file size is not properly set", "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 188 | } 189 | else 190 | { 191 | try 192 | { 193 | bitrate = Helper.calcBitrate(txtMaxSize.Text, txtLength.Text); 194 | } 195 | catch (Exception ex) 196 | { 197 | Debug.WriteLine(ex.Message); 198 | } 199 | 200 | // If audio is requested 201 | if (checkAudio.Checked) 202 | { 203 | // TODO: Give bitrate options for audio (currently enforcing 48k) 204 | // TODO: Disable audio encoding on first pass to speed up encoding 205 | bitrate -= 48; 206 | baseCommand = baseCommand.Replace("{audio}", "-c:a libvorbis -b:a 48k"); 207 | } 208 | else 209 | { 210 | baseCommand = baseCommand.Replace("{audio}", "-an"); 211 | } 212 | 213 | // Changes the quality to what the user selected 214 | switch (comboQuality.Text) 215 | { 216 | case "Good": 217 | baseCommand = baseCommand.Replace("{quality}", "-quality good -cpu-used 0"); 218 | baseCommand = baseCommand.Replace("{bitrate}", bitrate.ToString() + "K"); 219 | break; 220 | case "Best": 221 | baseCommand = baseCommand.Replace("{quality}", "-quality best -auto-alt-ref 1 -lag-in-frames 16 -slices 8"); 222 | baseCommand = baseCommand.Replace("{bitrate}", bitrate.ToString() + "K"); 223 | break; 224 | case "Ultra": 225 | baseCommand = baseCommand.Replace("{quality}", "-quality best -auto-alt-ref 1 -lag-in-frames 16 -slices 8"); 226 | bitrate = Convert.ToDouble(bitrate) * 1024; 227 | baseCommand = baseCommand.Replace("{bitrate}", bitrate.ToString()); 228 | break; 229 | } 230 | } 231 | 232 | // If any filters are being used, add them to baseCommand 233 | if (filters) 234 | { 235 | filterCommands = "-vf " + filterCommands; 236 | baseCommand = baseCommand.Replace("{scale}", filterCommands); 237 | } 238 | else 239 | { 240 | baseCommand = baseCommand.Replace(" {scale}", ""); 241 | } 242 | 243 | // Validates if the user input a value for txtTitle 244 | if (txtTitle.Text != "") 245 | { 246 | baseCommand = baseCommand.Replace("{metadata}", string.Format("-metadata title=\"{0}\"", txtTitle.Text.Replace("\"", "\\\""))); 247 | } 248 | 249 | // If everything is valid, continue with the conversion 250 | if (verified) 251 | { 252 | baseCommand = baseCommand.Replace("{threads}", THREADS); 253 | 254 | try 255 | { 256 | Helper.encodeVideo(baseCommand, txtOutput.Text); 257 | } 258 | catch (Win32Exception ex) 259 | { 260 | MessageBox.Show("It appears you are missing ffmpeg. Please\ngo obtain a copy of it, and put it in the same\nfolder as this executable.", 261 | "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 262 | Debug.WriteLine(ex); 263 | } 264 | 265 | double fileSize = Helper.getFileSize(txtOutput.Text); 266 | 267 | if (fileSize < Convert.ToDouble(txtMaxSize.Text) * 1024) 268 | { 269 | // Clears the output box so user's don't overwrite their previous output 270 | txtOutput.Text = ""; 271 | if (txtSubs.Text != "") 272 | { 273 | switch (Path.GetExtension(txtSubs.Text)) 274 | { 275 | case ".ass": 276 | File.Delete(runningDirectory + "\\subs.ass"); 277 | break; 278 | case ".srt": 279 | File.Delete(runningDirectory + "\\subs.srt"); 280 | break; 281 | } 282 | txtSubs.Text = ""; 283 | } 284 | } 285 | else 286 | { 287 | if (comboQuality.Text == "Ultra") 288 | { 289 | /* 290 | * Automatically attempt to create a smaller file 291 | * If it doesn't work within 10 attempts, recommend 292 | * 'Best' quality 293 | */ 294 | int passes = 0; 295 | 296 | while (fileSize > Convert.ToDouble(txtMaxSize.Text) * 1024 && passes <= 10) 297 | { 298 | // Lowers the bitrate by 1k 299 | bitrate -= 1000; 300 | 301 | // Replacing the whole command just in case the file name contains the same numbers 302 | baseCommand = baseCommand.Replace("-b:v " + (bitrate + 1000), "-b:v " + bitrate); 303 | 304 | Helper.encodeVideo(baseCommand, txtOutput.Text); 305 | passes++; 306 | 307 | // Gets the filesize after encoding 308 | fileSize = Helper.getFileSize(txtOutput.Text); 309 | } 310 | 311 | if (fileSize < Convert.ToDouble(txtMaxSize.Text) * 1024) 312 | { 313 | txtOutput.Text = ""; 314 | 315 | if (txtSubs.Text != "") 316 | { 317 | switch (Path.GetExtension(txtSubs.Text)) 318 | { 319 | case ".ass": 320 | File.Delete(runningDirectory + "\\subs.ass"); 321 | break; 322 | case ".srt": 323 | File.Delete(runningDirectory + "\\subs.srt"); 324 | break; 325 | } 326 | txtSubs.Text = ""; 327 | } 328 | } 329 | else 330 | MessageBox.Show("Could not get the file size below " + txtMaxSize.Text + "MB.\n" + 331 | "Try using 'Best' quality, and if that doesn't work,\n" + 332 | "you must reduce your resolution and/or shorten the length.", 333 | "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 334 | } 335 | else 336 | { 337 | MessageBox.Show("The final clip is larger than " + txtMaxSize.Text + "MB.\n" + 338 | "This occured because the clip's resolution was too large,\n" + 339 | "and/or because the clip was too long for the inputted size."); 340 | } 341 | } 342 | } 343 | 344 | // Re-enable the button after a run 345 | btnConvert.Enabled = true; 346 | } 347 | 348 | private void btnInput_Click(object sender, EventArgs e) 349 | { 350 | if (inputFileDialog.ShowDialog() == DialogResult.OK) 351 | { 352 | txtInput.Text = inputFileDialog.FileName; 353 | } 354 | 355 | } 356 | 357 | private void btnOutput_Click(object sender, EventArgs e) 358 | { 359 | if (saveFileDialog1.ShowDialog() == DialogResult.OK) 360 | { 361 | txtOutput.Text = saveFileDialog1.FileName; 362 | } 363 | } 364 | 365 | private void formMain_Load(object sender, EventArgs e) 366 | { 367 | lblThreads.Text = "Threads: " + THREADS; 368 | comboQuality.SelectedIndex = 0; 369 | 370 | // Calls the font config checker, and if something went wrong, it disables converting 371 | if (!Helper.checkFFmpegFontConfig()) 372 | { 373 | btnConvert.Enabled = false; 374 | } 375 | 376 | Helper.checkUpdate(); 377 | } 378 | 379 | // Handles when the user focuses txtCrop 380 | private void txtCrop_Enter(object sender, EventArgs e) 381 | { 382 | txtCrop.Left -= 46; 383 | txtCrop.Size = new System.Drawing.Size(115, 20); 384 | txtCrop.ForeColor = Color.Black; 385 | 386 | if (txtCrop.Text == "o_w:o_h:x:y") 387 | { 388 | txtCrop.Text = ""; 389 | } 390 | } 391 | 392 | // Handles when the user unfocuses txtCrop 393 | private void txtCrop_Leave(object sender, EventArgs e) 394 | { 395 | txtCrop.Left += 46; 396 | txtCrop.Size = new System.Drawing.Size(69, 20); 397 | 398 | if (txtCrop.Text == "") 399 | { 400 | txtCrop.Text = "o_w:o_h:x:y"; 401 | txtCrop.ForeColor = Color.Silver; 402 | } 403 | } 404 | 405 | private void btnSubs_Click(object sender, EventArgs e) 406 | { 407 | if (subsFileDialog.ShowDialog() == DialogResult.OK) 408 | { 409 | txtSubs.Text = subsFileDialog.FileName; 410 | } 411 | } 412 | 413 | private void btnClear_Click(object sender, EventArgs e) 414 | { 415 | txtInput.Text = txtOutput.Text = txtSubs.Text = txtLength.Text = txtWidth.Text = ""; 416 | txtTimeStart.Text = "HH:MM:SS"; 417 | txtTimeStart.ForeColor = Color.Silver; 418 | txtMaxSize.Text = "3"; 419 | txtCrop.Text = "o_w:o_h:x:y"; 420 | txtCrop.ForeColor = Color.Silver; 421 | txtTitle.Text = ""; 422 | comboQuality.SelectedIndex = 0; 423 | checkAudio.Checked = false; 424 | } 425 | 426 | private void comboQuality_SelectedIndexChanged(object sender, EventArgs e) 427 | { 428 | if (comboQuality.Text == "Ultra") 429 | MessageBox.Show("Ultra quality will try getting just under your\n" + 430 | "'Max Size'. This program will run ffmpeg up to 11 \n" + 431 | "times and currently there is no way of stopping it.\n\n" + 432 | "USE AT YOUR OWN RISK.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); 433 | } 434 | 435 | private void formMain_DragEnter(object sender, DragEventArgs e) 436 | { 437 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) 438 | { 439 | e.Effect = DragDropEffects.Copy; 440 | } 441 | else 442 | { 443 | e.Effect = DragDropEffects.None; 444 | } 445 | } 446 | 447 | private void formMain_DragDrop(object sender, DragEventArgs e) 448 | { 449 | var files = (string[])e.Data.GetData(DataFormats.FileDrop); 450 | 451 | txtInput.Text = files[0]; 452 | } 453 | } 454 | } 455 | -------------------------------------------------------------------------------- /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasterOfWebM/WebM-Converter/1c7683f2c1e9c498f8d7b0a342bf34962a033ae8/icon.ico -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | The GNU General Public License, Version 2, June 1991 (GPLv2) 2 | ============================================================ 3 | 4 | > Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | > 59 Temple Place, Suite 330 6 | > Boston, MA 02111-1307 USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this license 9 | document, but changing it is not allowed. 10 | 11 | 12 | Preamble 13 | -------- 14 | 15 | The licenses for most software are designed to take away your freedom to share 16 | and change it. By contrast, the GNU General Public License is intended to 17 | guarantee your freedom to share and change free software--to make sure the 18 | software is free for all its users. This General Public License applies to most 19 | of the Free Software Foundation's software and to any other program whose 20 | authors commit to using it. (Some other Free Software Foundation software is 21 | covered by the GNU Library General Public License instead.) You can apply it to 22 | your programs, too. 23 | 24 | When we speak of free software, we are referring to freedom, not price. Our 25 | General Public Licenses are designed to make sure that you have the freedom to 26 | distribute copies of free software (and charge for this service if you wish), 27 | that you receive source code or can get it if you want it, that you can change 28 | the software or use pieces of it in new free programs; and that you know you can 29 | do these things. 30 | 31 | To protect your rights, we need to make restrictions that forbid anyone to deny 32 | you these rights or to ask you to surrender the rights. These restrictions 33 | translate to certain responsibilities for you if you distribute copies of the 34 | software, or if you modify it. 35 | 36 | For example, if you distribute copies of such a program, whether gratis or for a 37 | fee, you must give the recipients all the rights that you have. You must make 38 | sure that they, too, receive or can get the source code. And you must show them 39 | these terms so they know their rights. 40 | 41 | We protect your rights with two steps: (1) copyright the software, and (2) offer 42 | you this license which gives you legal permission to copy, distribute and/or 43 | modify the software. 44 | 45 | Also, for each author's protection and ours, we want to make certain that 46 | everyone understands that there is no warranty for this free software. If the 47 | software is modified by someone else and passed on, we want its recipients to 48 | know that what they have is not the original, so that any problems introduced by 49 | others will not reflect on the original authors' reputations. 50 | 51 | Finally, any free program is threatened constantly by software patents. We wish 52 | to avoid the danger that redistributors of a free program will individually 53 | obtain patent licenses, in effect making the program proprietary. To prevent 54 | this, we have made it clear that any patent must be licensed for everyone's free 55 | use or not licensed at all. 56 | 57 | The precise terms and conditions for copying, distribution and modification 58 | follow. 59 | 60 | 61 | Terms And Conditions For Copying, Distribution And Modification 62 | --------------------------------------------------------------- 63 | 64 | **0.** This License applies to any program or other work which contains a notice 65 | placed by the copyright holder saying it may be distributed under the terms of 66 | this General Public License. The "Program", below, refers to any such program or 67 | work, and a "work based on the Program" means either the Program or any 68 | derivative work under copyright law: that is to say, a work containing the 69 | Program or a portion of it, either verbatim or with modifications and/or 70 | translated into another language. (Hereinafter, translation is included without 71 | limitation in the term "modification".) Each licensee is addressed as "you". 72 | 73 | Activities other than copying, distribution and modification are not covered by 74 | this License; they are outside its scope. The act of running the Program is not 75 | restricted, and the output from the Program is covered only if its contents 76 | constitute a work based on the Program (independent of having been made by 77 | running the Program). Whether that is true depends on what the Program does. 78 | 79 | **1.** You may copy and distribute verbatim copies of the Program's source code 80 | as you receive it, in any medium, provided that you conspicuously and 81 | appropriately publish on each copy an appropriate copyright notice and 82 | disclaimer of warranty; keep intact all the notices that refer to this License 83 | and to the absence of any warranty; and give any other recipients of the Program 84 | a copy of this License along with the Program. 85 | 86 | You may charge a fee for the physical act of transferring a copy, and you may at 87 | your option offer warranty protection in exchange for a fee. 88 | 89 | **2.** You may modify your copy or copies of the Program or any portion of it, 90 | thus forming a work based on the Program, and copy and distribute such 91 | modifications or work under the terms of Section 1 above, provided that you also 92 | meet all of these conditions: 93 | 94 | * **a)** You must cause the modified files to carry prominent notices stating 95 | that you changed the files and the date of any change. 96 | 97 | * **b)** You must cause any work that you distribute or publish, that in whole 98 | or in part contains or is derived from the Program or any part thereof, to 99 | be licensed as a whole at no charge to all third parties under the terms of 100 | this License. 101 | 102 | * **c)** If the modified program normally reads commands interactively when 103 | run, you must cause it, when started running for such interactive use in the 104 | most ordinary way, to print or display an announcement including an 105 | appropriate copyright notice and a notice that there is no warranty (or 106 | else, saying that you provide a warranty) and that users may redistribute 107 | the program under these conditions, and telling the user how to view a copy 108 | of this License. (Exception: if the Program itself is interactive but does 109 | not normally print such an announcement, your work based on the Program is 110 | not required to print an announcement.) 111 | 112 | These requirements apply to the modified work as a whole. If identifiable 113 | sections of that work are not derived from the Program, and can be reasonably 114 | considered independent and separate works in themselves, then this License, and 115 | its terms, do not apply to those sections when you distribute them as separate 116 | works. But when you distribute the same sections as part of a whole which is a 117 | work based on the Program, the distribution of the whole must be on the terms of 118 | this License, whose permissions for other licensees extend to the entire whole, 119 | and thus to each and every part regardless of who wrote it. 120 | 121 | Thus, it is not the intent of this section to claim rights or contest your 122 | rights to work written entirely by you; rather, the intent is to exercise the 123 | right to control the distribution of derivative or collective works based on the 124 | Program. 125 | 126 | In addition, mere aggregation of another work not based on the Program with the 127 | Program (or with a work based on the Program) on a volume of a storage or 128 | distribution medium does not bring the other work under the scope of this 129 | License. 130 | 131 | **3.** You may copy and distribute the Program (or a work based on it, under 132 | Section 2) in object code or executable form under the terms of Sections 1 and 2 133 | above provided that you also do one of the following: 134 | 135 | * **a)** Accompany it with the complete corresponding machine-readable source 136 | code, which must be distributed under the terms of Sections 1 and 2 above on 137 | a medium customarily used for software interchange; or, 138 | 139 | * **b)** Accompany it with a written offer, valid for at least three years, to 140 | give any third party, for a charge no more than your cost of physically 141 | performing source distribution, a complete machine-readable copy of the 142 | corresponding source code, to be distributed under the terms of Sections 1 143 | and 2 above on a medium customarily used for software interchange; or, 144 | 145 | * **c)** Accompany it with the information you received as to the offer to 146 | distribute corresponding source code. (This alternative is allowed only for 147 | noncommercial distribution and only if you received the program in object 148 | code or executable form with such an offer, in accord with Subsection b 149 | above.) 150 | 151 | The source code for a work means the preferred form of the work for making 152 | modifications to it. For an executable work, complete source code means all the 153 | source code for all modules it contains, plus any associated interface 154 | definition files, plus the scripts used to control compilation and installation 155 | of the executable. However, as a special exception, the source code distributed 156 | need not include anything that is normally distributed (in either source or 157 | binary form) with the major components (compiler, kernel, and so on) of the 158 | operating system on which the executable runs, unless that component itself 159 | accompanies the executable. 160 | 161 | If distribution of executable or object code is made by offering access to copy 162 | from a designated place, then offering equivalent access to copy the source code 163 | from the same place counts as distribution of the source code, even though third 164 | parties are not compelled to copy the source along with the object code. 165 | 166 | **4.** You may not copy, modify, sublicense, or distribute the Program except as 167 | expressly provided under this License. Any attempt otherwise to copy, modify, 168 | sublicense or distribute the Program is void, and will automatically terminate 169 | your rights under this License. However, parties who have received copies, or 170 | rights, from you under this License will not have their licenses terminated so 171 | long as such parties remain in full compliance. 172 | 173 | **5.** You are not required to accept this License, since you have not signed 174 | it. However, nothing else grants you permission to modify or distribute the 175 | Program or its derivative works. These actions are prohibited by law if you do 176 | not accept this License. Therefore, by modifying or distributing the Program (or 177 | any work based on the Program), you indicate your acceptance of this License to 178 | do so, and all its terms and conditions for copying, distributing or modifying 179 | the Program or works based on it. 180 | 181 | **6.** Each time you redistribute the Program (or any work based on the 182 | Program), the recipient automatically receives a license from the original 183 | licensor to copy, distribute or modify the Program subject to these terms and 184 | conditions. You may not impose any further restrictions on the recipients' 185 | exercise of the rights granted herein. You are not responsible for enforcing 186 | compliance by third parties to this License. 187 | 188 | **7.** If, as a consequence of a court judgment or allegation of patent 189 | infringement or for any other reason (not limited to patent issues), conditions 190 | are imposed on you (whether by court order, agreement or otherwise) that 191 | contradict the conditions of this License, they do not excuse you from the 192 | conditions of this License. If you cannot distribute so as to satisfy 193 | simultaneously your obligations under this License and any other pertinent 194 | obligations, then as a consequence you may not distribute the Program at all. 195 | For example, if a patent license would not permit royalty-free redistribution of 196 | the Program by all those who receive copies directly or indirectly through you, 197 | then the only way you could satisfy both it and this License would be to refrain 198 | entirely from distribution of the Program. 199 | 200 | If any portion of this section is held invalid or unenforceable under any 201 | particular circumstance, the balance of the section is intended to apply and the 202 | section as a whole is intended to apply in other circumstances. 203 | 204 | It is not the purpose of this section to induce you to infringe any patents or 205 | other property right claims or to contest validity of any such claims; this 206 | section has the sole purpose of protecting the integrity of the free software 207 | distribution system, which is implemented by public license practices. Many 208 | people have made generous contributions to the wide range of software 209 | distributed through that system in reliance on consistent application of that 210 | system; it is up to the author/donor to decide if he or she is willing to 211 | distribute software through any other system and a licensee cannot impose that 212 | choice. 213 | 214 | This section is intended to make thoroughly clear what is believed to be a 215 | consequence of the rest of this License. 216 | 217 | **8.** If the distribution and/or use of the Program is restricted in certain 218 | countries either by patents or by copyrighted interfaces, the original copyright 219 | holder who places the Program under this License may add an explicit 220 | geographical distribution limitation excluding those countries, so that 221 | distribution is permitted only in or among countries not thus excluded. In such 222 | case, this License incorporates the limitation as if written in the body of this 223 | License. 224 | 225 | **9.** The Free Software Foundation may publish revised and/or new versions of 226 | the General Public License from time to time. Such new versions will be similar 227 | in spirit to the present version, but may differ in detail to address new 228 | problems or concerns. 229 | 230 | Each version is given a distinguishing version number. If the Program specifies 231 | a version number of this License which applies to it and "any later version", 232 | you have the option of following the terms and conditions either of that version 233 | or of any later version published by the Free Software Foundation. If the 234 | Program does not specify a version number of this License, you may choose any 235 | version ever published by the Free Software Foundation. 236 | 237 | **10.** If you wish to incorporate parts of the Program into other free programs 238 | whose distribution conditions are different, write to the author to ask for 239 | permission. For software which is copyrighted by the Free Software Foundation, 240 | write to the Free Software Foundation; we sometimes make exceptions for this. 241 | Our decision will be guided by the two goals of preserving the free status of 242 | all derivatives of our free software and of promoting the sharing and reuse of 243 | software generally. 244 | 245 | 246 | No Warranty 247 | ----------- 248 | 249 | **11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR 250 | THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE 251 | STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM 252 | "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, 253 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 254 | PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 255 | PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 256 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 257 | 258 | **12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 259 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 260 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 261 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR 262 | INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA 263 | BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 264 | FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER 265 | OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 266 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | #!WebM.y.TsM's WebM Converter 2 | This is a simple wrapper for [FFmpeg](http://www.ffmpeg.org/download.html) to create WebM files. My version is generally among the best, due to my experience with encoding videos for years. To download it, please click [here](https://github.com/MasterOfWebM/WebM-Converter/releases/download/v1.1/Release_v1.1.zip). 3 | 4 | Make sure that you have your own FFmpeg in the root directory of the program, otherwise nothing will happen. Better yet, FFmpeg should be within your System Variable, but whatever. 5 | 6 | ##What can it do? 7 | This is what she looks like: 8 | 9 | ![alt text](http://i.imgur.com/ByZBrvV.png) 10 | 11 | Currently she can: 12 | 13 | * Automatically calculate the bitrate needed for a given size 14 | * Checks the size of the outputted video to see if it worked properly 15 | * If it didn't, then it gives recommendations to fix the file size 16 | * Ability to use subtitles 17 | * Update check 18 | * Scale the video 19 | * Crop the video 20 | * Seek to a custom time 21 | * Obtain incredibly close results in file size (currently limited support) 22 | 23 | ##Why only offer 2-pass? 24 | Currently it is only offered since this is designed as a GUI for 4chan users. 2-pass encoding will look better than crf with q-min/max 95% of the time, since 2-pass is designed to get the best quality for a given size. In the future, I wish to make a complete WebM wrapper, and even maybe a complete FFmpeg wrapper. 25 | 26 | ##Can you explain what the weird flags are? 27 | Sure! 28 | 29 | * -quality best: Should be obvious. You can use "-quality good -cpu-used 0" to speed it up, but the results will looks worse. 30 | * -slices 8: Slices make the encoder cut the individual frames into the amount of slices (1, 2, 4, & 8 are possible). Generally 4 is good enough for 720p content. Slices slightly increase the quality of each frame. 31 | * -auto-alt-ref 1: This enables the encoder to look into the future instead of just the past, or "Golden Frame". This can increase the quality drastically, or severely hurt it. It works 99% of the time, so I just leave it on. 32 | * -lag-in-frames 16: This is amount of frames it can look into the future. The limit is around 25, but 16 seems to be the best quality/speed tradeoff point on lower-end machines. 33 | 34 | ##Why a speaker icon? 35 | Irony. 36 | 37 | ##What is planned? 38 | Plenty of stuff is planned: 39 | 40 | * Drag and Drop 41 | * Preview (general and crop) 42 | * Plenty of more stuff 43 | 44 | ##License 45 | The code is released under [the GPLv2 license](http://www.gnu.org/licenses/gpl-2.0.html). 46 | -------------------------------------------------------------------------------- /update.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.1.0 4 | https://github.com/MasterOfWebM/WebM-Converter/releases/download/v1.1/Release_v1.1.zip 5 | --------------------------------------------------------------------------------