![]() |
|
|
Thread Tools | Display Modes |
![]() |
#1 |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() I have a customer who is moving (metal working shop, making curtain rods for interior designers) and in the past, due to the occasional complaint about missing pieces in shipping, they started filming the packaging, where they then take the SD card out, put it in a computer in the office, and copy the file to a USB 3.0 HDD. I replaced the PC's reader with a external USB 3.0 reader and it really flies, hardly takes any time compared to how it used to be. It's done with an HD handheld camera but requires two employees, and that's taking someone away from doing work. Also, these SD cards, even though they're full sized, they're used so often they wear out in only a few weeks.
In his new place, he wants to automate the system. I've been going through my head so far and this is what I have: Mount an NUC with a 1080p or 4k webcam above the table where they box everything. Put up a small tv in front with the nuc hooked to it. Next is where i'm still working out. What I have is, make a simple program in c#.net or vb.net where the order number is typed in and used in making the command line for the proper folders and parameters for VLC to capture the video to a NAS on the network. I've already been playing around with FFMPEG dshow, but it doesn't have a native output screen (though it can pipe ffplay, it doesn't have as good as an interface). Since it's a mapped drive, it has to temp write the file locally and copy the file over the network. If it's not copied completely before another order starts, this might cause problems. It did when I was testing the capture concept on a laptop. Mind you it was a shitty little 10.1" atom laptop and the results were mixed. Anyone have any alternatives? I've been reading through documentation about dplay capture libraries with c#.net but it's been confusing. I've done tons of searching and researching of capture programs, but theyre all complex, or too simple (and lack the command line properties I need). anyone have any other ideas or better yet something I haven't even come near considering? Keep in mind HAS to have the order number as a file/folder
__________________
Cap Datasheet Depot: http://www.paullinebarger.net/DS/ ^If you have datasheets not listed PM me |
![]() |
![]() |
![]() |
#2 |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() Never dealt with C#, only with C and C++ and not doing this.
Why webcam, if you can do this with IP camera and just record on network share?
__________________
Useful conversions. I don't "speak" imperial. Please use metric, if you want to address me. 1km=1000m=100000cm, 1inch=2.54cm, 1mile=1609.344meters, 1ft=30.48cm 1gal(US)=3.785liters, 1lb=453grams, 1oz=28.34grams |
![]() |
![]() |
![]() |
#3 | |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() Quote:
It needs to have a marker some way indicating the order number, and look can be looked up easily by that number on the nas |
|
![]() |
![]() |
![]() |
#4 |
Great Sage 齊天大聖
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 23,738
|
![]() there is loads of webcam software,
i dont use any, but "cheese" is supposed to be good |
![]() |
![]() |
![]() |
#5 | |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() Quote:
BUT You can write down a simple batch, using the FFMPEG parameters. Code:
ffmpeg -f dshow -i video="Integrated Camera":audio="Microphone name here" out.mp4 At the end, if you don't want preset time, just terminate it. You can even specify a PATH via the parameters. So, your task seem trivial if you are satisfied with this. I believe that it wont be hard for you to piece together such a batch file. I still don't like the idea of Webcam, but if you use IP CCTV camera, I don't see how you can do it with reasonable amount of effort. And specify normal codec. Not something like MPEG2 or MPEG4, unless you want huge files. The best thing is that there are some tools, which can help you but the bat file in .exe container. And here is how to gracefully terminate FFMPEG in Windows https://stackoverflow.com/questions/...ffmpeg-windows Last edited by televizora; 11-27-2020 at 11:29 AM.. |
|
![]() |
![]() |
![]() |
#6 |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() If you do something like this...
controlbat.bat Code:
set var1=7 start /min cmd /k bat2 pause taskkill /fi "WindowTitle eq Killer" pause bat2.bat Code:
echo variable is %var1% The first window after pressing any key will kill the mpeg window Then it will terminate itself as well Because taskkill is not gracefully sending signal to the second window, this can corrupt the file, if it's in the fancy formats, not plain .avi I will experiment with extracting pid, setting it as variable and then using sendsignal or other tool. The simplicity is that when the first bat calls the second, it passes the vabiable, minimizes the window and then returns the control to the first, from which you can terminate the second window and then the first. If you try this, you will see that echo-ing the var1 from the bat2 window called killer works. Also, you will potentially have to deal with unhappy Antivirus programs. I have a file, that pings and logs to file and Avast always tries to block it. Add user input with setp=ordernumer digits only is the best way to go and you are ready. I don't have webcam to test it with ffmpeg. Last edited by televizora; 11-27-2020 at 01:31 PM.. |
![]() |
![]() |
![]() |
#7 |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() yeah as I said I tried ffmpeg, but I want to show the capture live. So far the only thing i've had SOME success with is VLC, that lets you specify things like bitrate in the output. I was just wondering if anyone knew a better way than both
Yeah ffmpeg does tend to corrupt if it's killed as a process. The only real option to to send control+c to the window Damn, you should probably change "student tech" to "professional tech". You have more skills than most of us (except like surface level soldering stuff). Do you know .net? I'll might be able to get him to pay. I hear dshow has a library for .net ![]() |
![]() |
![]() |
![]() |
#8 | |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() Quote:
No, I don't deal with GUI programming. Well, I can read and modify something, if I need to do so. What I write are scripts, usually to automate tedious tasks. There are some external programs like I said early. Which can send ctrl+c. Also, using SDL there is a way to record and preview simultaneously. Interesting question you have... You will make me install Visual studio, you know... Maybe will think of something... Last edited by televizora; 11-28-2020 at 06:21 AM.. |
|
![]() |
![]() |
![]() |
#9 |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() Gui is pretty easy. It's basically drag and drop in vs, but can be manipulated or created programmatically
|
![]() |
![]() |
![]() |
#10 | |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() Quote:
You may make me learn some C# Last edited by televizora; 11-28-2020 at 04:53 PM.. |
|
![]() |
![]() |
![]() |
#11 |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() The number isn't a big deal. I know some c#.net but nothing incredibly advanced. I can check the field for a number if you give me the source.
What libraries are you using? Maybe you can add this to your already highly developed technical repertoire ![]() |
![]() |
![]() |
![]() |
#12 | |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() Quote:
I think that it can be ideal for you. The things that bother me are to parse config and etc. I have not dealt with c# for years, honestly. Trying hard to remember. Perhaps you are better at C# than me. This is the example - https://github.com/mesta1/Recording-video-with-c- OOP really annoys me. In the example you have preview, camera selection, snapshot. I think that it's perfect for you. Have to use method to return the contents of the box to variable and then pass it to the content writer as file name in the box. Nice. Last edited by televizora; 11-29-2020 at 09:35 AM.. |
|
![]() |
![]() |
![]() |
#13 |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() Well, here is your app with one field for the order number.
Then inserts it as a file name when you click on start recording->browse. Also, app.config sets default path for the dialogue. https://www96.zippyshare.com/v/cljmIEcW/file.html I still hate C#, you know... My changes app.config Code:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> </startup> <appSettings> <add key="PATH" value="C:\BAD"/> </appSettings> </configuration> Code:
<TextBox x:Name="p1" Grid.Column="4" HorizontalAlignment="Left" Height="22" Margin="259,6,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="244" RenderTransformOrigin="0.497,1.333" Grid.Row="2" Text="{Binding order}"/> <Label Content="Order" Grid.Column="4" HorizontalAlignment="Left" Margin="211,5,0,0" Grid.Row="2" VerticalAlignment="Top" RenderTransformOrigin="0.667,-0.033" Width="43"/> Code:
using System.Configuration; Code:
public string order { get { return _order; } set { Set(ref _order, value); } } string path= ConfigurationManager.AppSettings["PATH"]; Code:
private void StartRecording() { var dialog = new SaveFileDialog(); dialog.FileName = order; dialog.InitialDirectory = path; dialog.DefaultExt = ".avi"; dialog.AddExtension = true; Test it with webcam. Mine, on my laptop is not working. Have no available cam around. Last edited by televizora; 11-29-2020 at 11:14 AM.. |
![]() |
![]() |
![]() |
#14 |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() AForge, fascinating. Never ran over that in my search
I've tried to download it, but zippyshare always brings up ads :/ Like, if I click on anything You would be bored by C#, but it also open up opportunity with someone that has skills like yours. If you were able to make this, I can promise you, that in a day, you are more skilled than me in three weeks of research and testing |
![]() |
![]() |
![]() |
#15 |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() and if this works like I need it too, I will pay you
|
![]() |
![]() |
![]() |
#16 | |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() Quote:
Next time will use GoogleDrive. And in case of NUC, get something decent that has the capacity to encode video without lagging. AForge can be installed witn NuGet. Contains FFMPEG. We need something to encode the video. If everything is OK and camera is detected, it will bring you preview and ability to record. Path is inside app.config xml file. The app looks inside the file and looks for the value of the Order field. Uses Order=filename, location = path from the xml as default path. I don't like the idea do make it record directly without file dialog, because if the drive is unavailable(net drive) or full, you will need to deal with this kinds of exceptions. And if the exception is not correctly handled, the app may stop working/fail with unknown reason. You need to install reference to ConfigurationManager, to be able to parse XML config file. Parsing pure INI can be PIA, but having XML I don't think you will need it. So instead of manually browsing path and filename, just write order name in the box, when you click StartRec, it will open the File browse dialog with the default path from the XML and as file name the name from the box.| So, just change the default path to the network drive you will map. It would be good if you create an user account on the "server" with password, enable password protected sharing and map the drive with credentials. To be sure that if somebody else is connected to the network, for example Wi-Fi he won't be able to accidentally access or delete stuff. Sharing without password protection or permissions is evil, waiting to bite your ass. Last edited by televizora; 11-30-2020 at 03:02 AM.. |
|
![]() |
![]() |
![]() |
#17 |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() You also have compiled app in the debug folder. You can run the exe right away.
No need to compile it at all. Also. If the PATH in the config does not exist(net problem, disconnected network drive, shared directory not available) the app will crash. To fix this we need to put this code. Replace with error message of your choice. It will tell you that there is error in the config, but will allow you to continue with default path C:\ To check if order is empty and notify, but continue with default name "order" add the second These lines are to avoid unwanted exceptions. Code:
if (!Directory.Exists(path)) { MessageBox.Show("Path does not exist, check CONFIG"); dialog.InitialDirectory = @"C:\"; } if(string.IsNullOrEmpty(order)) { MessageBox.Show("Order name not entered! Continuing with default name"); dialog.FileName = "order"; } Code:
private void StopRecording() { if (_recording == false) { MessageBox.Show("Recording is not started"); return; } _recording = false; _writer.Close(); _writer.Dispose(); } If you don't feel like installing VisualStudio, I can compile the modified version. Last edited by televizora; 11-30-2020 at 06:42 AM.. |
![]() |
![]() |
![]() |
#18 |
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() If you cant download from zippyshare, here is the link. I forgot this. To google drive
https://drive.google.com/file/d/1CG4...ew?usp=sharing |
![]() |
![]() |
![]() |
#19 |
Muffins
Join Date: Aug 2007
City & State: tehas
My Country: US
Line Voltage: 120VAC 60Hz
I'm a: Professional Tech
Posts: 3,841
|
![]() Is it .h264? if it's a single setting I make in a config file or in a code line just tell me where
I'll play around with it a bit, thank you for this! |
![]() |
![]() |
![]() |
#20 | ||
ghettomodmaster
Join Date: Nov 2016
City & State: Bulgaria
My Country: Bulgaria
Line Voltage: 230VAC 50Hz
I'm a: Student Tech
Posts: 757
|
![]() MPEG4 MP4. No codec config at the moment. If you make me modify to select codec, you should buy at least a beer. Haha.
Here is your codec. Now officially you owe me at least a beer. Quote:
Also, you can change the default file extension. It will use codec appropriately to the extension. Quote:
Last edited by televizora; 11-30-2020 at 09:30 AM.. |
||
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|