fsxskillz
Posts: 11
Joined: Fri Jun 08, 2018 2:55 pm

raspiraw different output after raspberry update

Tue Jun 11, 2019 8:20 pm

Hello everyone,

A year after i worked on a project where i used raspiraw to get raw data and convert to ppm images using dcraw everything worked fine.
But now i needed to re use the software i coded, the same one, but it seems like dcraw couldn't decode with the error "unexpected end of file".
I had to make a apt get update before building raspiraw because it didn't work at first.
I did some digging and i fount out that the .raw output i had one year before were 407 KiB and i still can convert those with dcraw without any problem. But when i re execute the command "raspiraw -md 7 -hd0 -o out.raw" i have a 332KiB output which seem to me logic because the output is 640*480 = 300KiB + the 32KiB for the header (but i dont know why it was 407 KiB before, knowing that i had the same options for raspiraw). And i can't get dcraw working with the new 332KiB outputs.

Thank you very much for reading me.

User avatar
HermannSW
Posts: 1249
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspiraw different output after raspberry update

Tue Jun 11, 2019 9:16 pm

Your command line is wrong, "-hd0" needs a filename.
Since you now want the file that dcraw can decode, just remove "-hd0" and it will work.

"-hd0" is needed to save the header to a separate file once and reduce the size of all frames by that size.
Tool raw2ogg2anim copies the "-hd0" file together with frame before dcrawing that frame:
https://github.com/6by9/raspiraw/blob/m ... g2anim#L14
bookmark list: https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/fork-raspiraw
https://github.com/Hermann-SW/userland
https://twitter.com/HermannSW

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6899
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspiraw different output after raspberry update

Tue Jun 11, 2019 9:25 pm

The default is to write the raw data only.
Use -hd to write the header to each output file.
-hd0 <filename> writes the header to a separate file.

And please ensure you use the version of dcraw from https://github.com/6by9/dcraw as the standard one doesn't have the parser for the raw header.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

fsxskillz
Posts: 11
Joined: Fri Jun 08, 2018 2:55 pm

Re: raspiraw different output after raspberry update

Wed Jun 12, 2019 7:40 am

Hello,

I'm sorry i just miswrote the command in the original post, i do use the -hd option not the -hd0 option.
The problem doesn't seem to be related to that since the header is only 32KiB.
The old raw output i found saved from last year were 407 KiB ( In one of HermannSW's posts he had the same size ) , but now i have a 332 KiB raw outputs. That's really what's bothering me, because that's the only difference between the old outputs which i can convert using dcraw and the ones i have now which i get an error when trying the conversion.

Thanks you in advance.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6899
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspiraw different output after raspberry update

Wed Jun 12, 2019 8:36 am

332kB = 640*480 * RAW8 + 32kB header (8bpp)
407kB = 640*480 * RAW10 + 32kB header (10bpp packed)

I do vaguely recall a firmware bug that did miscompute the buffer size for RAW10 at one point, resulting in the image getting truncated. raspiraw would think it knew the parameters for the header and generate it accordingly, and therefore dcraw would see a short file.

I've just run it with the latest firmware (technically a development, so latest and a bit) with an imx219 in mode 7, and I get 416768 byte files, which is 407kB, so I suggest you check that your firmware is up to date. "vcgencmd version".
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

fsxskillz
Posts: 11
Joined: Fri Jun 08, 2018 2:55 pm

Re: raspiraw different output after raspberry update

Thu Jun 13, 2019 12:33 pm

Good guess, it was indeed the firmware. I did a rpi-update and launched the function and the output was 407 kB.

It's still incomprehensible for me, why does something unchanged won't work after an amount of time while the same thing was working before.

Thank you very much anyway.

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

Re: raspiraw different output after raspberry update

Thu Jun 13, 2019 12:38 pm

fsxskillz wrote:
Thu Jun 13, 2019 12:33 pm
Good guess, it was indeed the firmware. I did a rpi-update and launched the function and the output was 407 kB.

It's still incomprehensible for me, why does something unchanged won't work after an amount of time while the same thing was working before.

Thank you very much anyway.
Software is software, and modern systems are so complex it's often difficult/impossible to know all the interactions that are going on.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Return to “Camera board”