Somehow the program is not recording the audio, so ffmpeg cannot combine it into the FinalVideo(I've tried by manually inserting the .wav file to the folder and it works). I've tried Debug.WriteLine inside the RecordAudio and SaveAudio functions and both are showing outputs so I assume that the functions are called but I am not sure why is it not creating any audio file.
Very nice tutorial; I have a question: does the client have to have ffmpeg installed also? Or is everything in the software via references? Are the references enough? If it has to be installed, I guess one could add the files of a ffmpeg installation to the setup of the screen-recorder software or main software anyway. But it would be preferable if that would not be necessary. Thanks already for clarification.
Johan Korthout Unfortunately yes, the client would need to have FFMPEG installed. The only workaround I could think of to this is using a container, but I’m not too sure on how those work or if they’d even solve the problem, but it’s something to look into!
You can always provide installation files in your project and set up some checker if FFMPEG has already been installed - if not, run separate consoleApp project and install it automatically (after client's approval for it). EDIT: Actually, I've created solution for your problem. Put your ffmpeg.exe file in folder, where recorder.exe is placed (and always keep it there), then implement adding ffmpeg.exe to env variables with: public void SetEnvPathForFfmpeg() { string startupPath = Environment.CurrentDirectory; var name = "PATH"; var scope = EnvironmentVariableTarget.Machine; var oldValue = Environment.GetEnvironmentVariable(name, scope); if (!oldValue.Contains(startupPath)) { var newValue = oldValue + $@";{startupPath}"; Environment.SetEnvironmentVariable(name, newValue, scope); } }
Unfortunately this is just something you have to play around with till it works, and it's very imperfect. The purpose of this video was moreso just to get across some interesting C# concepts under the veil of an inadequate screen recorder lol
can we use this library in dotnet web applications, desktop app working fine but they give me this error on web dotnet mvc application "Could not load file or assembly 'Accord.Video.FFMPEG.x64.DLL' or one of its dependencies. The specified module could not be found." Thanks
Hello honey. I took a error Exception => - $exception {"Cannot open the video file. Error code: -22. Message: Invalid argument when trying to access: C:\\TestFolder//7.01.2022 22:08:09.mp4"} Can you tell me why i took this error
why is the "Rectangle" in green? Edit: can someone please explain what this implies? I assume it is some reserved function for this word in C# Edit 2: Never mind, I just found it: Initializes a new instance of the Rectangle class with the specified location and size.
very good tutorial sir! im workin on some project right now, can you make another tutorial about cam recorder? record video from other device? like webcam? thanks before sir!
I'm not sure. If the screen capture isn't picking it up, then probably not, but you can maybe look into alternative ways to take screenshots w/ C# that include the cursor
Thank you for good tutorial. Do you have any idea about why combining video & audio is not working? I removed to deleteExcept statement on Stop function and I saw that video & audio files are created and combined version is not created.
@@termspar4231 i configured same like in tutorial, but i have been discovered one thing video duration and audio duration are different. I dont know why. I tought it might be the reason.
Yeah, I know this video is 2 years old any many things could've changed in this time, but looking at this nowadays I have some suggestions: Why won't you use "System.IO.Path.GetTempPath()" to get temp path? Only for naming ands possible disc choosing purposes? Shouldn't this name be in some config file then? I also believe that you don't need to use "bitmap.Dispose()" in "using" statement - "using" is read by compiler as something like try { //code } finally { [usings_name].Dispose(); } And public methods mixed with (or under) private methods is not the most readable technique. Aaaaan be careful with slashes! Code was searching for (...)\\Folder\\file.mp4 and found (...)\\Folder//file.mp4, so it didn't count and deleted everything. But, a t the end of the day, whole idea is brilliant and very helpful, thank you!
Moonstone Studios sadly i don’t think so because I’m pretty sure C# is specifically designed for Microsoft, and I’m really sorry but I don’t know anything about macOS development and so your googling would be as good as mine!
Andly Kwan Ya that would be nice. As I stated at the beginning of this video, following this method you’re not gonna be able to make the next FRAPS or OBS. Rather the intent of this video was more just to explore the code behind some screen recorders. But if you can improve it, by all means!
Nihat Beyi to be honest I never developed this project that far so I’m not entirely sure, I was mostly just relying on restarting the app to reset things because C# does that a lot better than I could!
Maybe just make some of the timer variables public and pin to the Start button logic setting up those variables to the starting point? Creating new Stopwatch etc
@@memerboi1707 Glad it worked out. Gotta be careful with deleting and even creating files. I know someone that filled their drive with a video recording they thought was not running. Ui crashed but recording continued. After that it the OS wouldn't run due to no space to write logs etc. Had to slave the drive then delete the giant video after actually figuring out what happened
Got these errors 1. The name 'pbRec' does not exist in the current context 2. The name txtSetName does not exist in the current context Doesn't work. when I suppress errors, record button doesn't work. None of the buttons work
Dude thank you so much. It works just perfectly. Good luck with other stuff, can't wait to see your new content!
Thanks a lot. It is a great effort after all. Jesus bless you.
Hey Ben, at the end it doesn't save the mp4 video any idea why?
I had the same problem.
I've just deleted the call for the function DeleteFilesExcept in the function Stop and it worked.
TermSpar: Umm, so we need to write Videofilewriter.
Me: Wait that illegal! , you said just one word and wrote 1000 words at a single second.
Thanks....good coding
Thank you for the video! God bless! This video helped me know how to take a screenshot as well.
God bless :)
@@termspar4231 Thank you.
There is no god, only for the naive with fragile minds who fear death.
My recorder isn't working... I'm having a stack overflow exception... How do I fix this?
is there any way to record cursor movement ?
Do you know how to modify bitrate so that the captured video is more clear?
Thank you very much 🤩
how can it work?
can you tell me?
How do you add ffmpeg to the project? You skipped that.
amazing, how much time did it take you to create this, including research?
I don't remember exactly, but I developed this idea over the course of several weeks.
@@termspar4231 Thanks really! You brought it here finally to help your bros. Jesus bless you!
Hi! Thank you for tutorial. I have question. Why final video accelerated?
You need to experiment with framerate and ticker. For me worked 15fps and ticker every 1 milisecond - almost perfect.
Somehow the program is not recording the audio, so ffmpeg cannot combine it into the FinalVideo(I've tried by manually inserting the .wav file to the folder and it works). I've tried Debug.WriteLine inside the RecordAudio and SaveAudio functions and both are showing outputs so I assume that the functions are called but I am not sure why is it not creating any audio file.
Your pastebin code is different from code of this video. Who is pbRec? And who is txtSetName?
why after i press the stop button the video will be automaticly deleted?
What is "pbRec" and "txtSetName"??
Very nice tutorial; I have a question: does the client have to have ffmpeg installed also? Or is everything in the software via references? Are the references enough? If it has to be installed, I guess one could add the files of a ffmpeg installation to the setup of the screen-recorder software or main software anyway. But it would be preferable if that would not be necessary. Thanks already for clarification.
Johan Korthout
Unfortunately yes, the client would need to have FFMPEG installed. The only workaround I could think of to this is using a container, but I’m not too sure on how those work or if they’d even solve the problem, but it’s something to look into!
You can always provide installation files in your project and set up some checker if FFMPEG has already been installed - if not, run separate consoleApp project and install it automatically (after client's approval for it).
EDIT:
Actually, I've created solution for your problem. Put your ffmpeg.exe file in folder, where recorder.exe is placed (and always keep it there), then implement adding ffmpeg.exe to env variables with:
public void SetEnvPathForFfmpeg()
{
string startupPath = Environment.CurrentDirectory;
var name = "PATH";
var scope = EnvironmentVariableTarget.Machine;
var oldValue = Environment.GetEnvironmentVariable(name, scope);
if (!oldValue.Contains(startupPath))
{
var newValue = oldValue + $@";{startupPath}";
Environment.SetEnvironmentVariable(name, newValue, scope);
}
}
Does anyone know if the VideoFileWriter module is still working? since in my code it doesn't work
Good Work Ben! Thanks!
PixloxFortnite I’m glad you enjoyed
video can't save because occur exception..
So how to solve problem?
i dont know why but when i try to stop i dont record the microphone pls help and the final video dont save
Im getting both files created but theres no video file at the end when i click stop, did u end up figuring out your issue?
Moe
Did you setup FFMPEG properly?
Good video.. I learnt a lot
nice work, thank you very much. but audio and video do not progress simultaneously, I used timer elapsed 15 and framerate 10. Do you have any advice
Unfortunately this is just something you have to play around with till it works, and it's very imperfect. The purpose of this video was moreso just to get across some interesting C# concepts under the veil of an inadequate screen recorder lol
@@termspar4231 Using WPFs ticker 15fps and 1 milisecond tick is almost perfect
can we use this library in dotnet web applications, desktop app working fine but they give me this error on web dotnet mvc application "Could not load file or assembly 'Accord.Video.FFMPEG.x64.DLL' or one of its dependencies. The specified module could not be found." Thanks
r you using netcore? 'cause it does'nt work yet =(
This can work for Android ?
did you just create a blank solution
Hello honey. I took a error
Exception => - $exception {"Cannot open the video file. Error code: -22. Message: Invalid argument when trying to access: C:\\TestFolder//7.01.2022 22:08:09.mp4"} Can you tell me why i took this error
why is the "Rectangle" in green?
Edit: can someone please explain what this implies? I assume it is some reserved function for this word in C#
Edit 2: Never mind, I just found it: Initializes a new instance of the Rectangle class with the specified location and size.
I Recorded a video but sound was not working 😢😢
very good tutorial sir! im workin on some project right now, can you make another tutorial about cam recorder? record video from other device? like webcam? thanks before sir!
Rio Manik
I’ll look into it
Audio isn't working when the video is rendered.
Avēx
Hmm strange. Is the audio working before the final video is created?
Nice vid!
is there anyway, we can show mouse cursor in screen recording? thanks for this video.
I'm not sure. If the screen capture isn't picking it up, then probably not, but you can maybe look into alternative ways to take screenshots w/ C# that include the cursor
Hi, nice tutorial. Could you please create new video and use some h.264 and h.265 NuGet Packages? Thx P.
Hi I need the source code for ScreenRecTutorial project can you please send it to me .
to pause and resume?
Thank you for good tutorial. Do you have any idea about why combining video & audio is not working? I removed to deleteExcept statement on Stop function and I saw that video & audio files are created and combined version is not created.
Erdem
Is your FFMPEG properly setup?
@@termspar4231 i configured same like in tutorial, but i have been discovered one thing video duration and audio duration are different. I dont know why. I tought it might be the reason.
Erdem
Are the video and audio files being saved to the same folder?
@@termspar4231 Yes they are
Erdem
Hmm I’d have to take a closer look at your exact implementation of this. You have discord?
Screen Recorder Tutorial: Mic
Yeah, I know this video is 2 years old any many things could've changed in this time, but looking at this nowadays I have some suggestions:
Why won't you use "System.IO.Path.GetTempPath()" to get temp path? Only for naming ands possible disc choosing purposes? Shouldn't this name be in some config file then?
I also believe that you don't need to use "bitmap.Dispose()" in "using" statement - "using" is read by compiler as something like
try { //code }
finally { [usings_name].Dispose(); }
And public methods mixed with (or under) private methods is not the most readable technique.
Aaaaan be careful with slashes! Code was searching for (...)\\Folder\\file.mp4 and found (...)\\Folder//file.mp4, so it didn't count and deleted everything.
But, a t the end of the day, whole idea is brilliant and very helpful, thank you!
will this work on a macOS if not, can you point me in the right direction?
Moonstone Studios sadly i don’t think so because I’m pretty sure C# is specifically designed for Microsoft, and I’m really sorry but I don’t know anything about macOS development and so your googling would be as good as mine!
good tutorial
Love it, just want to make FPS better though
Andly Kwan
Ya that would be nice. As I stated at the beginning of this video, following this method you’re not gonna be able to make the next FRAPS or OBS. Rather the intent of this video was more just to explore the code behind some screen recorders. But if you can improve it, by all means!
How can we do it when we click on each start, the time will be reset..?
Nihat Beyi to be honest I never developed this project that far so I’m not entirely sure, I was mostly just relying on restarting the app to reset things because C# does that a lot better than I could!
Maybe just make some of the timer variables public and pin to the Start button logic setting up those variables to the starting point? Creating new Stopwatch etc
Me, just wanting to have a screen recorder with no lag:
HACKERMAN
use background worker
how do i open up c# in visual studio
ua-cam.com/video/mQu2bCZ0T1o/v-deo.html this can be help you bro
Welp, I've learned to not to tell it to do it on Desktop, all my files are now deleted.
wow
Yikes ya you definitely wanna be careful when writing functions that delete files
@@termspar4231 Okey thanks, I was able to recover them after 4 hours half a million files lmao
Memer Boi thanks be to God ☦️
@@memerboi1707
Glad it worked out.
Gotta be careful with deleting and even creating files.
I know someone that filled their drive with a video recording they thought was not running. Ui crashed but recording continued. After that it the OS wouldn't run due to no space to write logs etc.
Had to slave the drive then delete the giant video after actually figuring out what happened
Got these errors
1. The name 'pbRec' does not exist in the current context
2. The name txtSetName does not exist in the current context
Doesn't work. when I suppress errors, record button doesn't work. None of the buttons work
Smiley Jamally
I mean it’s giving your the errors right there. You probably didn’t create those objects
@@termspar4231 I have long fixed it. Worked perfectly.
Already on my next projects
15:37
Found you here: www.pexels.com/ru-ru/photo/4709286/
30:25 37:23