Skip to content

Commit

Permalink
Added FFmpeg resources
Browse files Browse the repository at this point in the history
  • Loading branch information
lextrack committed Mar 7, 2023
1 parent 76841c2 commit 7646c47
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 23 deletions.
Binary file added FFmpegResources/avcodec-59.dll
Binary file not shown.
Binary file added FFmpegResources/avdevice-59.dll
Binary file not shown.
Binary file added FFmpegResources/avfilter-8.dll
Binary file not shown.
Binary file added FFmpegResources/avformat-59.dll
Binary file not shown.
Binary file added FFmpegResources/avutil-57.dll
Binary file not shown.
Binary file added FFmpegResources/ffmpeg.exe
Binary file not shown.
Binary file added FFmpegResources/ffplay.exe
Binary file not shown.
Binary file added FFmpegResources/ffprobe.exe
Binary file not shown.
Binary file added FFmpegResources/postproc-56.dll
Binary file not shown.
Binary file added FFmpegResources/swresample-4.dll
Binary file not shown.
Binary file added FFmpegResources/swscale-6.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@
<data name="back" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\back.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Background" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Background.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ Select the Audio Recording option in the main window and you can record audio fr

<h2 align="center">Install</h2>
<p align="center">
Windows 7, 8.1, 10, 11 (64 bits) | v1.2.3 | <a href="https://github.com/lextrack/Simple-Screen-Recorder/releases/download/1.2.3/Simple-Screen-Recorder-Release-Portable.7z">Download directly from GitHub</a><br><br>
Uses <a href="https://dotnet.microsoft.com/en-us/download/dotnet/7.0">.Net 7.0</a> and <a href="https://www.gyan.dev/ffmpeg/builds/s">FFmpeg (ffmpeg-5.1.2-full_build-shared)</a> <br><br>
Windows 7, 8.1, 10, 11 (64 bits) | v1.2.4 | <a href="https://github.com/lextrack/Simple-Screen-Recorder/releases/download/1.2.4/Simple-Screen-Recorder-Release-Portable.7z">Download directly from GitHub</a><br><br>
Uses <a href="https://dotnet.microsoft.com/en-us/download/dotnet/7.0">.Net 7.0</a> and <a href="https://www.gyan.dev/ffmpeg/builds/">FFmpeg (ffmpeg-5.1.2-full_build-shared)</a> <br><br>
<a href="https://postimg.cc/"><img src="https://i.postimg.cc/qvvZm4PT/screenrecorder1-2-3.png"></a>
</p>

Expand Down
Binary file added Resources/Background.wav
Binary file not shown.
51 changes: 48 additions & 3 deletions Simple-Screen-Recorder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<StartupObject>Simple_Screen_Recorder.Program</StartupObject>
<UseWPF>True</UseWPF>
<Version>1.2.3</Version>
<Version>1.2.4</Version>
<Authors>Lextrack</Authors>
<Copyright>Lextrack</Copyright>
<AssemblyVersion>1.2.3</AssemblyVersion>
<FileVersion>1.2.3</FileVersion>
<AssemblyVersion>1.2.4</AssemblyVersion>
<FileVersion>1.2.4</FileVersion>
<PackageIcon>screen recorder.png</PackageIcon>
<ApplicationIcon>Resources\screen recorder.ico</ApplicationIcon>
<PlatformTarget>x64</PlatformTarget>
Expand All @@ -22,6 +22,10 @@
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<None Remove="Resources\Background.wav" />
</ItemGroup>

<ItemGroup>
<Content Include="Resources\screen recorder.ico" />
</ItemGroup>
Expand Down Expand Up @@ -124,6 +128,39 @@
</ItemGroup>

<ItemGroup>
<None Update="FFmpegResources\avcodec-59.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\avdevice-59.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\avfilter-8.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\avformat-59.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\avutil-57.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\ffmpeg.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\ffplay.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\ffprobe.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\postproc-56.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\swresample-4.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FFmpegResources\swscale-6.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Properties\Settings.settings">
<Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -134,4 +171,12 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="FFmpegResources\" />
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\Background.wav" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion UI/AboutForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions UI/AudioRecorderMainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void btnStartRecording_Click(object sender, EventArgs e)
RecMic();
}

ProcessStartInfo ProcessId = new("cmd.exe", "/c ffmpeg -f gdigrab AudioRecordings/" + AudioName + "");
ProcessStartInfo ProcessId = new("cmd.exe", $"/c {RecorderScreenMainWindow.ResourcePath} -f gdigrab AudioRecordings/" + AudioName + "");
ProcessId.WindowStyle = ProcessWindowStyle.Hidden;
ProcessId.CreateNoWindow = true;
ProcessId.RedirectStandardOutput = true;
Expand Down Expand Up @@ -147,8 +147,7 @@ private static void RecSpeaker()
AudioRecorderDesktop.Cleanup();
AudioRecorderDesktop.CreateWaveInDevice();

var soundPlayer = new System.Media.SoundPlayer("Background.wav");

var soundPlayer = new System.Media.SoundPlayer(Properties.Resources.Background);
soundPlayer.PlayLooping();

AudioRecorderDesktop.outputFilename = "SystemAudio." + Strings.Format(DateTime.Now, "MM-dd-yyyy.HH.mm.ss") + ".wav";
Expand Down
2 changes: 1 addition & 1 deletion UI/MergeAllMediaForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private void BtnMergeAll_Click(object sender, EventArgs e)
{
Process conversionProcess = new Process();
conversionProcess.StartInfo.FileName = "cmd.exe";
conversionProcess.StartInfo.Arguments = "/k ffmpeg -i " + txtVideoPath.Text + " -i " + txtAudioDesk.Text + " -i " + txtAudioMic.Text + " -filter_complex amerge -shortest -c:v copy -c:a aac -b:a 320k OutputFiles/" + outputFileName + " & exit /b";
conversionProcess.StartInfo.Arguments = $"/c {RecorderScreenMainWindow.ResourcePath} -i " + txtVideoPath.Text + " -i " + txtAudioDesk.Text + " -i " + txtAudioMic.Text + " -filter_complex amerge -shortest -c:v copy -c:a aac -b:a 320k OutputFiles/" + outputFileName + " & exit /b";
conversionProcess.Start();

conversionProcess.EnableRaisingEvents = true;
Expand Down
2 changes: 1 addition & 1 deletion UI/MergeVideoAudioForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void BtnMergeAll_Click(object sender, EventArgs e)
{
Process conversionProcess = new Process();
conversionProcess.StartInfo.FileName = "cmd.exe";
conversionProcess.StartInfo.Arguments = "/k ffmpeg -i " + txtVideoPath.Text + " -i " + txtAudioDesk.Text + " -shortest -c:v copy -c:a aac -b:a 320k OutputFiles/" + outputFileName + " & exit /b";
conversionProcess.StartInfo.Arguments = $"/c {RecorderScreenMainWindow.ResourcePath} -i " + txtVideoPath.Text + " -i " + txtAudioDesk.Text + " -shortest -c:v copy -c:a aac -b:a 320k OutputFiles/" + outputFileName + " & exit /b";
conversionProcess.Start();

conversionProcess.EnableRaisingEvents = true;
Expand Down
4 changes: 2 additions & 2 deletions UI/RecorderScreenMainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions UI/RecorderScreenMainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public partial class RecorderScreenMainWindow
private DateTime TimeRec = DateTime.MinValue;
private string VideoName = "";
public int ProcessId { get; private set; }
public static string ResourcePath = Path.Combine(Directory.GetCurrentDirectory(), @"FFmpegResources\ffmpeg");

public RecorderScreenMainWindow()
{
Expand All @@ -29,8 +30,6 @@ private void Form1_Load(object sender, EventArgs e)

GetTextsMain();

CheckMonitors();

ScreenAudioMic.OpenComp();
ComboBoxMicrophone.DataSource = ScreenAudioMic.cboDIspositivos.DataSource;
ScreenAudioDesktop.OpenComp();
Expand All @@ -44,6 +43,8 @@ private void Form1_Load(object sender, EventArgs e)

ComboBoxFormat.Items.AddRange(new[] { ".avi", ".mkv" });
ComboBoxFormat.SelectedIndex = 0;

CheckMonitors();
}

private void btnStartRecording_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -97,7 +98,7 @@ private void VideoCodecs()
case "MPEG-4":
{
int fps = int.Parse((string)comboBoxFps.SelectedItem);
ProcessStartInfo ProcessId = new("cmd.exe", "/c ffmpeg -f gdigrab -framerate " + fps + " -show_region 1 -i desktop -c:v mpeg4 -b:v 10000k Recordings/" + VideoName + "");
ProcessStartInfo ProcessId = new("cmd.exe", $"/c {ResourcePath} -f gdigrab -framerate " + fps + " -show_region 1 -i desktop -c:v mpeg4 -b:v 10000k Recordings/" + VideoName + "");
ProcessId.WindowStyle = ProcessWindowStyle.Hidden;
ProcessId.CreateNoWindow = true;
ProcessId.RedirectStandardOutput = true;
Expand All @@ -110,7 +111,7 @@ private void VideoCodecs()
case "H264 NVENC (Nvidia Graphics Cards)":
{
int fps = int.Parse((string)comboBoxFps.SelectedItem);
ProcessStartInfo ProcessId = new("cmd.exe", "/c ffmpeg -f gdigrab -framerate " + fps + " -show_region 1 -i desktop -c:v h264_nvenc -qp 0 Recordings/" + VideoName + "");
ProcessStartInfo ProcessId = new("cmd.exe", $"/c {ResourcePath} -f gdigrab -framerate " + fps + " -show_region 1 -i desktop -c:v h264_nvenc -qp 0 Recordings/" + VideoName + "");
ProcessId.WindowStyle = ProcessWindowStyle.Hidden;
ProcessId.CreateNoWindow = true;
ProcessId.RedirectStandardOutput = true;
Expand All @@ -123,7 +124,7 @@ private void VideoCodecs()
case "H264 AMF (AMD Graphics Cards)":
{
int fps = int.Parse((string)comboBoxFps.SelectedItem);
ProcessStartInfo ProcessId = new("cmd.exe", "/c ffmpeg -f gdigrab -framerate " + fps + " -show_region 1 -i desktop -c:v h264_amf -qp 0 Recordings/" + VideoName + "");
ProcessStartInfo ProcessId = new("cmd.exe", $"/c {ResourcePath} -f gdigrab -framerate " + fps + " -show_region 1 -i desktop -c:v h264_amf -qp 0 Recordings/" + VideoName + "");
ProcessId.WindowStyle = ProcessWindowStyle.Hidden;
ProcessId.CreateNoWindow = true;
ProcessId.RedirectStandardOutput = true;
Expand All @@ -144,7 +145,7 @@ private void VideoCodecs()
Screen selectedScreen = Screen.AllScreens[comboBoxMonitors.SelectedIndex];
Rectangle bounds = selectedScreen.Bounds;
string getScreen = string.Format("-f gdigrab -framerate {0} -offset_x {1} -offset_y {2} -video_size {3}x{4} -show_region 1 -i desktop -c:v mpeg4 -b:v 10000k Recordings/{5}", comboBoxFps.SelectedItem, bounds.Left, bounds.Top, bounds.Width, bounds.Height, VideoName);
ProcessStartInfo ProcessId = new("cmd.exe", "/c ffmpeg " + getScreen);
ProcessStartInfo ProcessId = new("cmd.exe", $"/c {ResourcePath} " + getScreen);
ProcessId.WindowStyle = ProcessWindowStyle.Hidden;
ProcessId.CreateNoWindow = true;
ProcessId.RedirectStandardOutput = true;
Expand All @@ -159,7 +160,7 @@ private void VideoCodecs()
Screen selectedScreen = Screen.AllScreens[comboBoxMonitors.SelectedIndex];
Rectangle bounds = selectedScreen.Bounds;
string getScreen = string.Format("-f gdigrab -framerate {0} -offset_x {1} -offset_y {2} -video_size {3}x{4} -show_region 1 -i desktop -c:v h264_nvenc -qp 0 Recordings/{5}", comboBoxFps.SelectedItem, bounds.Left, bounds.Top, bounds.Width, bounds.Height, VideoName);
ProcessStartInfo ProcessId = new("cmd.exe", "/c ffmpeg " + getScreen);
ProcessStartInfo ProcessId = new("cmd.exe", $"/c {ResourcePath} " + getScreen);
ProcessId.WindowStyle = ProcessWindowStyle.Hidden;
ProcessId.CreateNoWindow = true;
ProcessId.RedirectStandardOutput = true;
Expand All @@ -174,7 +175,7 @@ private void VideoCodecs()
Screen selectedScreen = Screen.AllScreens[comboBoxMonitors.SelectedIndex];
Rectangle bounds = selectedScreen.Bounds;
string getScreen = string.Format("-f gdigrab -framerate {0} -offset_x {1} -offset_y {2} -video_size {3}x{4} -show_region 1 -i desktop -c:v h264_amf -qp 0 Recordings/{5}", comboBoxFps.SelectedItem, bounds.Left, bounds.Top, bounds.Width, bounds.Height, VideoName);
ProcessStartInfo ProcessId = new("cmd.exe", "/c ffmpeg " + getScreen);
ProcessStartInfo ProcessId = new("cmd.exe", $"/c {ResourcePath} " + getScreen);
ProcessId.WindowStyle = ProcessWindowStyle.Hidden;
ProcessId.CreateNoWindow = true;
ProcessId.RedirectStandardOutput = true;
Expand Down Expand Up @@ -271,7 +272,7 @@ private static void RecSpeaker()
ScreenAudioDesktop.Cleanup();
ScreenAudioDesktop.CreateWaveInDevice();

var soundPlayer = new System.Media.SoundPlayer("Background.wav");
var soundPlayer = new System.Media.SoundPlayer(Properties.Resources.Background);
soundPlayer.PlayLooping();

ScreenAudioDesktop.outputFilename = "SystemAudio." + Strings.Format(DateTime.Now, "MM-dd-yyyy.HH.mm.ss") + ".wav";
Expand Down
2 changes: 1 addition & 1 deletion UI/RecorderScreenMainWindow.resx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<value>106, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>47</value>
<value>51</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down

0 comments on commit 7646c47

Please sign in to comment.