PiGraham
Posts: 3939
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: New version of Raspistill

Thu Oct 17, 2013 5:00 pm

Excellent stuff James.

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

Re: New version of Raspistill

Thu Oct 17, 2013 6:27 pm

Thanks.

With regard to the parameter checking, I think when it comes to -s and -k, the one last on the command line will take priority. I don't think they conflict, so not quite sure what to say about it. Perhaps just they are mutually exclusive. I'll have a think and sort the docs.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
jbeale
Posts: 3675
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: New version of Raspistill

Fri Oct 18, 2013 12:22 am

jamesh wrote:Just pushed an update to the video_pause branch to allow the initial state of the camera to be defined.
Thanks for that update, very useful as I prefer to start up in "pause" mode and then trigger the first record session later. Like powering up a camcorder, and then hitting record when ready. The new version is working fine here.

ethanol100
Posts: 641
Joined: Wed Oct 02, 2013 12:28 pm

Re: New version of Raspistill

Fri Oct 18, 2013 9:29 am

For i.e. wildlife recording, I think it would be nice to mark somehow, where and when the "pause key" was pressed.

One possibility would be to use chapters, they can be used with vlc and other media player. They could be added to a mp4 video with MP4Box. MP4Box takes chapters marks in different formats. The simplest one would be in the form of "h:m:s.ms name" in a text file with each line containing one chapter mark.
So my question is, does the h264 stream contains timestamps,or some information, from which we can extracted these times from the h264 output file? I think h264 is only raw data stream without timing and the stream is created at fixed frame rate, I would guess no chance to get it from the output file?

I have played a bit with the pts of the buffer inside the encoder callback, I can get the pts and from changes in the pts value i have tried to count the number of frames, with the number of frames I can try to generate the timestamps and put the system clock as chapter name. Just a very ugly try, I think there should be a simple way to ask the encoder input buffer which frame number it has? But would a feature like this make some sense? Additional switch "--save-chapters charpter.txt"?

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

Re: New version of Raspistill

Fri Oct 18, 2013 10:06 am

ethanol100 wrote:For i.e. wildlife recording, I think it would be nice to mark somehow, where and when the "pause key" was pressed.

One possibility would be to use chapters, they can be used with vlc and other media player. They could be added to a mp4 video with MP4Box. MP4Box takes chapters marks in different formats. The simplest one would be in the form of "h:m:s.ms name" in a text file with each line containing one chapter mark.
So my question is, does the h264 stream contains timestamps,or some information, from which we can extracted these times from the h264 output file? I think h264 is only raw data stream without timing and the stream is created at fixed frame rate, I would guess no chance to get it from the output file?

I have played a bit with the pts of the buffer inside the encoder callback, I can get the pts and from changes in the pts value i have tried to count the number of frames, with the number of frames I can try to generate the timestamps and put the system clock as chapter name. Just a very ugly try, I think there should be a simple way to ask the encoder input buffer which frame number it has? But would a feature like this make some sense? Additional switch "--save-chapters charpter.txt"?
I'm not sure that is wholly possible. H264 has no timestamping information, but it does have a zero based frame count. Not sure how to access it as its in the slice header. You might be able to output a text file from the timestamps in the buffer callback, flagging when each frame arrives as you suggest, but not sure of the use of it.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: New version of Raspistill

Fri Oct 18, 2013 10:34 am

ethanol100 wrote:For i.e. wildlife recording, I think it would be nice to mark somehow, where and when the "pause key" was pressed.

...
Would it not be easier to end the recording once the 'pause key' is pressed, then rename the file with the timestamp and reinvoke raspivid to wait for the next movement?

ethanol100
Posts: 641
Joined: Wed Oct 02, 2013 12:28 pm

Re: New version of Raspistill

Fri Oct 18, 2013 11:13 am

jamesh wrote: I'm not sure that is wholly possible. H264 has no timestamping information, but it does have a zero based frame count. Not sure how to access it as its in the slice header. You might be able to output a text file from the timestamps in the buffer callback, flagging when each frame arrives as you suggest, but not sure of the use of it.
Thank you for your fast reply!
Yes, I have realized that I can only get info from the buffer in the buffer callback, and there I need to use global variables, and it gets ugly from then on. But I will give it a try and will give an example, where I think it would be useful.
(If we could save the output stream in .ts format, we could store the timestamps and use it afterwards. Or for which use case are the pts and dts included in MMAL_BUFFER_HEADER_T.)
poing wrote: Would it not be easier to end the recording once the 'pause key' is pressed, then rename the file with the timestamp and reinvoke raspivid to wait for the next movement?
I think there would be some benefits in the chapter method, you will utilize the h264 stream more effectively, would not need to shut down and restart the camera and could trigger even events where the delay between the trigger would be very small.

And it is really only one example, I think it would just be nice to know, where in the stream jumps in the time line occur. And something similar to the %d (or %s for the date) in filename switch would also be very nice, but I do not know if it is possible and how long it would take to initialize a new stream.

The pause key/signal is a very nice feature, and I was just thinking about how to use it.

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

Re: New version of Raspistill

Fri Oct 18, 2013 2:20 pm

I've just submitted a pull request for the new raspivid changes - the recent raspistill changes were just pulled in to the mainline raspi userland as well.

Next on list now I've picked a load of low hanging fruit....hmmm...might take a look at the exposure length issue, or perhaps the video field of view. Neither going to be a quick ones.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
jbeale
Posts: 3675
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: New version of Raspistill

Fri Oct 18, 2013 4:05 pm

jamesh wrote: ...might take a look at the exposure length issue, or perhaps the video field of view.
Thanks for the new features, and keep up the good work! I think both of those items are worthy goals. Speaking for myself, setting a fixed exposure time (while also setting ISO) is top of my list. In many cases I can already expand field of view with an iPhone lens accessory, but true manual exposure remains out of reach.
Last edited by jbeale on Fri Oct 18, 2013 4:08 pm, edited 1 time in total.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5537
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: New version of Raspistill

Fri Oct 18, 2013 4:07 pm

jamesh wrote:I've just submitted a pull request for the new raspivid changes - the recent raspistill changes were just pulled in to the mainline raspi userland as well.
This is now available in latest rpi-update firmware.

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

Re: New version of Raspistill

Fri Oct 18, 2013 4:17 pm

jbeale wrote:
jamesh wrote: ...might take a look at the exposure length issue, or perhaps the video field of view.
Thanks for your efforts, and keep up the good work! I think both of those items are worthy goals. Speaking for myself, setting a fixed exposure time (while also setting ISO) is top of my list. In many cases I can already expand field of view with an iPhone lens accessory, but true manual exposure remains out of reach.
Is the fixed exposure time stuff not yet released? I did that a couple of weeks ago, and looking at github its not there....I'll investigate.

Not sure how it reacts with a fixed ISO though!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

ethanol100
Posts: 641
Joined: Wed Oct 02, 2013 12:28 pm

Re: New version of Raspistill

Fri Oct 18, 2013 4:37 pm

Yes, that are the really important features. Hope they can be released soon. I really wish to try the manual exposure mode.

Just as proof of concept, I have create a small video with

Code: Select all

raspivid -c test.txt -i pause -v -k -t 0 -o test.h264
MP4Box -add test.h264 -fps 30 -chap test.txt test.mp4
The resulting mp4 now has chapter marks and we can navigate to them in vlc or mplayer("!" and "@"), but somehow the player only use seconds and not milliseconds for the marks, so they are not exact, but with avidemux I can check, that the timestampes are right.

A first example video can be found at: http://www2.geo.uni-bonn.de/members/kroener/test.mp4
I hope to create a better video on the weekend.

(For other players i.e. Quicktime we would need to convert the chapter marks to another format with "mp4chaps --convert --chapter-qt test.mp4".)

This is my modified version of RaspiVid:
RaspiVid.c.bz2
My ugly modifications, just to show what I thought of.
(10.97 KiB) Downloaded 122 times

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: New version of Raspistill

Fri Oct 18, 2013 5:01 pm

jbeale wrote: Thanks for the new features, and keep up the good work! I think both of those items are worthy goals. Speaking for myself, setting a fixed exposure time (while also setting ISO) is top of my list.
+1. If manual exposure is implemented already I don't know how to use it. I did manage to get RAW into DNG, wasn't so hard when you know how to do it.

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

Re: New version of Raspistill

Fri Oct 18, 2013 6:33 pm

I checked with Dom and the change to the firmware has just gone through, so I have sent him a pull request for the ARM aide change to raspistill. Should be there soon.

In the meantime it's on my github on the shutter_speed branch. You will need to do rpi-update to get latest firmware and ensure the userland is bang up to date.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

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

Re: New version of Raspistill

Sun Oct 20, 2013 12:41 pm

I believe the shutter speed option should now be present in the latest raspberry pi userland code. So if you want to give it a try....

Note I think there is an upper limit of about 345ms (approx 1/3rd second) at the moment- still haven't figured out why. Going over this and the camera locks up.

There also a new options from a community contribution to disable exif tags and thumbnail completely to really get file sizes down. SO if people can give that a go as well, taht would be great. Not currently documented in the odt.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: New version of Raspistill

Sun Oct 20, 2013 2:24 pm

I'm building it now (I hope :D ). Is there a parameter/option to set the shutter speed?

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

Re: New version of Raspistill

Sun Oct 20, 2013 2:26 pm

poing wrote:I'm building it now (I hope :D ). Is there a parameter/option to set the shutter speed?
In the docs. I think I used -ss then the speed in ms. But type raspistill with no parameters and it should appear in the help
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: New version of Raspistill

Sun Oct 20, 2013 3:17 pm

No luck. I did

Code: Select all

git clone https://github.com/JamesH65/userland
cd userland
./buildme
but I get

Code: Select all

raspistill -ss 300 -o test.jpg
Invalid command line option (300)
typing raspistill gives

Code: Select all

raspistill Camera App v1.3.4

Runs camera for specific time, and take JPG capture at end if requested

usage: raspistill [options]

Image parameter commands

-?, --help      : This help information
-w, --width     : Set image width <size>
-h, --height    : Set image height <size>
-q, --quality   : Set jpeg quality <0 to 100>
-r, --raw       : Add raw bayer data to jpeg metadata
-o, --output    : Output filename <filename> (to write to stdout, use '-o -'). If not specified, no file is saved
-l, --latest    : Link latest complete image to filename <filename>
-v, --verbose   : Output verbose information during run
-t, --timeout   : Time (in ms) before takes picture and shuts down (if not specified, set to 5s)
-th, --thumb    : Set thumbnail parameters (x:y:quality)
-d, --demo      : Run a demo mode (cycle through range of camera options, no capture)
-e, --encoding  : Encoding to use for output file (jpg, bmp, gif, png)
-x, --exif      : EXIF tag to apply to captures (format as 'key=value')
-tl, --timelapse        : Timelapse mode. Takes a picture every <t>ms
-fp, --fullpreview      : Run the preview using the still capture resolution (may reduce preview fps)
-k, --keypress  : Wait between captures for a ENTER, X then ENTER to exit
-s, --signal    : Wait between captures for a SIGUSR1 from another process

Preview parameter commands

-p, --preview   : Preview window settings <'x,y,w,h'>
-f, --fullscreen        : Fullscreen preview mode
-op, --opacity  : Preview window opacity (0-255)
-n, --nopreview : Do not display a preview window

Image parameter commands

-sh, --sharpness        : Set image sharpness (-100 to 100)
-co, --contrast : Set image contrast (-100 to 100)
-br, --brightness       : Set image brightness (0 to 100)
-sa, --saturation       : Set image saturation (-100 to 100)
-ISO, --ISO     : Set capture ISO
-vs, --vstab    : Turn on video stablisation
-ev, --ev       : Set EV compensation
-ex, --exposure : Set exposure mode (see Notes)
-awb, --awb     : Set AWB mode (see Notes)
-ifx, --imxfx   : Set image effect (see Notes)
-cfx, --colfx   : Set colour effect (U:V)
-mm, --metering : Set metering mode (see Notes)
-rot, --rotation        : Set image rotation (0-359)
-hf, --hflip    : Set horizontal flip
-vf, --vflip    : Set vertical flip
-roi, --roi     : Set region of interest (x,y,w,d as normalised coordinates [0.0-1.0])


Notes

Exposure mode options :
auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks

AWB mode options :
off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon

Image Effect mode options :
none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon

Metering Mode options :
average,spot,backlit,matrix
The video pause function does work.

gordon77
Posts: 5036
Joined: Sun Aug 05, 2012 3:12 pm

Re: New version of Raspistill

Sun Oct 20, 2013 3:24 pm

I'm no expert at this but trying to learn from info on here, and I'm trying it at the moment, but do you need

$ git checkout shutter_speed

after the cd userland, and before the ./buildme ?

gordon77
Posts: 5036
Joined: Sun Aug 05, 2012 3:12 pm

Re: New version of Raspistill

Sun Oct 20, 2013 3:36 pm

gordon77 wrote:I'm no expert at this but trying to learn from info on here, and I'm trying it at the moment, but do you need

$ git checkout shutter_speed

after the cd userland, and before the ./buildme ?
It seemed to work and I get -ss, --shutter : Set shutter speed in microseconds

but if I run raspistill -ss 300 -o test.jpg, or any other raspistill command

I get

mmal: mmal_vc_port_parameter_set: failed to set set port parameter 64:0:ENOSYS
mmal: Function not implemented

so maybe I'm doing something wrong.

It takes pictures but setting 30 or 300 makes no difference. Is it really microseconds ?
Last edited by gordon77 on Sun Oct 20, 2013 3:54 pm, edited 1 time in total.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: New version of Raspistill

Sun Oct 20, 2013 3:53 pm

OK thanks I'll try that. But jamesh already said over 345ms won't work.

gordon77
Posts: 5036
Joined: Sun Aug 05, 2012 3:12 pm

Re: New version of Raspistill

Sun Oct 20, 2013 3:55 pm

poing wrote:OK thanks I'll try that. But jamesh already said over 345ms won't work.
sorry corrected to 300, I've tried setting 30 and 300 all the pics look the same.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: New version of Raspistill

Sun Oct 20, 2013 4:04 pm

Try setting the ISO too, otherwise the ISO will change automatically to compensate.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: New version of Raspistill

Sun Oct 20, 2013 4:28 pm

No luck yet.

Code: Select all

raspistill -ss 300 -ISO 400 -ex night -o test7.jpg
mmal: mmal_vc_port_parameter_set: failed to set port parameter 64:0:ENOSYS
mmal: Function not implemented
gives 1/18 @ ISO 400, while

Code: Select all

raspistill -ss 150 -ISO 400 -ex night -o test8.jpg
mmal: mmal_vc_port_parameter_set: failed to set port parameter 64:0:ENOSYS
mmal: Function not implemented
gives 1/16 @ ISO 400 (light is waning a bit)

gordon77
Posts: 5036
Joined: Sun Aug 05, 2012 3:12 pm

Re: New version of Raspistill

Sun Oct 20, 2013 4:41 pm

poing wrote:Try setting the ISO too, otherwise the ISO will change automatically to compensate.

Tried but no difference.

Return to “Camera board”