-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canon CR3 support. #236
Comments
Oh! Something new to be supported. As a retired Adobe Engineer I think "Why don't they all use DNG?" One standard's enough! With my Exiv2/opensource hat, "Why doesn't Canon contribute to Exiv2 to support their new standard?". If you're willing to get involved, Team Exiv2 will support and mentor. Our existing commitments make CR3 very unlikely to get attention in 2018. |
Tell me about it :)
Should they do that, make sure they get me/rawspeed a spec of the actual image compression algo they used :)
We'll see. Certainly not before the rawspeed part is done and working. |
Why are you worried about #214? I want to continue to support C++98 and add C++11/14 on top. The team want to dump C++98 support. What is your opinion? |
I'm not worried, i'm not working on that code :) |
So we can use any technology in the library and offer an API that can be used by C++98 (or C++11/14/17) application code. One of the goals in v0.27 is to try to establish a "v1.0 API". Something like: "We hope the API for v0.27 will be the API for v1.0 and we will try to avoid changes to the API for v0.28". If the API for v0.28 is identical to v0.27, we will call it v1.0. This is a very useful conversation. We're having a Exiv2 Team Meeting at my home in England on the weekend of Saturday May 5 and we will discuss this topic (and many others). You (and any of your open-source friends) are welcome. #225. It won't be all work, it's a social/team-building weekend and partners will also attend. |
There are sample images available here: http://www.photographyblog.com/reviews/canon_eos_m50_review/preview_images
I can see an embedded tiffs (exif metadata) at 296 and 688:
And can extract them:
Here's the XMP:
This project doesn't look painful. We'll have to write an image handler cr3image.cpp which will:
It's probably similar to src/cr2image.cpp which is 231 lines of code. |
I've made some progress with this. I've looked at a couple of libraries for ISO BMFF support. I've the (Mac Only) ISOBMFF Explorer useful to understand those files: https://imazing.com/isobmff/download I've discovered a one-file project which dumps ISO BMFF files. This looks like a great starting point and I've invited the author to join team Exiv2: pyke369/isobmffdump#1 Here's output from the canon CR3 file:
The uuid box at 32 is the Canon magic. I don't know how to decode it at the moment. The uuid box at 28464 is the XMP metadata and uses the same UUID as jp2image.cpp
There's another uuid box at 94024. I don't know what that is yet. It's not Iptc:
|
I've raised a discussion thread on Pixls.us to see if somebody knows the specification for those unidentified uuid box structures. https://discuss.pixls.us/t/new-canon-cr3-file-specification/6881 As I've mentioned in on Pixls.us, I have a (retired) Canon friend who may be able to help. Canon is a huge company and it's likely that my friend will have no contacts with digital camera software engineering. |
I too was able to make progress. It's strange, those raws are demosaiced already :/ |
Good News. I don't think this is going to be very difficult. The file is ISO BMFF format. Almost all the data in the file is in the MDAT (which I thought was intended for audio/music). I thought ISO BMFF was intended for video. Confused? (I'm easily confused). I confirm that the MDAT "appears" to be a plain 38mb JPEG 4000x6000 pixels.
This comment is relevant: darktable-org/rawspeed#121 (comment) From Exiv2's point of view, the MDAT previews are interesting. The Exif (and IPTC) metadata is almost certainly in the Canon uuid box near the top of the file. We have already identified the uuid box with the XMP metadata. So, we're making good progress. |
As per darktable-org/rawspeed#121 (comment), what you are looking at, is the largest embedded thumbnail, which exiv2 should ideally be able to provide via the usual means.
The second one is also a thumbnail, likely. |
Progress with decoding the Canon uuid box. It's a linked list of records:
I can extract the uuid with this: (24 = 16 bytes for the UUID + 8 bytes for the UUID marker)
I've written a utility dumper.cpp (code below):
CTM1,2,3,4 looks like tiffs. Exif metadata probably. Why 4? Don't know yet.
|
Well, we do have 3 actual Streams in the mdat, so one per each of those + one general IFD? |
Good Morning, Roman. Hope the weather's warmer for you this week. I'm going to leave you to investigate the MDAT because I believe it's a JPEG with no metadata. I don't see an IFD in the MDAT. If you know how to locate that, I'll investigate that after I understand the moov/uuid. And we've already identified the XMP. I'm focused on the Canon uuid box in the moov. I've run out of time for today. I hope tomorrow morning to know enough to read the metadata. |
(I was talking about the fact that the CR3 |
Thanks, Roman. We'll figure this puzzle. 4 trak boxes. Yes - that's right. Last discovery for Monday morning before I get on with what I should be doing! The THMB record contains a JPEG 120x160 thumbnail. It's 20 bytes into the record. Why 20? 4 for THMB followed by 16 bytes. For extracting thumbnails, we never need to know. Exiv2 has never been able to edit thumbnails. Exiv2 can relocate THMB in the file as a binary blob.
|
Phil Harvey (ExifTool) knows about .CR3 files:
There is also helpful document. See "Canon uuid Tags" on this page: https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html
|
I think I've got a good understanding about the scope of this project. We're having a team meeting in May #225 when we'll discuss the specification and schedule for v0.27. |
I've written code to search for tiff structures in a binary file. It's "simple minded" and only searches for the pattern
Here's the code:
|
In mdat, to be more accurate, there are IFDs, that are parsed by ExifTool 10.82 |
Here's a snippet from the -verbose out from ExifTool.
CTMD (SubDirectory) -->
|
@lclevy @LebedevRI Thanks Guys. I'm mistaken. There is a valid tiff in the mdat. I still don't have a complete understanding of how all the data is organised in CR3, however we're making good progress. And I'm enjoying working with you both. Thanks. |
The CTMD type 1, 4 and 5 directories contain timestamp, focal-length and exposure information respectively. ExifTool 10.87 will decode these too. I still don't know about type 3 though. |
Hi Phil,
Thanks for the info.
I have made progress on the craw proprietary format, and found cr3 support in dpp 4.8.20.
Kind regards
Laurent
Envoyé par Blue
Le 19 mars 2018 à 16:08, à 16:08, Phil Harvey <notifications@github.com> a écrit:
…The CTMD type 1, 4 and 5 directories contain timestamp, focal-length
and exposure information respectively. ExifTool 10.87 will decode
these too. I still don't know about type 3 though.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#236 (comment)
|
Could you share your code please, Laurent? I was working on my decoder (tiffs.cpp) on Friday and will publish a new version here later this week. #236 |
Is there a specification? As you are well aware, i'm kinda working on it in darktable-org/rawspeed#121 |
dpp 4.8.20 from Canon Asia = http://support-th.canon-asia.com/contents/TH/EN/0200544802.html I haven't downloaded this. Looks like an executable binary. |
LibRaw released a snapshot yesterday with CR3 support, and now this is the blocker for Filmulator supporting .CR3 cameras. Is there any way I can help out? |
@clanmills Can you provide some guidance for those who I'd like to try to implement this? A plan/outline? Note that @CarVac asks if they can help. |
Mark. I have retired from Exiv2. However, I admire your enthusiasm for this task and I had hoped that I would get to this before I retired. So I'm happy to mentor you and @CarVac Can we discuss this by email: robin@clanmills.com When you're ready to submit a PR, you can summarise the implementation for several reasons:
When would you like to start? |
@CarVac would you like to give it a go or should I try to dig it? If C++ is fresh in your head and most importantly if you have the time you may be a better fit for this. |
I'm fresh on C++ but I'm in the process of moving so I can't do it right now. But I really would like to follow along in the process (in whatever email conversations you have). |
I know the Exiv2/C++ code very well. I downloaded the LibRaw code a couple of months ago at the suggestion of @lclevy. However I was pushing hard to release Exiv2 v0.27.3 at that time and didn't look at it. I'll look in the next few days. I have gardening project going on this week and, as I'm paying people to work with me, I need to deal with that first. I should have time to work on this next week. It would be helpful if @CarVac could let us know about his skills, knowledge of C++, LibRaw, Exiv2, .CR3 - or anything that he thinks will be useful. |
@CarVac I don't think this is a task for somebody "fresh on C++", however you could help with testing. Do you know Python3? |
I meant "fresh" as in it's fresh in my mind. I write Filmulator (https://github.com/CarVac/filmulator-gui) in C++, and it's basically the way I learned the language. By contrast, I don't really know Python at all anymore; I learned back on 2.7 and haven't used it since. My main skill in programming is working memory: given familiarity, I can grasp a very large amount of a codebase. I know basically nothing about the inner workings of Exiv2 or CR3, and only a slight amount about the structure of LibRaw. But I definitely want to learn; part of this is so that I can better understand how to approach handling EXIF in Filmulator, which uses the crudest possible method of "copy all the exif from the raw to the output file". |
@clanmills A well-deserved break. The effort that you put into this project is impressive. |
I think the basic idea would be to to look at exiftool, libraw and the python script mentioned above, extract the difference to CR2 and implement that, ideally deriving (either spiritually or C++-wise) from the CR2 parser. I have no idea how similar they are, if Canon has some common sense, they hopefully are. |
The overall structure of a CR3 is completely different than CR2. It is based on the QuickTime file format (MOV/MP4), not the TIFF format. So you should start from a MOV/MP4 parser. |
@CarVac I just pushed a parse_cr3.py update that parses ... CR2 too. Maybe I should rename it to parse_cr23.py :-) |
Oh. Awesome...maybe one could even throw a HEIF parser at it? |
Exactly. The format and challenges are the same as for HEIC (although metadata is stored in different locations). That is why the ability to write CR3 and HEIC was released in the same ExifTool update. |
and Canon 1D Marx III will produce 10 bits HEIC: https://www.dpreview.com/interviews/6888036612/canon-interview-eos-1d-x-mark-iii-2019 |
For parsing arbitrary ISOMP4 containers, you might want to have a look at https://github.com/DigiDNA/ISOBMFF - It's the successor of MP4Parse which had really nice C++ API and is MIT licensed. |
gah. though its Linux build system is sh*t |
@phako, thanks for the ISOBMFF link. I experimented with it, and it looks it ISOBMFF doesn't see the specific container that holds EXIF metadata inside CR3. |
@VioletGiraffe its normal, containers cmt1, ... Cmt4 and ctmd are specific to Canon https://github.com/lclevy/canon_cr3/blob/master/readme.md |
Yes, I was going by that exact description. |
Canon is the second company after IBM by the number of patent filed each year. But it is not because they own the intellectual property that they will sue people. They were tolerant for example about Magic Lantern team, which is a "camera jailbreak". But they can |
Here's the summary of the Sunday's meeting on Zoom. #318 (comment) |
Topic: Support for ISOBMFF Files (AVIF, HEIF, CR3) Join Zoom Meeting Zoom Video 1 Join our Cloud HD Video Meeting 1 Zoom is the leader in modern enterprise video communications, with an easy, reliable cloud platform for video and audio conferencing, chat, and webinars across mobile, desktop, and room systems. Zoom Rooms is the original software-based conference... Agenda: |
Shipped in v0.27.4 RC1. |
Just thought i file the meta-bug.
I'm investigating that new raw format from the point-of-view of the raw image decoding in RawSpeed library in darktable-org/rawspeed#121.
Right now exiv2 (0.25 001900) knows nothing about it.
It should eventually have the same support as for the usual CR2:
The text was updated successfully, but these errors were encountered: