Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
moisespr123 committed Oct 16, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
0 parents commit a43043f
Showing 16 changed files with 1,675 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
261 changes: 261 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
project.fragment.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# rav1e_gui
A GUI to convert video files to AV1 using rav1e

![Screenshot](https://moisescardona.me/files/rav1e_gui/rav1e_gui_v1.0.PNG)

I wrote this software to test the rav1e software. Unfortunately, at the current state, rav1e is single-threaded. This GUI solves the issue and enabled multithreading by converting and splitting the input video file into 1-second segments y4m files and splitting the audio as a WAV file using ffmpeg. It then encodes each file using a CPU thread. After the encoding is finished, the WAV file is converted to Opus and the .ivf files are concatenated. Lastly, the .ivf and .opus files are merged into a .webm container.

## Dependencies:
* You need my build of `opusenc.exe`. You can get it here: https://moisescardona.me/opusenc-libopus%201.3-rc2-2-ga8e2a2b1-dirty-resample-10
* You need ffmpeg as found here: https://ffmpeg.zeranoe.com/builds/. Use the nightly builds.
* You also need rav1e

Written in Visual Basic .NET using Visual Studio 2017.

Enjoy!
31 changes: 31 additions & 0 deletions rav1e_gui.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "rav1e_gui", "rav1e_gui\rav1e_gui.vbproj", "{51B64CB0-26F1-466F-A4EF-05F48DA441ED}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|x64.ActiveCfg = Debug|x64
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|x64.Build.0 = Debug|x64
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|Any CPU.Build.0 = Release|Any CPU
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|x64.ActiveCfg = Release|x64
{51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6677CD0A-1F01-4E78-AAC1-7B208DACE1C2}
EndGlobalSection
EndGlobal
30 changes: 30 additions & 0 deletions rav1e_gui/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>


<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="rav1e_gui.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>

<userSettings>
<rav1e_gui.My.MySettings>
<setting name="quantizer" serializeAs="String">
<value>100</value>
</setting>
<setting name="speed" serializeAs="String">
<value>3</value>
</setting>
<setting name="tempFolder" serializeAs="String">
<value />
</setting>
<setting name="bitrate" serializeAs="String">
<value>64</value>
</setting>
</rav1e_gui.My.MySettings>
</userSettings>
</configuration>
335 changes: 335 additions & 0 deletions rav1e_gui/Form1.Designer.vb
120 changes: 120 additions & 0 deletions rav1e_gui/Form1.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
285 changes: 285 additions & 0 deletions rav1e_gui/Form1.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
Public Class Form1
Private GUILoaded As Boolean = False
Private Sub InputBrowseBtn_Click(sender As Object, e As EventArgs) Handles InputBrowseBtn.Click
Dim InputBrowser As New OpenFileDialog With {
.Title = "Browse for a video file",
.FileName = "",
.Filter = "All Files|*.*"
}
Dim OkAction As MsgBoxResult = InputBrowser.ShowDialog
If OkAction = MsgBoxResult.Ok Then
InputTxt.Text = InputBrowser.FileName
End If
End Sub

Private Sub OutputBrowseBtn_Click(sender As Object, e As EventArgs) Handles OutputBrowseBtn.Click
Dim OutputBrowser As New SaveFileDialog With {
.Title = "Save Video File",
.FileName = "",
.Filter = "WebM|*.webm"
}
Dim OkAction As MsgBoxResult = OutputBrowser.ShowDialog
If OkAction = MsgBoxResult.Ok Then
OutputTxt.Text = OutputBrowser.FileName
End If
End Sub

Private Sub StartBtn_Click(sender As Object, e As EventArgs) Handles StartBtn.Click
StartBtn.Enabled = False
InputTxt.Enabled = False
OutputTxt.Enabled = False
InputBrowseBtn.Enabled = False
OutputBrowseBtn.Enabled = False
audioBitrate.Enabled = False
quantizer.Enabled = False
speed.Enabled = False
tempLocationPath.Enabled = False
BrowseTempLocation.Enabled = False
If Not IO.Path.GetExtension(OutputTxt.Text) = ".webm" Then
OutputTxt.Text = My.Computer.FileSystem.GetParentPath(OutputTxt.Text) + "\" + IO.Path.GetFileNameWithoutExtension(OutputTxt.Text) + ".webm"
End If
Dim StartTasks As New Threading.Thread(Sub() StartThreads())
StartTasks.Start()
End Sub
Private Sub StartThreads()
If split_video_file(InputTxt.Text, tempLocationPath.Text) Then
If extract_audio(InputTxt.Text, tempLocationPath.Text) Then
Dim ItemsToProcess As List(Of String) = New List(Of String)
For Each File As String In IO.Directory.GetFiles(tempLocationPath.Text)
If IO.Path.GetExtension(File) = ".y4m" And File.Contains("y4m-part-") Then
ItemsToProcess.Add(File)
End If
Next
ItemsToProcess.Sort()
ProgressBar1.BeginInvoke(Sub()
ProgressBar1.Maximum = ItemsToProcess.Count
ProgressBar1.Value = 0
End Sub)
Dim tasks = New List(Of Action)
Dim streamWriter As New IO.StreamWriter(tempLocationPath.Text + "\rav1e-concatenate-list.txt")
For Counter As Integer = 0 To ItemsToProcess.Count - 1
Dim args As Array = {ItemsToProcess(Counter), tempLocationPath.Text + "\" + IO.Path.GetFileNameWithoutExtension(ItemsToProcess(Counter)) + ".ivf", My.Settings.quantizer, My.Settings.speed}
streamWriter.WriteLine("file '" + tempLocationPath.Text.Replace("\", "/") + "/" + IO.Path.GetFileNameWithoutExtension(ItemsToProcess(Counter)) + ".ivf" + "'")
tasks.Add(Function() Run_rav1e(args))
Next
streamWriter.Close()
Dim options As New ParallelOptions With {.MaxDegreeOfParallelism = Environment.ProcessorCount}
Parallel.Invoke(options, tasks.ToArray())
Run_opus(My.Settings.bitrate, tempLocationPath.Text)
concatenate_video_files(tempLocationPath.Text + "\rav1e-concatenate-list.txt", tempLocationPath.Text)
merge_audio_video(OutputTxt.Text, tempLocationPath.Text)
clean_temp_folder(tempLocationPath.Text)
StartBtn.BeginInvoke(Sub()
StartBtn.Enabled = True
audioBitrate.Enabled = True
quantizer.Enabled = True
speed.Enabled = True
tempLocationPath.Enabled = True
BrowseTempLocation.Enabled = True
OutputTxt.Enabled = True
InputTxt.Enabled = True
InputBrowseBtn.Enabled = True
OutputBrowseBtn.Enabled = True
End Sub)
MsgBox("Finished")
End If
End If
End Sub
Private Function Run_opus(audio_bitrate As Integer, tempFolder As String)
Dim opusProcessInfo As New ProcessStartInfo
Dim opusProcess As Process
opusProcessInfo.FileName = "opusenc.exe"
opusProcessInfo.Arguments = "--music --bitrate " & audio_bitrate & " """ + tempFolder + "\rav1e-audio.wav"""
opusProcessInfo.CreateNoWindow = True
opusProcessInfo.RedirectStandardOutput = False
opusProcessInfo.UseShellExecute = False
opusProcess = Process.Start(opusProcessInfo)
opusProcess.WaitForExit()
Return True
End Function
Private Function Run_rav1e(args As Array)
Dim Input_File As String = args(0)
Dim Output_File As String = args(1)
Dim Quantizer As String = args(2)
Dim Speed As String = args(3)
Dim rav1eProcessInfo As New ProcessStartInfo
Dim rav1eProcess As Process
rav1eProcessInfo.FileName = "rav1e.exe"
rav1eProcessInfo.Arguments = """" + Input_File + """ -o """ + Output_File + """ --quantizer " + Quantizer + " -s " + Speed
rav1eProcessInfo.CreateNoWindow = True
rav1eProcessInfo.RedirectStandardOutput = False
rav1eProcessInfo.UseShellExecute = False
rav1eProcess = Process.Start(rav1eProcessInfo)
rav1eProcess.WaitForExit()
ProgressBar1.BeginInvoke(Sub() ProgressBar1.PerformStep())
Return True
End Function

Private Function split_video_file(input As String, tempFolder As String)
Dim ffmpegProcessInfo As New ProcessStartInfo
Dim ffmpegProcess As Process
ffmpegProcessInfo.FileName = "ffmpeg.exe"
ffmpegProcessInfo.Arguments = "-i """ + input + """ -f segment -segment_time 1 """ + tempFolder + "/y4m-part-%6d.y4m"""
ffmpegProcessInfo.CreateNoWindow = True
ffmpegProcessInfo.RedirectStandardOutput = False
ffmpegProcessInfo.UseShellExecute = False
ffmpegProcess = Process.Start(ffmpegProcessInfo)
ffmpegProcess.WaitForExit()
Return True
End Function

Private Function concatenate_video_files(input As String, tempFolder As String)
Dim ffmpegProcessInfo As New ProcessStartInfo
Dim ffmpegProcess As Process
ffmpegProcessInfo.FileName = "ffmpeg.exe"
ffmpegProcessInfo.Arguments = "-f concat -safe 0 -i """ + input + """ -c copy """ + tempFolder + "\rav1e-concatenated-file.ivf"""
ffmpegProcessInfo.CreateNoWindow = True
ffmpegProcessInfo.RedirectStandardOutput = False
ffmpegProcessInfo.UseShellExecute = False
ffmpegProcess = Process.Start(ffmpegProcessInfo)
ffmpegProcess.WaitForExit()
Return True
End Function
Private Function clean_temp_folder(tempFolder As String)
For Each File As String In IO.Directory.GetFiles(tempLocationPath.Text)
If (IO.Path.GetExtension(File) = ".y4m" Or IO.Path.GetExtension(File) = ".ivf" And File.Contains("y4m-part-")) Or IO.Path.GetFileName(File) = "rav1e-audio.opus" Or IO.Path.GetFileName(File) = "rav1e-audio.wav" Or IO.Path.GetFileName(File) = "rav1e-concatenated-file.ivf" Or IO.Path.GetFileName(File) = "rav1e-concatenate-list.txt" Then
My.Computer.FileSystem.DeleteFile(File)
End If
Next
Return True
End Function
Private Function merge_audio_video(output As String, tempFolder As String)
Dim ffmpegProcessInfo As New ProcessStartInfo
Dim ffmpegProcess As Process
ffmpegProcessInfo.FileName = "ffmpeg.exe"
ffmpegProcessInfo.Arguments = "-i """ + tempFolder + "\rav1e-concatenated-file.ivf"" -i """ + tempFolder + "\rav1e-audio.opus"" -c:v copy -c:a copy """ + output + """"
ffmpegProcessInfo.CreateNoWindow = True
ffmpegProcessInfo.RedirectStandardOutput = False
ffmpegProcessInfo.UseShellExecute = False
ffmpegProcess = Process.Start(ffmpegProcessInfo)
ffmpegProcess.WaitForExit()
Return True
End Function

Private Function extract_audio(input As String, tempFolder As String)
Dim ffmpegProcessInfo As New ProcessStartInfo
Dim ffmpegProcess As Process
ffmpegProcessInfo.FileName = "ffmpeg.exe"
ffmpegProcessInfo.Arguments = "-i """ + input + """ -vn """ + tempFolder + "\rav1e-audio.wav"""
ffmpegProcessInfo.CreateNoWindow = True
ffmpegProcessInfo.RedirectStandardOutput = False
ffmpegProcessInfo.UseShellExecute = False
ffmpegProcess = Process.Start(ffmpegProcessInfo)
ffmpegProcess.WaitForExit()
Return True
End Function

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
quantizer.Value = My.Settings.quantizer
speed.Value = My.Settings.speed
audioBitrate.Value = My.Settings.bitrate
tempLocationPath.Text = My.Settings.tempFolder
If OpusEncExists() Then
GetOpusencVersion()
Else
MessageBox.Show("opusenc.exe was not found. Exiting...")
Me.Close()
End If
If rav1eExists() Then
GetRav1eVersion()
Else
MessageBox.Show("rav1e.exe was not found. Exiting...")
Me.Close()
End If
If Not ffmpegExists() Then
MessageBox.Show("ffmpeg.exe was not found. Exiting...")
Me.Close()
End If
GUILoaded = True
End Sub

Private Sub GetOpusencVersion()
Dim opusProcessInfo As New ProcessStartInfo
Dim opusProcess As Process
opusProcessInfo.FileName = "opusenc.exe"
opusProcessInfo.Arguments = "-V"
opusProcessInfo.CreateNoWindow = True
opusProcessInfo.RedirectStandardOutput = True
opusProcessInfo.UseShellExecute = False
opusProcess = Process.Start(opusProcessInfo)
opusProcess.WaitForExit()
OpusVersionLabel.Text = "opusenc version: " + opusProcess.StandardOutput.ReadLine()
End Sub
Private Sub GetRav1eVersion()
Dim rav1eProcessInfo As New ProcessStartInfo
Dim rav1eProcess As Process
rav1eProcessInfo.FileName = "rav1e.exe"
rav1eProcessInfo.Arguments = "-V"
rav1eProcessInfo.CreateNoWindow = True
rav1eProcessInfo.RedirectStandardOutput = True
rav1eProcessInfo.UseShellExecute = False
rav1eProcess = Process.Start(rav1eProcessInfo)
rav1eProcess.WaitForExit()
rav1eVersionLabel.Text = "rav1e version: " + rav1eProcess.StandardOutput.ReadLine()
End Sub

Private Function rav1eExists() As Boolean
If My.Computer.FileSystem.FileExists("rav1e.exe") Then
Return True
Else
Return False
End If
End Function
Private Function ffmpegExists() As Boolean
If My.Computer.FileSystem.FileExists("ffmpeg.exe") Then
Return True
Else
Return False
End If
End Function
Private Function OpusEncExists() As Boolean
If My.Computer.FileSystem.FileExists("opusenc.exe") Then
Return True
Else
Return False
End If
End Function

Private Sub tempLocationPath_TextChanged(sender As Object, e As EventArgs) Handles tempLocationPath.TextChanged
If GUILoaded Then
My.Settings.tempFolder = tempLocationPath.Text
My.Settings.Save()
End If
End Sub

Private Sub quantizer_ValueChanged(sender As Object, e As EventArgs) Handles quantizer.ValueChanged
If GUILoaded Then
My.Settings.quantizer = quantizer.Value
My.Settings.Save()
End If
End Sub

Private Sub speed_ValueChanged(sender As Object, e As EventArgs) Handles speed.ValueChanged
If GUILoaded Then
My.Settings.speed = speed.Value
My.Settings.Save()
End If
End Sub

Private Sub audioBitrate_ValueChanged(sender As Object, e As EventArgs) Handles audioBitrate.ValueChanged
If GUILoaded Then
My.Settings.bitrate = audioBitrate.Value
My.Settings.Save()
End If
End Sub

Private Sub BrowseTempLocation_Click(sender As Object, e As EventArgs) Handles BrowseTempLocation.Click
Dim TempFolderBrowser As New FolderBrowserDialog With {
.ShowNewFolderButton = False
}
Dim OkAction As MsgBoxResult = TempFolderBrowser.ShowDialog
If OkAction = MsgBoxResult.Ok Then
tempLocationPath.Text = TempFolderBrowser.SelectedPath
End If
End Sub
End Class
38 changes: 38 additions & 0 deletions rav1e_gui/My Project/Application.Designer.vb
11 changes: 11 additions & 0 deletions rav1e_gui/My Project/Application.myapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>
35 changes: 35 additions & 0 deletions rav1e_gui/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("rav1e_gui")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("opus_gui")>
<Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyTrademark("")>

<Assembly: ComVisible(False)>

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("62e9a151-2e76-477d-9ed5-bce61fa18e50")>

' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
63 changes: 63 additions & 0 deletions rav1e_gui/My Project/Resources.Designer.vb
117 changes: 117 additions & 0 deletions rav1e_gui/My Project/Resources.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
121 changes: 121 additions & 0 deletions rav1e_gui/My Project/Settings.Designer.vb
18 changes: 18 additions & 0 deletions rav1e_gui/My Project/Settings.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="quantizer" Type="System.Int32" Scope="User">
<Value Profile="(Default)">100</Value>
</Setting>
<Setting Name="speed" Type="System.Int32" Scope="User">
<Value Profile="(Default)">3</Value>
</Setting>
<Setting Name="tempFolder" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="bitrate" Type="System.Int32" Scope="User">
<Value Profile="(Default)">64</Value>
</Setting>
</Settings>
</SettingsFile>
132 changes: 132 additions & 0 deletions rav1e_gui/rav1e_gui.vbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{51B64CB0-26F1-466F-A4EF-05F48DA441ED}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>rav1e_gui.My.MyApplication</StartupObject>
<RootNamespace>rav1e_gui</RootNamespace>
<AssemblyName>rav1e_gui</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>rav1e_gui.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>rav1e_gui.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Debug\</OutputPath>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.vb">
<DependentUpon>Form1.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

0 comments on commit a43043f

Please sign in to comment.