Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Raspicam Command Line Generator

Tue May 21, 2013 2:49 pm

I recently got myself a Raspicam and I love it. But changing one option in the command line is a lengthy process, so I made a generator to make my (and perhaps your) life a bit easier.

http://www.handsdown.be/raspicam/

Using it is really simple: You select the options you want and press the generate button on the bottom.

Feel free to use it. If you find a bug or know a nice feature, just reply here and I'll see what I can do. And don't forget to reply if you find it usefull. ;)

@Foundation: Were is the best source to check for updates on commands/options? Github?

soare
Posts: 3
Joined: Fri Aug 10, 2012 11:36 am
Location: Bucharest / Romania

Re: Raspicam Command Line Generator

Wed May 22, 2013 7:12 am

Hi, the command generator worked fine for me !

I have just one suggestion : for the raspivid command the time option ( -t ) is actually the length of the video capture. And from my limited experience, for raspistill is the time it takes to get a picture in simple mode and wait or the complete amount of time in timelapse mode to get pictures with -tl interval ( in miliseconds ) between them.

A little confusing..

Thanks again for the easy command generator :).

bugloss
Posts: 22
Joined: Fri Jan 04, 2013 2:44 pm
Contact: Website

Re: Raspicam Command Line Generator

Wed May 22, 2013 4:12 pm

This is fantastic, thanks very much. It'll save loads of work.
Adam
http://www.adamwilson.co

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Wed May 22, 2013 5:01 pm

Thanks for the replies guys.

@Soare: I split the -t command between the raspivid and raspistill specific settings. I tried to stick as close to the official document, but you are 100% correct, it's confusing. :)

User avatar
jezmck
Posts: 24
Joined: Sat Sep 10, 2011 4:34 pm
Contact: Website

Re: Raspicam Command Line Generator

Wed May 22, 2013 6:03 pm

Very nice.

I guess -vs Turn on video stabilisation is also a raspivid specific setting though.

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Wed May 22, 2013 6:20 pm

Done. 8-)

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Raspicam Command Line Generator

Thu May 23, 2013 7:09 pm

I've made a few tweaks, which hopefully Nu7s will incorporate into his original version (I've tried to keep my changes as 'small' as possible for ease of diff-ing, which is why I haven't changed the wording on the page).
http://www.andrewscheller.co.uk/camtweaks/raspicam2.htm
  • Length was misspelled as Lengt
  • The width and height have different maximum values for images and video, so I split them out into duplicate options (as you've already done for the '-t' parameter)
  • Added the cycle-time parameter for the demo option
  • I 'streamlined' your javascript code ;) which should make it easier to add other options as and when the raspistill and raspivid programs grow new options
  • I modified it so that when settings are disabled, it displays the default values used for those options (there were a couple of default options that weren't mentioned in the .odt file, so I checked the source code on github - see RaspiStill.c line 181, RaspiVid.c line 153 and RaspiCamControl.c line 704)
Andrew

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Thu May 23, 2013 7:42 pm

Please remove that page from your web server. I do not appreciate it that you copied my code, are hotlinking to images on my webhosting, are using my company logo and name and decided it was ok to "streamline" my code to suit your style of programming without asking beforehand. There is a © on the bottom of the page for a reason. If you suggested the improvements in this thread I would have been happy to incorporate them, but this is just rude and arrogant.

Also, weren't you the one that commented:
Are people really that scared of the keyboard that they have to use a web-app to type command lines for them?
on http://www.recantha.co.uk/blog/?p=4212#comments

Why would you steal my work then?

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Raspicam Command Line Generator

Thu May 23, 2013 7:55 pm

Nu7s wrote:Please remove that page from your web server.
Done.
Nu7s wrote:I do not appreciate it that you copied my code, are hotlinking to images on my webhosting, are using my company logo and name
Sorry if I caused any offence, that wasn't my intention! :(
Nu7s wrote:If you suggested the improvements in this thread I would have been happy to incorporate them, but this is just rude and arrogant.
I decided to have a play with your javascript, and see what I could come up with. In the spirit of OpenSource I posted my modifications back online, and as mentioned I tried to minimise the number of "visible" changes so that it would be easy for you to diff my version against your version, to see exactly what changes I made. I only published it online for you to take my changes from, I wasn't intending to steal your credit.
Nu7s wrote:Also, weren't you the one that commented:
Are people really that scared of the keyboard that they have to use a web-app to type command lines for them?
on http://www.recantha.co.uk/blog/?p=4212#comments
Why would you steal my work then?
Sheesh :cry:

soare
Posts: 3
Joined: Fri Aug 10, 2012 11:36 am
Location: Bucharest / Romania

Re: Raspicam Command Line Generator

Fri May 24, 2013 11:14 am

Maybe redundant for some, but the page is really useful for first-timers in Raspberry Camera usage and even more, it keeps the options in valid order ( a big plus for me ).
It makes as easy as checking a grocery list, so it did it's job for me to get the startup done quick and easy.

Worth being mentioned that commands raspstill and raspivid are still in development and some
things may work or may not so an extra hand of help wouldn't hurt at all.

For the old school guys there is, of course, the documentation..

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Raspicam Command Line Generator

Fri May 24, 2013 11:29 am

Okay, so here's a direct diff between Nu7s's original raspicam.htm and the "improvements" (mentioned above) that I made which he didn't appreciate.

(I can edit this post to remove the diff, if Nu7s is still upset by it)

soare: I'm fairly sure the order of the options doesn't matter.

Code: Select all

38,47c38,100
< 		function check(id1,opt,id2,id3,id4,id5,id6){
< 		if (id1.checked == true)
< 		{
< 		  id1.value = opt;
< 		  id2.disabled = false;
< 		  id2.select();
< 		  id3.disabled = false;
< 		  id4.disabled = false;
< 		  id5.disabled = false;
< 		  
---
> 		// O_type and C_pipe are handled specially
> 		var settings = ['d', 'o', 'v', 'p', 'f', 'n', 'sh', 'co', 'br', 'sa', 'ISO', 'ev', 'ex', 'awb', 'ifx', 'cfx', 'mm', 'rot', 'hf', 'vf', 'w1', 'h1', 'q', 'r', 't1', 'tl', 'th', 'e', 'x', 'w2', 'h2', 'b', 't2', 'fps', 'vs', 'e2'];
> 
> 		function generateCommand() {
> 			str = document.getElementById('O_type').value;
> 			for (i=0; i<settings.length; i++)
> 			{
> 				option = document.getElementById('C_'+settings[i]);
> 				if (option && option.checked)
> 				{
> 					str += ' -'+option.value;
> 					suboption = document.getElementById('C_'+settings[i]+settings[i]);
> 					if (suboption)
> 					{
> 						str += ' '+suboption.value;
> 					}
> 				}
> 			}
> 			if (document.getElementById('C_pipe').checked)
> 			{
> 				str += ' | '+document.getElementById('C_pipepipe').value;
> 			}
> 			return str;
> 		}
> 
> 		function update(parent, opts, sepchar) {
> 			str = "";
> 			for (i=0; i<opts.length; i++)
> 			{
> 				suboption = document.getElementById('C_'+parent+opts[i]);
> 				if (suboption)
> 				{
> 					str += sepchar + suboption.value;
> 				}
> 			}
> 			document.getElementById('C_'+parent+parent).value = str.substr(1);
> 		}
> 
> 		function check(which) {
> 			return checkdef(which, '')
> 		}
> 		function checkdef(which, def) {
> 			return check2def(which, def, '');
> 		}
> 		function check2(which, suffix) {
> 			return check2def(which, '', suffix);
> 		}
> 		function check2def(which, def, suffix) {
> 			checked = which.checked;
> 			suboption = document.getElementById('C_'+which.value+suffix+which.value+suffix);
> 			if (suboption)
> 			{
> 				if (checked)
> 				{
> 					suboption.disabled = false;
> 					suboption.select();
> 				}
> 				else
> 				{
> 					suboption.disabled = true;
> 					suboption.value = def;
> 				}
> 			}
49,61c102,104
< 		else if (id1.checked == false)
< 		{
< 		  id1.value = "";
< 		  id2.value = "";
< 		  id2.disabled = true;
< 		  id3.value = "";
< 		  id3.disabled = true;
< 		  id4.value = "";
< 		  id4.disabled = true;
< 		  id5.value = "";
< 		  id5.disabled = true;
< 		  id6.value = "";
< 		  id6.disabled = true;
---
> 
> 		function checkmulti(which, opts) {
> 			return checkmultidef(which, opts, []);
62a106,142
> 		function checkmultidef(which, opts, defs) {
> 			checked = which.checked;
> 			for (i=0; i<opts.length; i++)
> 			{
> 				suboption = document.getElementById('C_'+which.value+opts[i]);
> 				if (suboption)
> 				{
> 					if (checked)
> 					{
> 						suboption.disabled = false;
> 						if (i==0)
> 						{
> 							suboption.select();
> 						}
> 					}
> 					else
> 					{
> 						suboption.disabled = true;
> 						if (defs.length > i)
> 						{
> 							suboption.value = defs[i];
> 						}
> 						else
> 						{
> 							suboption.value = '';
> 						}
> 					}
> 				}
> 			}
> 			if (!checked)
> 			{
> 				suboption = document.getElementById('C_'+which.value+which.value);
> 				if (suboption)
> 				{
> 					suboption.value = "";
> 				}				
> 			}
63a144
> 
95,101c176,177
< 		<input type="checkbox" id="C_w" value="" onclick="check(C_w,' -w ',C_ww);" /> <i>-w</i>&nbsp; Set image width&nbsp;
< 			<input type="text" id="C_ww" class="txt" value="" disabled="true"/>&nbsp;(64 to 1920)
< 		<br>
< 		<input type="checkbox" id="C_h" value="" onclick="check(C_h,' -h ',C_hh);" /> <i>-h</i>&nbsp; Set image height&nbsp;
< 			<input type="text" id="C_hh" class="txt" value="" disabled="true"/>&nbsp;(64 to 1080)
< 		<br>
< 		<input type="checkbox" id="C_d" value="" onclick="check(C_d,' -d','');" /> <i>-d</i>&nbsp; Run a demo mode			
---
> 		<input type="checkbox" id="C_d" value="d" onclick="checkdef(this,'250')" /> <i>-d</i>&nbsp; Run a demo mode			
> 			<input type="text" id="C_dd" class="txt" value="250" disabled="true" />&nbsp;(msec)
103c179
< 		<input type="checkbox" id="C_o" value="" onclick="check(C_o,' -o ',C_oo);" /> <i>-o</i>&nbsp; Output filename&nbsp;
---
> 		<input type="checkbox" id="C_o" value="o" onclick="check(this)" /> <i>-o</i>&nbsp; Output filename&nbsp;
106c182
< 		<input type="checkbox" id="C_v" value="" onclick="check(C_v,' -v');"/> <i>-v</i>&nbsp; Output verbose information during run&nbsp;
---
> 		<input type="checkbox" id="C_v" value="v" onclick="check(this)"/> <i>-v</i>&nbsp; Output verbose information during run&nbsp;
113,117c189,193
< 		<input type="checkbox" id="C_p" value="" onclick="check(C_p,' -p ',C_px,C_py,C_pw,C_ph,C_pp);" /> <i>-p</i>&nbsp; Preview window settings&nbsp;&nbsp;
< 			x <input type="text" id="C_px" class="txt" value="" disabled="true" onchange="C_pp.value = C_px.value + ',' + C_py.value + ',' + C_pw.value + ',' + C_ph.value" />
< 			y <input type="text" id="C_py" class="txt" value="" disabled="true" onchange="C_pp.value = C_px.value + ',' + C_py.value + ',' + C_pw.value + ',' + C_ph.value" />
< 			w <input type="text" id="C_pw" class="txt" value="" disabled="true" onchange="C_pp.value = C_px.value + ',' + C_py.value + ',' + C_pw.value + ',' + C_ph.value" />
< 			h <input type="text" id="C_ph" class="txt" value="" disabled="true" onchange="C_pp.value = C_px.value + ',' + C_py.value + ',' + C_pw.value + ',' + C_ph.value" />
---
> 		<input type="checkbox" id="C_p" value="p" onclick="checkmulti(this,['x','y','w','h'])" /> <i>-p</i>&nbsp; Preview window settings&nbsp;&nbsp;
> 			x <input type="text" id="C_px" class="txt" value="" disabled="true" onchange="update('p',['x','y','w','h'],',')" />
> 			y <input type="text" id="C_py" class="txt" value="" disabled="true" onchange="update('p',['x','y','w','h'],',')" />
> 			w <input type="text" id="C_pw" class="txt" value="" disabled="true" onchange="update('p',['x','y','w','h'],',')" />
> 			h <input type="text" id="C_ph" class="txt" value="" disabled="true" onchange="update('p',['x','y','w','h'],',')" />
120c196
< 		<input type="checkbox" id="C_f" value="" onclick="check(C_f,' -f');" /> <i>-f</i>&nbsp; Fullscreen preview mode
---
> 		<input type="checkbox" id="C_f" value="f" onclick="check(this)" /> <i>-f</i>&nbsp; Fullscreen preview mode
122c198
< 		<input type="checkbox" id="C_n" value="" onclick="check(C_n,' -n');" /> <i>-n</i>&nbsp; Do not display a preview window
---
> 		<input type="checkbox" id="C_n" value="n" onclick="check(this)" /> <i>-n</i>&nbsp; Do not display a preview window
129,130c205,206
< 		<input type="checkbox" id="C_sh" value="" onclick="check(C_sh,' -sh ',C_shsh);" /> <i>-sh</i>&nbsp; Set image sharpness&nbsp;
< 			<input type="text" id="C_shsh" class="txt" value="" disabled="true" />&nbsp;(-100 to 100)
---
> 		<input type="checkbox" id="C_sh" value="sh" onclick="checkdef(this,'0')" /> <i>-sh</i>&nbsp; Set image sharpness&nbsp;
> 			<input type="text" id="C_shsh" class="txt" value="0" disabled="true" />&nbsp;(-100 to 100)
132,133c208,209
< 		<input type="checkbox" id="C_co" value="" onclick="check(C_co,' -co ',C_coco);" /> <i>-co</i>&nbsp; Set image contrast&nbsp;
< 			<input type="text" id="C_coco" class="txt" value="" disabled="true" />&nbsp;(-100 to 100)	
---
> 		<input type="checkbox" id="C_co" value="co" onclick="checkdef(this,'0')" /> <i>-co</i>&nbsp; Set image contrast&nbsp;
> 			<input type="text" id="C_coco" class="txt" value="0" disabled="true" />&nbsp;(-100 to 100)	
135,136c211,212
< 		<input type="checkbox" id="C_br" value="" onclick="check(C_br,' -br ',C_brbr);" /> <i>-br</i>&nbsp; Set image brightness&nbsp;
< 			<input type="text" id="C_brbr" class="txt" value="" disabled="true" />&nbsp;(0 to 100)					
---
> 		<input type="checkbox" id="C_br" value="br" onclick="checkdef(this,'50')" /> <i>-br</i>&nbsp; Set image brightness&nbsp;
> 			<input type="text" id="C_brbr" class="txt" value="50" disabled="true" />&nbsp;(0 to 100)					
138,139c214,215
< 		<input type="checkbox" id="C_sa" value="" onclick="check(C_sa,' -sa ',C_sasa);" /> <i>-sa</i>&nbsp; Set image saturation&nbsp;
< 			<input type="text" id="C_sasa" class="txt" value="" disabled="true" />&nbsp;(-100 to 100)			
---
> 		<input type="checkbox" id="C_sa" value="sa" onclick="checkdef(this,'0')" /> <i>-sa</i>&nbsp; Set image saturation&nbsp;
> 			<input type="text" id="C_sasa" class="txt" value="0" disabled="true" />&nbsp;(-100 to 100)			
141,142c217,218
< 		<input type="checkbox" id="C_iso" value="" onclick="check(C_iso,' -ISO ',C_isoiso);" /> <i>-ISO</i>&nbsp; Set capture ISO&nbsp;
< 			<input type="text" id="C_isoiso" class="txt" value="" disabled="true"/>&nbsp;(not yet implemented)				
---
> 		<input type="checkbox" id="C_ISO" value="ISO" onclick="checkdef(this,'400')" /> <i>-ISO</i>&nbsp; Set capture ISO&nbsp;
> 			<input type="text" id="C_ISOISO" class="txt" value="400" disabled="true"/>&nbsp;(not yet implemented)				
144,145c220,221
< 		<input type="checkbox" id="C_ev" value="" onclick="check(C_ev,' -ev ',C_evev);" /> <i>-ev</i>&nbsp; Set EV compensation&nbsp;
< 			<input type="text" id="C_evev" class="txt" value="" disabled="true" />&nbsp;(-10 to +10)		
---
> 		<input type="checkbox" id="C_ev" value="ev" onclick="checkdef(this,'0')" /> <i>-ev</i>&nbsp; Set EV compensation&nbsp;
> 			<input type="text" id="C_evev" class="txt" value="0" disabled="true" />&nbsp;(-10 to +10)		
147c223
< 		<input type="checkbox" id="C_ex" value="" onclick="check(C_ex,' -ex ',C_exex);" /> <i>-ex</i>&nbsp; Set exposure mode&nbsp;
---
> 		<input type="checkbox" id="C_ex" value="ex" onclick="checkdef(this,'auto')" /> <i>-ex</i>&nbsp; Set exposure mode&nbsp;
149d224
< 			<option value=""></option>
151c226
< 			<option value="auto">auto</option>
---
> 			<option selected value="auto">auto</option>
165c240
< 		<input type="checkbox" id="C_awb" value="" onclick="check(C_awb,' -awb ',C_awbawb);" /> <i>-awb</i>&nbsp; Set Automatic White Balance mode&nbsp;
---
> 		<input type="checkbox" id="C_awb" value="awb" onclick="checkdef(this,'auto')" /> <i>-awb</i>&nbsp; Set Automatic White Balance mode&nbsp;
167d241
< 			<option value=""></option>
169c243
< 			<option value="auto">auto</option>
---
> 			<option selected value="auto">auto</option>
180c254
< 		<input type="checkbox" id="C_ifx" value="" onclick="check(C_ifx,' -ifx ',C_ifxifx);" /> <i>-ifx</i>&nbsp; Set image effect&nbsp;
---
> 		<input type="checkbox" id="C_ifx" value="ifx" onclick="checkdef(this,'none')" /> <i>-ifx</i>&nbsp; Set image effect&nbsp;
182,183c256
< 			<option value=""></option>
< 			<option value="none">none</option>
---
> 			<option selected value="none">none</option>
208,210c281,283
< 		<input type="checkbox" id="C_cfx" value="" onclick="check(C_cfx,' -cfx ',C_cfxu,C_cfxv,C_cfxcfx);" /> <i>-cfx</i>&nbsp; Set colour effect&nbsp;&nbsp;
< 			U <input type="text" id="C_cfxu" class="txt" value="" disabled="true" onchange="C_cfxcfx.value = C_cfxu.value + ':' + C_cfxv.value" />
< 			V <input type="text" id="C_cfxv" class="txt" value="" disabled="true" onchange="C_cfxcfx.value = C_cfxu.value + ':' + C_cfxv.value" />
---
> 		<input type="checkbox" id="C_cfx" value="cfx" onclick="checkmulti(this,['u','v'])" /> <i>-cfx</i>&nbsp; Set colour effect&nbsp;&nbsp;
> 			U <input type="text" id="C_cfxu" class="txt" value="" disabled="true" onchange="update('cfx',['u','v'],':')" />
> 			V <input type="text" id="C_cfxv" class="txt" value="" disabled="true" onchange="update('cfx',['u','v'],':')" />&nbsp;(0 to 255)
213c286
< 		<input type="checkbox" id="C_mm" value="" onclick="check(C_mm,' -mm ',C_mmmm);" /> <i>-mm</i>&nbsp; Set metering mode&nbsp;
---
> 		<input type="checkbox" id="C_mm" value="mm" onclick="checkdef(this,'average')" /> <i>-mm</i>&nbsp; Set metering mode&nbsp;
215,216c288
< 			<option value=""></option>
< 			<option value="average">average</option>
---
> 			<option selected value="average">average</option>
222,223c294,295
< 		<input type="checkbox" id="C_rot" value="" onclick="check(C_rot,' -rot ',C_rotrot);" /> <i>-rot</i>&nbsp; Set image rotation&nbsp;
< 			<input type="text" id="C_rotrot" class="txt" value="" disabled="true" />&nbsp;(0 to 359)			
---
> 		<input type="checkbox" id="C_rot" value="rot" onclick="checkdef(this,'0')" /> <i>-rot</i>&nbsp; Set image rotation&nbsp;
> 			<input type="text" id="C_rotrot" class="txt" value="0" disabled="true" />&nbsp;(0 to 359)			
225c297
< 		<input type="checkbox" id="C_hf" value="" onclick="check(C_hf,' -hf');" /> <i>-hf</i>&nbsp; Set horizontal flip&nbsp;			
---
> 		<input type="checkbox" id="C_hf" value="" onclick="check(this)" /> <i>-hf</i>&nbsp; Set horizontal flip&nbsp;			
227c299
< 		<input type="checkbox" id="C_vf" value="" onclick="check(C_vf,' -vf');" /> <i>-vf</i>&nbsp; Set vertical flip&nbsp;					
---
> 		<input type="checkbox" id="C_vf" value="" onclick="check(this)" /> <i>-vf</i>&nbsp; Set vertical flip&nbsp;					
234,235c306,307
< 		<input type="checkbox" id="C_q" value="" onclick="check(C_q,' -q ',C_qq);" /> <i>-q</i>&nbsp; Set jpeg quality&nbsp;
< 			<input type="text" id="C_qq" class="txt" value="" disabled="true" />&nbsp;(0 to 100)	
---
> 		<input type="checkbox" id="C_w1" value="w" onclick="check2def(this,'2592','1')" /> <i>-w</i>&nbsp; Set image width&nbsp;
> 			<input type="text" id="C_w1w1" class="txt" value="2592" disabled="true"/>&nbsp;(64 to 2592)
237c309,310
< 		<input type="checkbox" id="C_r" value="" onclick="check(C_r,' -r');" /> <i>-r</i>&nbsp; Add raw bayer data to jpeg metadata
---
> 		<input type="checkbox" id="C_h1" value="h" onclick="check2def(this,'1944','1')" /> <i>-h</i>&nbsp; Set image height&nbsp;
> 			<input type="text" id="C_h1h1" class="txt" value="1944" disabled="true"/>&nbsp;(64 to 1944)
239,240c312,318
< 		<input type="checkbox" id="C_t1" value="" onclick="check(C_t1,' -t ',C_tt1);" /> <i>-t</i>&nbsp; Time before takes picture and shuts down&nbsp;
< 			<input type="text" id="C_tt1" class="txt" value="" disabled="true"/>&nbsp;(msec)			
---
> 		<input type="checkbox" id="C_q" value="q" onclick="checkdef(this,'85')" /> <i>-q</i>&nbsp; Set jpeg quality&nbsp;
> 			<input type="text" id="C_qq" class="txt" value="85" disabled="true" />&nbsp;(0 to 100)	
> 		<br>
> 		<input type="checkbox" id="C_r" value="r" onclick="check(this)" /> <i>-r</i>&nbsp; Add raw bayer data to jpeg metadata
> 		<br>
> 		<input type="checkbox" id="C_t1" value="t" onclick="check2def(this,'5000','1')" /> <i>-t</i>&nbsp; Time before takes picture and shuts down&nbsp;
> 			<input type="text" id="C_t1t1" class="txt" value="5000" disabled="true"/>&nbsp;(msec)			
242c320
< 		<input type="checkbox" id="C_tl" value="" onclick="check(C_tl,' -tl ',C_tltl);" /> <i>-tl</i>&nbsp; Timelapse mode&nbsp;
---
> 		<input type="checkbox" id="C_tl" value="tl" onclick="check(this)" /> <i>-tl</i>&nbsp; Timelapse mode&nbsp;
245,248c323,326
< 		<input type="checkbox" id="C_th" value="" onclick="check(C_th,' -th ',C_thx,C_thy,C_thq,C_thth);" /> <i>-th</i>&nbsp; Set thumbnail parameters&nbsp;
< 			x <input type="text" id="C_thx" class="txt" value="" disabled="true" onchange="C_thth.value = C_thx.value + ':' + C_thy.value + ':' + C_thq.value" />
< 			y <input type="text" id="C_thy" class="txt" value="" disabled="true" onchange="C_thth.value = C_thx.value + ':' + C_thy.value + ':' + C_thq.value" />
< 			q <input type="text" id="C_thq" class="txt" value="" disabled="true" onchange="C_thth.value = C_thx.value + ':' + C_thy.value + ':' + C_thq.value" />
---
> 		<input type="checkbox" id="C_th" value="th" onclick="checkmultidef(this,['x','y','q'],['64','48','35'])" /> <i>-th</i>&nbsp; Set thumbnail parameters&nbsp;
> 			x <input type="text" id="C_thx" class="txt" value="64" disabled="true" onchange="update('th',['x','y','q'],':')" />
> 			y <input type="text" id="C_thy" class="txt" value="48" disabled="true" onchange="update('th',['x','y','q'],':')" />
> 			q <input type="text" id="C_thq" class="txt" value="35" disabled="true" onchange="update('th',['x','y','q'],':')" />
251c329
< 		<input type="checkbox" id="C_e" value="" onclick="check(C_e,' -e ',C_ee);" /> <i>-e</i>&nbsp; Encoding to use for output file
---
> 		<input type="checkbox" id="C_e" value="e" onclick="checkdef(this, 'jpg')" /> <i>-e</i>&nbsp; Encoding to use for output file
253,254c331
< 			<option value=""></option>
< 			<option value="jpg">jpg</option>
---
> 			<option selected value="jpg">jpg</option>
260c337
< 		<input type="checkbox" id="C_x" value="" onclick="check(C_x,' -x ',C_xx);" /> <i>-x</i>&nbsp; EXIF tag to apply to captures&nbsp;
---
> 		<input type="checkbox" id="C_x" value="x" onclick="check(this)" /> <i>-x</i>&nbsp; EXIF tag to apply to captures&nbsp;
268,269c345,352
< 		<input type="checkbox" id="C_b" value="" onclick="check(C_b,' -b ',C_bb);" /> <i>-b</i>&nbsp; Set bitrate&nbsp;
< 			<input type="text" id="C_bb" class="txt" value="" disabled="true" />&nbsp;(bits/second)
---
> 		<input type="checkbox" id="C_w2" value="w" onclick="check2def(this,'1920','2')" /> <i>-w</i>&nbsp; Set video width&nbsp;
> 			<input type="text" id="C_w2w2" class="txt" value="1920" disabled="true"/>&nbsp;(64 to 1920)
> 		<br>
> 		<input type="checkbox" id="C_h2" value="h" onclick="check2def(this,'1080','2')" /> <i>-h</i>&nbsp; Set video height&nbsp;
> 			<input type="text" id="C_h2h2" class="txt" value="1080" disabled="true"/>&nbsp;(64 to 1080)
> 		<br>
> 		<input type="checkbox" id="C_b" value="b" onclick="checkdef(this,'17000000')" /> <i>-b</i>&nbsp; Set bitrate&nbsp;
> 			<input type="text" id="C_bb" class="txt" value="17000000" disabled="true" />&nbsp;(bits/second)
271,272c354,355
< 		<input type="checkbox" id="C_t2" value="" onclick="check(C_t2,' -t ',C_tt2);" /> <i>-t</i>&nbsp; Lengt of video capture&nbsp;
< 			<input type="text" id="C_tt2" class="txt" value="" disabled="true"/>&nbsp;(msec)				
---
> 		<input type="checkbox" id="C_t2" value="t" onclick="check2def(this,'5000','2')" /> <i>-t</i>&nbsp; Length of video capture&nbsp;
> 			<input type="text" id="C_t2t2" class="txt" value="5000" disabled="true"/>&nbsp;(msec)				
274,275c357,358
< 		<input type="checkbox" id="C_fps" value="" onclick="check(C_fps,' -fps ',C_fpsfps);" /> <i>-fps</i>&nbsp; Specify the frame per second to record&nbsp;
< 			<input type="text" id="C_fpsfps" class="txt" value="" disabled="true" />&nbsp;(2 to 30)	
---
> 		<input type="checkbox" id="C_fps" value="fps" onclick="checkdef(this,'30')" /> <i>-fps</i>&nbsp; Specify the frame per second to record&nbsp;
> 			<input type="text" id="C_fpsfps" class="txt" value="30" disabled="true" />&nbsp;(2 to 30)	
277c360
< 		<input type="checkbox" id="C_vs" value="" onclick="check(C_vs,' -vs');" /> <i>-vs</i>&nbsp; Turn on video stabilisation&nbsp;			
---
> 		<input type="checkbox" id="C_vs" value="" onclick="check(this)" /> <i>-vs</i>&nbsp; Turn on video stabilisation&nbsp;			
279c362
< 		<input type="checkbox" id="C_e2" value="" onclick="check(C_e2,' -e');" /> <i>-e</i>&nbsp; Display preview image after encoding&nbsp;			
---
> 		<input type="checkbox" id="C_e2" value="e" onclick="check2(this, '2')" /> <i>-e</i>&nbsp; Display preview image after encoding&nbsp;			
286c369
< 		<input type="checkbox" id="C_pipe" value="" onclick="check(C_pipe,' | ',C_pipepipe);" /> |&nbsp; Add pipe&nbsp;
---
> 		<input type="checkbox" id="C_pipe" value="pipe" onclick="check(this)" /> |&nbsp; Add pipe&nbsp;
292,295c375,376
< <input type="button" value="Generate command" onclick="document.getElementById('command').value = 
< O_type.value + C_w.value + C_ww.value + C_h.value + C_hh.value + C_d.value + C_o.value + C_oo.value + C_v.value + C_p.value + C_pp.value + C_f.value + C_n.value + C_sh.value + C_shsh.value + C_co.value + C_coco.value + C_br.value + C_brbr.value + C_sa.value + C_sasa.value + C_iso.value + C_isoiso.value + C_vs.value + C_ev.value + C_evev.value + C_ex.value + C_exex.value + C_awb.value + C_awbawb.value + C_ifx.value + C_ifxifx.value + C_cfx.value + C_cfxcfx.value + C_mm.value + C_mmmm.value + C_rot.value + C_rotrot.value + C_hf.value + C_vf.value + C_q.value + C_qq.value + C_r.value + C_t1.value + C_tt1.value + C_tl.value + C_tltl.value + C_th.value + C_thth.value + C_e.value + C_ee.value + C_x.value + C_xx.value + C_b.value + C_bb.value + C_t2.value + C_tt2.value + C_fps.value + C_fpsfps.value + C_e2.value  + C_pipe.value + C_pipepipe.value
< " />
---
> <input type="button" value="Generate command" onclick="document.getElementById('command').value = generateCommand()" />

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Fri May 24, 2013 1:31 pm

@soare: I'm glad you liked it and took the time to reply. :)

@AndrewS: Why would a 100+ line javascript code be better then a 28 line one that gives the same output and can be understood by anyone with some very basic scripting experience? What's the point in making things more complex then they need to be? I'm not trying to disrespect you, I'm doing my very best to understand your need to "improve" my code so badly. :? As for the other suggestions, I'l look into them when I have some more time on my hands.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20067
Joined: Sat Jul 30, 2011 7:41 pm

Re: Raspicam Command Line Generator

Fri May 24, 2013 1:41 pm

I have no idea of AndrewS motivation, but generic reasons for more code rather than less...

Readability (and that's not just more comments!)
Ease of enhancement
Ease of maintenance/bug fixing

I'm sure there are others, but that's the mantra I use.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Raspicam Command Line Generator

Fri May 24, 2013 1:54 pm

Hmmm, maybe I got a bit "carried away" with my "improvements" then.

The main change was so that e.g.

Code: Select all

<input type="checkbox" id="C_o" value="" onclick="check(C_o,' -o ',C_oo);" />
could be replaced with

Code: Select all

<input type="checkbox" id="C_o" value="o" onclick="check(this)" />
(there's less parameters passed into the check function, which should make it easier to add any extra options in future). And I didn't like the way you were building the command string by concatenating all the values together, even ones that weren't set - IMHO it's easier to add extra options to

Code: Select all

var settings = ['d', 'o', 'v', 'p', 'f', 'n', 'sh', 'co', 'br', 'sa', 'ISO', 'ev', 'ex', 'awb', 'ifx', 'cfx', 'mm', 'rot', 'hf', 'vf', 'w1', 'h1', 'q', 'r', 't1', 'tl', 'th', 'e', 'x', 'w2', 'h2', 'b', 't2', 'fps', 'vs', 'e2'];
than it is to add extra options to

Code: Select all

C_w.value + C_ww.value + C_h.value + C_hh.value + C_d.value + C_o.value + C_oo.value + C_v.value + C_p.value + C_pp.value + C_f.value + C_n.value + C_sh.value + C_shsh.value + C_co.value + C_coco.value + C_br.value + C_brbr.value + C_sa.value + C_sasa.value + C_iso.value + C_isoiso.value + C_vs.value + C_ev.value + C_evev.value + C_ex.value + C_exex.value + C_awb.value + C_awbawb.value + C_ifx.value + C_ifxifx.value + C_cfx.value + C_cfxcfx.value + C_mm.value + C_mmmm.value + C_rot.value + C_rotrot.value + C_hf.value + C_vf.value + C_q.value + C_qq.value + C_r.value + C_t1.value + C_tt1.value + C_tl.value + C_tltl.value + C_th.value + C_thth.value + C_e.value + C_ee.value + C_x.value + C_xx.value + C_b.value + C_bb.value + C_t2.value + C_tt2.value + C_fps.value + C_fpsfps.value + C_e2.value
And then I decided to 'extend' it further so that when an option is disabled, it automatically displays the default value (which is probably what over-complicated it again).

Apologies again if I gave the wrong impression :?

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Fri May 24, 2013 2:21 pm

I think I understand the difference:

I look at it through the eyes of a webdesigner. With my approach, when adding/changing options, there only need to be changes made to the part of code in the body of the webpage. Adding div's, define the id's and calling the javascript script is all done in one place.

You look at it from the eyes of a scripter/coder. You add/change options more efficiently in the javascript with fewer characters. But, you also need to add the div's, add id's and call the javascript from within the body of the page. Your approach, which needs you changing code in 2 places will eventually take longer to do.

@jamesh: Perfectly correct reasons, but I don't believe they are valid in this case with such few lines of code. I don't believe AndrewS's sourcecode is more readable than mine and certainly not easier for me to enhance, maintain or fix bugs in. I do not make a living coding javascript so my code may seem simple and underdeveloped, but it does the job.
Last edited by Nu7s on Fri May 24, 2013 2:25 pm, edited 1 time in total.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Raspicam Command Line Generator

Fri May 24, 2013 2:25 pm

Fair enough. Are we all friends again now? ;)

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Sat May 25, 2013 9:39 pm

Of course. I'm not here to make enemies... ;)

bugloss
Posts: 22
Joined: Fri Jan 04, 2013 2:44 pm
Contact: Website

Re: Raspicam Command Line Generator

Fri Jun 07, 2013 9:54 am

Well, glad to see we're all friends again. :)

Nu7s, well done for standing for your copyright, but that's always going to be a problem with posting stuff on the web. I speak from the experience of having my copyright infringed on a regular basis and it sucks !

Anyway back to business.

How about the ability to specify a directory to save the jpegs in and a setting for an infinite loop to time lapse forever and ever and ever and ever ( a nod to Demis Roussos there). Who???? http://www.youtube.com/artist/demis-roussos
Obviously there would need to be some kind of folder creation going on to keep it all manageable, perhaps a new folder numbered in sequence after 9999 jpegs.
http://www.adamwilson.co

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20067
Joined: Sat Jul 30, 2011 7:41 pm

Re: Raspicam Command Line Generator

Fri Jun 07, 2013 10:29 am

bugloss wrote:Well, glad to see we're all friends again. :)

Nu7s, well done for standing for your copyright, but that's always going to be a problem with posting stuff on the web. I speak from the experience of having my copyright infringed on a regular basis and it sucks !

Anyway back to business.

How about the ability to specify a directory to save the jpegs in and a setting for an infinite loop to time lapse forever and ever and ever and ever ( a nod to Demis Roussos there). Who???? http://www.youtube.com/artist/demis-roussos
Obviously there would need to be some kind of folder creation going on to keep it all manageable, perhaps a new folder numbered in sequence after 9999 jpegs.
Infinite stuff already done, may not be released yet. You might be able to put the directory in already - never tried it. I did 18k images without having to worry about directory changes, so pretty sure you can just keep taking images.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

bugloss
Posts: 22
Joined: Fri Jan 04, 2013 2:44 pm
Contact: Website

Re: Raspicam Command Line Generator

Fri Jun 07, 2013 2:29 pm

@jamesh

That's good as the most -t gives me is 999999999 milliseconds. I'd like to infinity as I want to stream it permanently from London to Denmark with Openswan and Samba.

I've got the Openswan going and samba so it's a matter of tying the things together.

I'm on my first time lapse at the moment with the pi and an RS rechargeable battery and I'm very impressed with the picture quality.
http://www.adamwilson.co

dan3008
Posts: 1172
Joined: Wed Aug 15, 2012 1:05 pm

Re: Raspicam Command Line Generator

Sat Jun 08, 2013 8:19 am

useful little app :)
I'd been working on one in python to actually put on my pi, that can execute the command or let you copy and paste it lol.

do you mind if i have a read through your source to get a better understanding of how it works? And when mine is finished, I'll share it :) and then you're more than welcome to play with it lol
dan3008 wrote:Pays your money, takes your choice

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Sat Jun 08, 2013 9:52 am

bugloss wrote: Nu7s, well done for standing for your copyright, but that's always going to be a problem with posting stuff on the web. I speak from the experience of having my copyright infringed on a regular basis and it sucks !
Then I really don't understand why you copied it without asking.
bugloss wrote: How about the ability to specify a directory to save the jpegs in and a setting for an infinite loop to time lapse forever and ever and ever and ever ( a nod to Demis Roussos there). Who???? http://www.youtube.com/artist/demis-roussos
Obviously there would need to be some kind of folder creation going on to keep it all manageable, perhaps a new folder numbered in sequence after 9999 jpegs.
This isn't the original intend, but I like the idea. In my opinion it would be a separate page, to maintain the visibility, but I'll think about it. But I can't think of a single command line that would do what suggest. If it generates a .sh script, the user would need to be advanced enough to know how to 1. create it 2. set correct permissions 3. run it (in background). Wouldn't this user be smart enough to figure out the script himself?
dan3008 wrote:useful little app :)
I'd been working on one in python to actually put on my pi, that can execute the command or let you copy and paste it lol.

do you mind if i have a read through your source to get a better understanding of how it works? And when mine is finished, I'll share it :) and then you're more than welcome to play with it lol
Glad you like it. I have no problem if you read the code and write your own based on that, just don't copy it. I would however be willing to work with you to do this? Do you have much experience in Linux? It wouldn't be easy to run this website on the pi, generate the command line code and run it. I don't think you could run it from within a browser, so you would need to generate it as a script that is run once when there is new content, but doesn't keep it open so the webpage can write to it. Wich way were you thinking?

dan3008
Posts: 1172
Joined: Wed Aug 15, 2012 1:05 pm

Re: Raspicam Command Line Generator

Sat Jun 08, 2013 1:43 pm

Nu7s wrote: Glad you like it. I have no problem if you read the code and write your own based on that, just don't copy it. I would however be willing to work with you to do this? Do you have much experience in Linux? It wouldn't be easy to run this website on the pi, generate the command line code and run it. I don't think you could run it from within a browser, so you would need to generate it as a script that is run once when there is new content, but doesn't keep it open so the webpage can write to it. Wich way were you thinking?
I'm looking at a few different ways of doing it at the moment, One is to write it in java, but that would require the user to install java first. My other main option is to write it in python, where the program does the work itself to actually build the command.

my main reason for looking at your code, was so i could see how you built the command lol.

If i run into any difficulties, I'll be sure to ask :)
dan3008 wrote:Pays your money, takes your choice

bugloss
Posts: 22
Joined: Fri Jan 04, 2013 2:44 pm
Contact: Website

Re: Raspicam Command Line Generator

Sun Jun 09, 2013 9:07 am

@Nu7s

There must be some kind of misunderstanding here as I haven't copied it at all, Andrew did. you've got us mixed up.
http://www.adamwilson.co

Nu7s
Posts: 57
Joined: Wed Jul 25, 2012 9:14 am

Re: Raspicam Command Line Generator

Sun Jun 09, 2013 9:12 am

bugloss wrote:@Nu7s
There must be some kind of misunderstanding here as I haven't copied it at all, Andrew did. you've got us mixed up.
You are correct, I got misled from the sentence "glad to see were all friends again". I was thinking it was strange. My apologies.

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 10 guests