Video Snipping Tool

Developed or developing a new product in PureBasic? Tell the world about it.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Hi BasicallyPure,

Your help has been invaluable. Thank you.

I ended up loading Windows 7 onto an old HP Pavilion dv5000 with 4GB RAM. This allowed me to see some of the potential problems with the WriteBuffer Procedure, especially on slower systems.

Please try the new version.
1. When XML Builder opens, change the Video FPS value to zero.
- this will enter the program into Test FPS mode
2. Save the XML files, the Bullseye window will open.
3. Press CTRL + Y to start the test.
- the test will auto-end after 45 seconds
- note the various FPS values, close the message box, XML Builder will open
4. Set Video FPS to the maximum value reported from Test FPS
BasicallyPure wrote:I am confused about what the FPS setting actually does.
I had assumed that if I recorded for 1 minute in real time the resulting video would be 1 minute long and a FPS setting of 1 would result in the video image changing once every second.
Obviously there is something I am not understanding. Where does the 30 FPS come from and is it always 30? How do I make the captured video run at the same speed (length) as real time events?
There are two FPS settings, one you can change and the other is limited by a computers resources, how the program processes images, and the video codec.

The Video FPS setting you can change determines how many frames per second your video displays during playback.
The other FPS setting is the maximum number of images the program can capture per second.

If the program can only capture 10 FPS, but you set Video FPS to 30, then a 5 minute video will take 15 minutes to record.

Setting Video FPS to the maximum (+5 / -5) reported from Test FPS should create a video with smooth playback.
- the maximum FPS your system can capture might change for different sized windows
- increase / decrease the Video FPS setting until the desired result is achieved
Last edited by JHPJHP on Sat Jan 26, 2019 11:51 pm, edited 2 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Updated:
- added Enable Write Buffer option to XML Builder
- optimized the WriteBuffer Procedure
- added additional error checking to prevent buffer-overflows

NB*: From XML Builder set Enable Write Buffer for improved FPS performance (default: unchecked); read the available help before using.
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 536
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Video Snipping Tool

Post by BasicallyPure »

1/26/2019

----> (x64 snipping tool tests) <----
starting with both XML files deleted
FPS = 0
test mode results: 15 FPS for every 5 sec. interval.

captured desktop for 30 sec. real time with FPS = 15.
write buffer was disabled.
result: .avi video = 31 sec. , 4.94 MB
seems to work well.

repeat test mode with video FPS = 0
results:
tst_1 tst_2
05 sec. 04 FPS 07 FPS
10 sec. 05 FPS 07 FPS
15 sec. 07 FPS 09 FPS
20 sec. 08 FPS 10 FPS
25 sec. 09 FPS 11 FPS
30 sec. 10 FPS 11 FPS
35 sec. 10 FPS 11 FPS
40 sec. 11 FPS 12 FPS
45 sec. 11 FPS 12 FPS

captured desktop for 30 sec. real time with FPS = 15.
result: .avi video = 31 sec. , 4.61 MB
seemed to be ok.

* test mode results return to original all 15 FPS if
XML files are both deleted before running test mode.

Discovery: video codec must be 'FOURCC' and text box to the right must
contain 'XVID' in addition to video FPS = 0
It is then not necessary to delete both XML files.


----> x86 snipping tool tests<----
video codec = 'FOURCC' + 'XVID' TEXT + FPS = 0
test mode results: 15 FPS for every 5 sec. interval.

captured desktop for 30 sec. real time with FPS = 15.
write buffer was disabled.
result: .avi video = 29 sec. , 4.89 MB
seems to work well.

----------------------------------------------------

Possible minor problem with XML Builder:
click check box 'Window Title' then click 'Record Desktop'.
the 'Window Title' box remains checked. I see that 'Window Title'
does toggle off if clicked again.

edit: disregard the possible minor problem, I see how it is supposed to work now.


Both x86 and x64 desktop capture now appear to work.

I sometimes get the following error from VLC media player when playback
of the captured video starts.

Code: Select all

"Because this file index is broken or missing, seeking will not work 
correctly. VLC won't repair your file but can temporary fix this problem
by building an index in memory."
The video will play ok if I tell VLC to proceed.
I think it mostly happens when I have the FPS set too high.

I haven't tested with write buffer enabled yet. where is this help?
JHPJHP wrote:NB*: From XML Builder set Enable Write Buffer for improved FPS performance (default: unchecked); read the available help before using.
Dragging bulls eye onto window to start capture seems to work but it is very difficult to guess the correct FPS.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Updated:
- some minor changes based on recent information provided by BasicallyPure

NB*: Significant changes were made over the past few days based on information provided by BasicallyPure.

----------------------------------------

Hi BasicallyPure,

It looks like we finally reached a stable release; I could not have done it without your patience and feedback. Thank you!
BasicallyPure wrote:Discovery: video codec must be 'FOURCC' and text box to the right must
contain 'XVID' in addition to video FPS = 0
It is then not necessary to delete both XML files.
You should not have to delete the XML files, only save the updated options; a blank FOURCC code will now default to PROMPT at recording time.
BasicallyPure wrote:I sometimes get the following error from VLC media player when playback
of the captured video starts.
I have seen this too, but cannot find anymore information about it...

Select Output AVI to MP4 option from XML Builder; FFMPEG should fix the error in the outputted MP4
(NOTE: The AVI will still default auto-play, but in the same folder you will find the fixed MP4)

If the AVI to MP4 option from XML Builder was not checked before creating the AVI, the user can still drag & drop the AVI onto the Bullseye window to complete the process.
BasicallyPure wrote:I haven't tested with write buffer enabled yet. where is this help?
The question mark in the title bar to the left of the [ X ] Close Window.
- click the help icon then click anyone of the XML Builder options (excluding TextGadget)
- move the mouse pointer away from the option field to close the tooltip (auto-close after 30 seconds)
(NOTE: Make sure you have the latest release before using Enable Write Buffer.)
BasicallyPure wrote:Dragging bulls eye onto window to start capture seems to work but it is very difficult to guess the correct FPS.
Test FPS mode works with every other XML Builder option...

Whether dragging the Bullseye, drawing your own rectangle, opening the selected window or Desktop capture, test FPS mode will report an FPS starting point suitable to the environment.
(NOTE: An FPS value that works for Desktop capture should work in most other configurations.)
Last edited by JHPJHP on Mon Jan 28, 2019 12:39 am, edited 1 time in total.
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 536
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Video Snipping Tool

Post by BasicallyPure »

I have downloaded and installed your latest version.
I'm seeing a problem with XML builder help.
I click on the ? then move the mouse over any XML builder control and click.
Help text appears for a fraction of a second then the OS reports that XML builder has stopped working.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Hi BasicallyPure,

Thank you for reporting the problem, it just shows how much can be missed when working in a bubble.

It was easy enough to solve the crash, but I had to patch together a solution to keep the tooltip visible while the mouse pointer was within the field.
It worked as expected in Windows 10, but earlier versions of Windows required a work-around.

Updated:
- problem with Help / Tooltips (XML Builder) reported by BasicallyPure has been fixed
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 536
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Video Snipping Tool

Post by BasicallyPure »

Hi,
I found this problem today.
XML builder problem:
setting start shortcut key to CTRL+A actually results in CTRL+F
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Hi BasicallyPure,

Thank you again for finding another one.

Updated:
- fixed a problem reported by BasicallyPure with the user-defined CTRL Key in XML Builder

NOTE:
I have been playing around with adding sound using mciSendString, and since FFMPEG was already included the process became a little easier.

For a simple mciSendString demo see Windows Services & Other Stuff\
- Other_Stuff\OtherStuff\RecordMic.pb

Image
Last edited by JHPJHP on Thu Feb 13, 2020 3:46 pm, edited 1 time in total.
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 536
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Video Snipping Tool

Post by BasicallyPure »

Hi,

No bug reports today. :P

All I have to offer are comments, questions, and feature requests.

Delete XML help says: "...or reset settings if nothing is selected."
How do you select nothing?

Text for 'Window Title' and 'Video Name':
possibly use a static variable to retain text when check box is uncheched
so it will reappear if the box is checked again for the current session.

The offset values in the spin gadgets could be retained when checking or
unchecking the 'Window Title' and 'Record Desktop' check boxes.

It is not obvious how to toggle off Marquee once it is toggled on.
I figured out how to do it but just by chance.

FOURCC option for video codec starts by default as XVID.
if options PROMPT or DEFAULT are chosen then going back to FOURCC
places a null$ in the text field. Would it be better to display XVID
or whatever the previous text was rather than null$?

Is 'FOURCC' an acronym for 'four character codec'?

Keep up the good work, it's coming along nicely.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Video Snipping Tool

Post by JHPJHP »

Hi BasicallyPure,

Thank you for your comments and helpful feature requests; I have implemented them all.
BasicallyPure wrote:Delete XML help says: "...or reset settings if nothing is selected."
Changed to: Delete the selected XML file or reset settings if no XML file has been created.
BasicallyPure wrote:Text for 'Window Title' and 'Video Name':
possibly use a static variable to retain text when check box is uncheched
so it will reappear if the box is checked again for the current session.

The offset values in the spin gadgets could be retained when checking or
unchecking the 'Window Title' and 'Record Desktop' check boxes.

FOURCC option for video codec starts by default as XVID.
if options PROMPT or DEFAULT are chosen then going back to FOURCC
places a null$ in the text field. Would it be better to display XVID
or whatever the previous text was rather than null$?
Done, done, and done.
BasicallyPure wrote:It is not obvious how to toggle off Marquee once it is toggled on.
This new version should be more user friendly.
BasicallyPure wrote:Is 'FOURCC' an acronym for 'four character codec'?
Click the HyperLinkGadget Video Codec in XML Builder, it will open three webpages. The second webpage describes this code better then I could.

Updated:
- finished the Audio Settings window
- improved XML Builder with suggestions from BasicallyPure

Audio Settings
For clear audio use a headset or external mic. I found using the onboard mic produced poor sound quality.
In addition, make sure the onboard mic is disabled.

Syncing audio / video is not automatic; FPS should be set as close to real-time as possible.

In the next release users will have the ability to add or replace the audio stream after the video has been created.
From XML Builder users can play a previously recorded AVI while creating an audio stream.
This will remove the need to set FPS to real-time in order to have the audio / video sync'd.

Image
Last edited by JHPJHP on Sat Feb 02, 2019 1:03 am, edited 7 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Updated:
- finished the Record Audio window
- fixed multiple crash points
- fixed some DPI issues

Record Audio
Add an audio stream to an existing AVI outputted to an MP4.

Image
Last edited by JHPJHP on Thu Feb 28, 2019 12:03 am, edited 3 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Updated:
- added user-defined Output format (XML Builder, Record Audio)
- some XML Builder improvements
- squashed a couple bugs

User-Defined Output
Users can set the output format; MP4, MOV, WMV, GIF, etc.

Originally I was on the fence deciding whether or not to add this feature, until I found out that FFmpeg supported creating Animated GIFs.

Image
User avatar
Lord
Addict
Addict
Posts: 847
Joined: Tue May 26, 2009 2:11 pm

Re: Video Snipping Tool

Post by Lord »

Hi JHPJHP!

Nice tool.

Maybe it's just me, but if I want to catch a window on a second
monitor, where monitor 2 is located left of monitor 1, there is only
that part catched, which is hanging over to monitor 1.
The window x-coordinates on monitor 2 are negativ.
Image
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Video Snipping Tool

Post by JHPJHP »

Hi Lord,

Thank you for your comments.
Lord wrote:Maybe it's just me, but if I want to catch a window on a second
monitor, where monitor 2 is located left of monitor 1, there is only
that part catched, which is hanging over to monitor 1.
The window x-coordinates on monitor 2 are negativ.
It's not just you. I wrote the tool on a laptop; supporting a single monitor was a design choice based on my testing environment.

When I get a second monitor setup I'll revisit the algorithm used to filter negative window dimensions.
User avatar
Lord
Addict
Addict
Posts: 847
Joined: Tue May 26, 2009 2:11 pm

Re: Video Snipping Tool

Post by Lord »

JHPJHP wrote:...
When I get a second monitor setup I'll revisit the algorithm used to filter negative window dimensions.
Thanks for your answer.
Image
Locked