Magic Lantern Forum

Using Magic Lantern => Raw Video => Topic started by: Milk and Coffee on June 02, 2020, 09:51:21 PM

Title: How to check if a .DNG is really raw data
Post by: Milk and Coffee on June 02, 2020, 09:51:21 PM
I've received a .DNG sequence from a coworker, and the files are incredibly small (like 200kb-ish a frame.) My suspicion is that they exported a .JPG sequence, and then converted the .JPG's to .DNG (which apparently you can do that???)

How can I check if a .DNG is really raw data? Can I open in a text editor? Is there a utility that makes it easy?

Thanks all!
Title: Re: How to check if a .DNG is really raw data
Post by: Walter Schulz on June 02, 2020, 09:56:56 PM
Let me suggest a non-technical approach: Ask your coworker to deliver unaltered raw footage instead of DNG.
Title: Re: How to check if a .DNG is really raw data
Post by: Milk and Coffee on June 02, 2020, 10:06:41 PM
Thanks Walter. I already did that. Can you provide a technical approach?
Title: Re: How to check if a .DNG is really raw data
Post by: names_are_hard on June 02, 2020, 10:12:19 PM
What OS?  If Linux or Mac, run "file" over the file.  Test with a known JPG and DNG, the output should be consistent and different.
Title: Re: How to check if a .DNG is really raw data
Post by: yourboylloyd on June 02, 2020, 11:17:07 PM
Just open it in Adobe camera Raw (maybe phortoshop, lightroom, or after effects) and try to color grade it. Push the highlights all the way down and shadows all the way up. A real RAW image would still hold up. An 8bit image would turn grey
Title: Re: How to check if a .DNG is really raw data
Post by: Walter Schulz on June 02, 2020, 11:51:35 PM
@yourboylloyd: Can you provide some samples/screenshots showing the difference?
What happens if they messed up and converted raw to 8 bit dng or converted to 8 bit somewhere else in post and stored it as 16 bit dng after?
He gave not the slightest hint about pp...

Forensic with this kind of info?
Title: Re: How to check if a .DNG is really raw data
Post by: mothaibaphoto on June 03, 2020, 04:23:38 AM
https://www.rawdigger.com/download
You can see absolute pixel values of every channel.
No need to buy/activate for that.
Title: Re: How to check if a .DNG is really raw data
Post by: Luther on June 03, 2020, 04:24:45 AM
Use Rawtherapee (https://rawtherapee.com/). On the demosaicing menu, choose "bayer". If it is a raw image, you will see the bayer pattern (mozaic of RGGB). This is the easiest way.
But for the images to be 200kb, someone probably made lossy compression on those files.
Title: Re: How to check if a .DNG is really raw data
Post by: Milk and Coffee on June 03, 2020, 06:52:55 AM
Thanks all! I'll try a few of those suggestions! Is there no way to open in a text editor Or something and view the code that would reveal it to be raw data?
Title: Re: How to check if a .DNG is really raw data
Post by: Danne on June 03, 2020, 07:37:31 AM
Use exiftool or what has already been recommended.
Dng can be lossless raw or even some lossy jpg turned into dng. Too bad you don't take the time to share samples.
Title: Re: How to check if a .DNG is really raw data
Post by: Milk and Coffee on June 28, 2020, 08:24:38 PM
Quote from: Danne on June 03, 2020, 07:37:31 AM
Use exiftool or what has already been recommended.
Dng can be lossless raw or even some lossy jpg turned into dng. Too bad you don't take the time to share samples.

Sorry about the late reply! Here is a frame from that sequence!
https://www.mediafire.com/view/ve4pxi7gbd1wtra/M24-2054_1_2020-06-24_0001_C0000_000155.dng/file (https://www.mediafire.com/view/ve4pxi7gbd1wtra/M24-2054_1_2020-06-24_0001_C0000_000155.dng/file)
Title: Re: How to check if a .DNG is really raw data
Post by: names_are_hard on June 28, 2020, 10:14:50 PM
Here's the output from running "file":
M24-2054_1_2020-06-24_0001_C0000_000155.dng: TIFF image data, little-endian, direntries=43, height=144, bps=530, compression=JPEG, PhotometricIntepretation=YCbCr, orientation=upper-left, width=256

So I say that's JPEG inside TIFF.  Would need to see another suspected good frame to be sure the other kinds of DNG get detected sensibly as well.
Title: Re: How to check if a .DNG is really raw data
Post by: Danne on June 28, 2020, 10:57:29 PM
Image Width                     : 1880
Image Height                    : 1056
Bits Per Sample                 : 8 8 8
Compression                     : Lossy JPEG

Looks quite good despite compression. What was it filmed with from the beginning?
Title: Re: How to check if a .DNG is really raw data
Post by: reddeercity on June 29, 2020, 12:47:13 AM
Interesting , Looks like sRaw compression on 5d2
Active Area                     : 0 0 1056 1880
Y Cb Cr Coefficients            : 0.299 0.587 0.114
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Y Cb Cr Positioning             : Co-sited


This a great read & explains the compression in detail Subsampling.pdf (http://dougkerr.net/Pumpkin/articles/Subsampling.pdf)

from the above pdf file
(https://i.ibb.co/HFHVXQd/jpeg-compression-subsampling.png) (https://ibb.co/zn4rNwJ)

History Parameters  : converted from image/jpeg to image/dng, saved to new location
Didn't know you could do that
Title: Re: How to check if a .DNG is really raw data
Post by: Milk and Coffee on June 29, 2020, 02:11:15 AM
So I asked my coworker what his original workflow was. Originally, I asked him to deliver a DNG sequence. He exported a JPG sequence with adjustments from ACR because he felt the DNG's looked "dark." (Probably because the DNG's are previewed in linear gamma on mac?) He then batch converted the adjusted JPGs back to DNG. (He obviously doesn't know the benefits of RAW)

I hate that DNGs can hold raster images. Now ill be skeptical if I'm receiving RAW data or not. :-\

Anyway, after some talking I asked for the original DNG sequence. Below is the original RAW DNG from Canon 5D2. (File size is larger, but still 740kb.)
https://www.mediafire.com/view/lzsxznzy1aq8fjy/M24-2054_1_2020-06-24_0001_C0000_000155.dng/file (https://www.mediafire.com/view/lzsxznzy1aq8fjy/M24-2054_1_2020-06-24_0001_C0000_000155.dng/file)

Title: Re: How to check if a .DNG is really raw data
Post by: names_are_hard on June 29, 2020, 02:44:50 AM
Output from file for both:

M24-2054_1_2020-06-24_0001_C0000_000155.dng: TIFF image data, little-endian, direntries=43, height=144, bps=530, compression=JPEG, PhotometricIntepretation=YCbCr, orientation=upper-left, width=256
M24-2054_1_2020-06-24_0001_C0000_000155(2).dng: TIFF image data, little-endian, direntries=41, height=1056, bps=10, compression=JPEG, PhotometricIntepretation=(unknown=0x8023), manufacturer=Canon, model=Canon EOS 5D Mark II, orientation=upper-left, width=1880

It thinks they're both JPEG which feels weird.  That made me check with exiftool, which says one is "Lossy JPEG" and one is "JPEG".  Possibly jpeg2000?  I'd forgotten, but that does have a lossless mode.
Title: Re: How to check if a .DNG is really raw data
Post by: Milk and Coffee on June 30, 2020, 12:40:34 AM
That is weird! Doesn't ML use a JPEG compression method for making lossless RAW? Is MLV App using it too for lossless DNG? I see that when I open both in ACR, the "JPEG DNG" doesn't show Adobe's RAW profiles in the drop down. Whereas, the second DNG I posted (should be real RAW) DOES have Adobe's RAW profiles available.
Title: Re: How to check if a .DNG is really raw data
Post by: names_are_hard on June 30, 2020, 02:52:01 AM
Don't know.  DNG uses TIFF/EP, and TIFF/EP supports lossless JPEG, lossy JPEG and other lossless formats.  I couldn't be bothered spending the time to manually analyse the sample file to dig deeper.  It's an open format so if you want to, go ahead :)
Title: Re: How to check if a .DNG is really raw data
Post by: masc on June 30, 2020, 09:05:03 AM
Quote from: Milk and Coffee on June 30, 2020, 12:40:34 AM
Doesn't ML use a JPEG compression method for making lossless RAW? Is MLV App using it too for lossless DNG?
MLVApp uses LJ92 library for lossless footage.
Title: Re: How to check if a .DNG is really raw data
Post by: Milk and Coffee on July 01, 2020, 02:18:34 AM
Thank you masc! Then I would suspect that's why exif is showing JPEG for both.
Title: Re: How to check if a .DNG is really raw data
Post by: names_are_hard on July 01, 2020, 02:48:43 AM
https://thndl.com/how-dng-compresses-raw-data-with-lossless-jpeg92.html