Magic Lantern Forum

Using Magic Lantern => Raw Video => Topic started by: xiga on March 17, 2016, 10:39:51 PM

Title: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 17, 2016, 10:39:51 PM
Hi guys

I've encountered something strange
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 17, 2016, 11:14:56 PM
Arghhh, that wasn't supposed to post already. I was trying to find out how to attach files (sigh)

Anyways, the issue i've encountered is that when i take a Raw Video on my 60D and compare it to a normal .MOV file taken from exactly the same position without moving the camera, the framing is different between the two. The Raw video seems to capture a little lower and to the left compared to the .MOV file.
I intend on using the camera to take some videos of the moon in Movie Crop Mode (to get 1:1 pixel resolution) and to then do a mosaic to stitch it all together. For this purpose all i need is for the camera to capture 45 or secs in 640x480 ML mode at 50fps and it's able to do this just fine, so all is good in this respect.
I am using the latest nightly build and am using MVLMystic to extract the images and they look fine when doing so, it's just the framing that seems to be the issue.

The reason this is a problem, is that i need to use the camera's screen to visualise exactly what i'm capturing, so that i can move on to capturing the next frame. I've tested it, and the in-built camera .MOV video matches exactly with what is shown on the camera screen, but the Raw video does not, so it makes it much more difficult for me to know what exaclt i've captured and where i need to go next.

Can anyone help me with this please?

ps - I have 2 still images from the .MOV and .DNG (raw) videos i'd like to upload, but i'm not sure how. I feel like a total noob here, can anyone explain how i can upload these please?

Cheers!
Title: Re: Raw Video framing is different to Camera's in-built video mode. Help!
Post by: dfort on March 18, 2016, 01:59:00 AM
First of all did you know that you can edit your own posts? There should be an icon at the top right and bottom right of each of your posts, the one on the top says "Modify." You can also Preview your posts before posting them, useful when adding images and videos.

To post pictures and videos you need to use sites like flickr.com and YouTube.com or Vimeo.com. copy and paste the url of the picture/video. Note that for YouTube you need to change the https to http and for flickr you just need what's between the [img] tags, including the tags. To share larger files like DNG, MLV, RAW, use a service like dropbox.com or Google Drive and post the sharing link.

As far as your dilema with the centering, it looks like the 60D doesn't have the CROP_MODE_HACK so you need to zoom in with the magnifying glass button. Chances are that your zoom box isn't exactly centered. You should find out how to center it. On some cameras the trash button does it, on others it is the set button. I'm not sure what it is on the 60D. However, even with the zoom box centered there's a chance that it isn't quite the same in raw as it is with H.264. The best way to get precise framing is to shoot tests and add your own crop marks. You can do this with Magic Lantern but I prefer the lo-tech method of marking the screen with thin striping tape or even a grease pencil. To get the raw image on your screen load the mlv_play module to playback in camera. It won't play real time but it is good enough to check your framing.

Hope this helps.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 18, 2016, 03:51:28 AM
First off, thank you very much dfort, that was very helpful! :-)

Here are the two files in question, .MOV first, and Raw second:

https://onedrive.live.com/redir?resid=C14ECDF7700B5618!2472&authkey=!ADBztVRh_vg6pE4&v=3&ithint=photo%2cjpg

https://onedrive.live.com/redir?resid=C14ECDF7700B5618!2471&authkey=!AF0w6LTlMty8UzU&v=3&ithint=photo%2cjpg

(i tried using the Insert Image and Hyperlink buttons, and inserting the links between and hitting Preview, but i still couldn't see the images in the Preview, so hopefully the lins above work ok).

So from what you are saying, it sounds like i need to centre my zoom box. I don't mind if it's not 100% accurate, just as long as it's close enough.
Can you elaborate please on how to go about editing the zoom box setting (permanently) so that it matches up with the H.264 files? The trash can button only brings up the ML menu, and the Set button doesn't seem to do anything while waiting to capture.
Surely there has to be a better way than me having to mark the screen in two corners where the capture actually starts (and consequently have to guess where it ends in the other two). Is this not a common thing others have had to deal with? And what is this CROP_MODE_HACK you mention, does it not exist for the 60D?

ps - sorry for all the questions!
Title: Re: Raw Video framing is different to Camera's in-built video mode. Help!
Post by: Walter Schulz on March 18, 2016, 06:03:50 AM
CROP_MODE_HACK enables some cams to use Canon's H.264 crop mode as implemented in 600D. For those cams you will find an additional menu item "Crop mode" in Movie tab: 650D/700D/EOS M.
Title: Re: Raw Video framing is different to Camera's in-built video mode. Help!
Post by: dmilligan on March 18, 2016, 04:38:53 PM
Have you tried recording raw using mv640crop (640 crop mode setting in the Canon menu)?
Title: Re: Raw Video framing is different to Camera's in-built video mode. Help!
Post by: dfort on March 18, 2016, 06:57:37 PM
I made an animated gif of your images to illustrate the issue.

(https://farm2.staticflickr.com/1475/25258157983_74f16cd6c1_o.gif)

So these were done in by zooming in and recording an MLV and a H.264. Assuming that you didn't touch anything that might have moved the crop area?

To move the zoom area on the 60D look at page 167 of the manual. The Trash button centers the magnifying frame which is of course the same button that brings up the Magic Lantern menu. This is the same as on the 100D and I have ask the developer for a feature request to make it behave like the EOSM where a quick press centers the frame and a longer press brings up the ML menu. In any case, the work around for this is to remove the card, turn on the camera and press the Trash button to center the magnifying frame. It should remain in that position when you power up with the card. This isn't permanent because pressing the select wheel will move the magnifying frame.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 18, 2016, 09:09:09 PM
Thank you dfort, i was about to upload the images to Flickr to make them easier to view, but your animated Gif is much better!  :)

Both of these were taken using the 640x480 Movie Crop Mode in the Canon menu. This is the only mode i am interested in, as it gives me an effective Crop Factor of over x7 and perfect 1:1 pixel resolution, which means i can get in real close for the planets and the moon without losing any detail (as would be the case if i chose any other video mode in the Canon menu). I know not a lot of camera models have this mode, and probably very few people here on the forums actually use it for raw video, so i admit i may be in a minority here, which probably doesn't help me!
For the raw one, i simply chose 640x480 as my resolution in the ML menu, so as to not mess with the pixel scale, however as you can see the Raw video doesn't seem to be centred at the same spot as the Canon video when using the Movie Crop Mode.
I don't have a tripod so when i took these i just made sure i did not move the camera at all between shots. I took another couple of shots today, and i think i did a better job of not moving the camera. When i compared the 2 in Photoshop, it appears that the Raw capture is about 5 pixels lower and 70 pixels to the left.

ps - I now don't think this has anything to do with centering the zoom box. I started the camera without the SD card and checked where the zoom box was and it seemed to be dead centre, as pressing the Trash Can button didn't make it move. Also, when using Movie Crop Mode you can't actually zoom in using the magnifying glass, the camera gives you a message saying it's not possible in this mode, so i don't think the zoom box is the answer. Is it possible it could just be down to the ML code not allowing for the exact sensor position when using Movie Crop Mode?
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dmilligan on March 18, 2016, 11:56:07 PM
If you try what I said, you're problem will go away.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 19, 2016, 01:28:37 AM
Hi dmilligan

Perhaps I wasn't being clear. I am already using the 640x480 Crop Mode in the Canon Menu (it's the one at the bottom). For the purpose of what I'm trying to do, this is the only mode I need.
The problem is that when using this mode the Raw video framing doesn't match the H.264 version.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dmilligan on March 19, 2016, 02:28:36 AM
Ok, dfort's comments made me think you were recording "crop zoom", but you are not, so his suggestions are irrelevant, there is no zoom box to move around, you're not in "crop zoom" (mv1080crop) mode.

The actual raw buffer is slightly larger than than the area recorded by Canon's H.264. ML probably just records a slightly different portion of this area than does the Canon code (ML probably just centers the crop, or uses some heuristic that matches Canon in other more common video modes, and Canon may have it somewhere else, off center). I doubt a lot of people use this video mode for raw video, esp. considering most cameras don't even have this mode, so it' probably just never been noticed before.

You have a couple of options:
Just record the full raw buffer with ML, it's slightly larger than 640x480, just pick the largest resolution in the ML menu that ML will allow. You'll at least get everything you seen on the screen (plus a little bit more).

Figure out the exact location that Canon is using and update ML to crop from this offset when in mv640crop. The best way to do this would be to shoot a silent DNG in this mode (so you get the full buffer) with a tripod of some sort of grid or resolution chart, and then shoot H.264 of the same setup.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 19, 2016, 03:30:53 AM
Thanks for this dmilligan.

Yeah i also suspected this might be something that just hasn't been noticed up until now, due to the unusual nature of it :/

The problem with option 1, is that it will lead to shorter captures. At present, if i choose 640x480 at 48fps in the ML menu, then i can get 54 secs of continuous video (note, as high an FPS as possible is critical for what i am doing. I'd ideally like 60, but 48 seems to be the sweet spot). This gives me enough frames to then stack the best 10% for each panel of the mosaic. If i choose a higher resolution, it will only cut down on the length of video i can record.

Option 2 sounds interesting. I know nothing about editing ML code, and you kind of lost me on the whole silent DNG thing lol, but i do reckon the offset when shooting Raw in the Movie Crop Mode is in the region of 5 pixels down and 70 pixels left (give or take), so if there's some way to easily copy these numbers into a line of code somewhere then i'm more than willing to give it a bash, with a little help of course  ;)
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dmilligan on March 19, 2016, 06:12:17 AM
the relevant code in raw_rec.c:line 268:
Code: [Select]
static void update_cropping_offsets()
{
    int sx = raw_info.active_area.x1 + (max_res_x - res_x) / 2;
    int sy = raw_info.active_area.y1 + (max_res_y - res_y) / 2;

    if (FRAMING_PANNING)
    {
        sx += frame_offset_x;
        sy += frame_offset_y;
    }
    else if (FRAMING_CENTER && lv_dispsize > 1)
    {
        /* try to center the recording window on the YUV frame */
        int delta_x, delta_y;
        int ok = focus_box_get_raw_crop_offset(&delta_x, &delta_y);
        if (ok)
        {
            sx = COERCE(sx - delta_x, raw_info.active_area.x1, raw_info.active_area.x2 - res_x);
            sy = COERCE(sy - delta_y, raw_info.active_area.y1, raw_info.active_area.y2 - res_y);
        }
    }

    skip_x = sx;
    skip_y = sy;
   
    refresh_cropmarks();
}
(there's similar code in mlv_rec)

Basically you'll need to add an extra case in there for mv640 crop and adjust skip_x and skip_y accordingly.

Here's how to figure out if you're in mv640crop:
Code: [Select]
    int mv640crop = is_movie_mode() && video_mode_resolution == 2 && video_mode_crop;
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on March 19, 2016, 06:25:26 AM
Ok--I was way off, I thought you were using zoom mode. I don't have any experience at all with mv640 or mv640crop video modes. Like dmilligan said, most cameras don't even have this mode. By the way, the various raw video modes are described in the Magic Lantern source code in src/raw.c, lines 433-440.

I made up this chart when working on a project that also involved finding out what was going on with raw buffers. Sort of rough but it did the job.

(https://farm2.staticflickr.com/1534/24584068572_3dea4e45bc_z.jpg)

Silent DNG (or MLV) involves loading the silent.mo module and turning on Silent Picture in the Shoot menu. Now it may sound counter intuitive but if you setup your camera to shoot H.264 or raw video that also affects the settings of the Silent Picture when set in the "Simple" setting mode. Taking a Silent Picture involves doing a half shutter press while in movie mode--of course not at the same time as you're shooting a movie. The silent picture will capture the entire buffer area, the movie will be a cropped area of that raw buffer.

I'm not sure how to capture the full buffer at 48fps in option 1 but to find out what the crop is on option 2 superimpose, in a Photoshop or Gimp layers, a frame of your H.264 movie over the Simple Silent Picture. Find where the upper left corner of the H.264 is at in pixels and that is your panX and panY coordinates. Now take an MLV file with the same settings and run it through mlv_dump using the -m and -v options and you will be able to see the panX and panY information, it looks like this:

Code: [Select]
     Pan: 296x247

I'm not sure where you can adjust it but taking another look at raw.c might give some clues:

Code: [Select]
        /**
         * The RAW file has unused areas, usually black; we need to skip them.
         *
         * To find the skip values, start with 0,
         * load the RAW in your favorite photo editor (e.g. ufraw+gimp),
         * then find the usable area, read the coords and plug the skip values here.
         *
         * Try to use even offsets only, otherwise the colors will be screwed up.
         */
---------------------------
        #ifdef CONFIG_60D
        #warning FIXME: are these values correct for 720p and crop modes?
        skip_top    = 26;
        skip_left   = zoom ? 0 : 152;
        skip_right  = zoom ? 0 : 2;
        #endif

Hope this answered some of your questions--or maybe it created some more questions?

By the way, what is it that you are doing with the moon? Making an image stack to increase resolution? (Click on image to link to the post.)

(https://farm6.staticflickr.com/5557/14998599357_199c595b2a_o.jpg) (http://magiclantern.fm/forum/index.php?topic=15621.msg152060#msg152060)

One last tip--dmilligan is going to push you past your comfort zone but the pay off is worth it.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 19, 2016, 04:44:45 PM
Thanks for your help with this guys, although i'm going to have to hold my hands up and say that i'm in way over my head here in terms of compiling code. I thought it was just going to be a case of editing a few text files, but it looks like there is a lot more to it than that.

Given i already have an idea of the offset in terms of pixels (the Raw video needs to be about 5 pixels Up and 70 pixels Right) is it possible some kind person could do a quick update for raw_rec and mlv_rec for me to test out?
Or alternatively just bring this issue to the attention of a dev so they could look in to this?

Either way, i'm happy to test out any new builds to see if we can nail the crop mode framing closer than it currently is.

ps - The post above describes pretty well the outcome i'm trying to get to (although i'm hoping for better resolution). The idea is that each individual video will be used to create a stack from which i will only take the best 10%. This shoul dgive me over 200 frames to use for each pane, which should be enough to keep the noise down. I will then need to stitch them all together for the final mosaic, so that when one zooms in on the image it keeps all the detail and resolution, rather than breaking down as is normally the case.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on March 20, 2016, 03:05:31 AM
I'm looking at the code dmilligan pointed out in raw_rec.c and mlv_rec.c but I'm not sure the proper way to adjust for your 5 pixels Up and 70 pixels Right. If you could shoot a Simple Silent DNG with your camera in the movie mode you're planning to use we can take a look and see if the values in the code snippet that I posted from raw.c are correct. a1ex posted those warning in this commit: https://bitbucket.org/hudson/magic-lantern/commits/233c07fde193dcce4b616e1eafcbc7543e9d78b6 It won't hurt to check it out.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 21, 2016, 05:11:28 PM
Okay i took a few more shots today.

First, the Silent DNG:
(https://farm2.staticflickr.com/1551/25963316365_336289df41_b.jpg) (https://flic.kr/p/FyhMpB)Silent (https://flic.kr/p/FyhMpB)

And here is the H.264 one:
(https://farm2.staticflickr.com/1658/25334608443_538c1387e7_z.jpg) (https://flic.kr/p/EAJurR)Mov (https://flic.kr/p/EAJurR)

And just in case it's needed, here is a still from the Raw video as well:
(https://farm2.staticflickr.com/1448/25868368001_bf780038a9_z.jpg) (https://flic.kr/p/FpU9yR)Raw (https://flic.kr/p/FpU9yR)

I overlaid the H.264 image on top of the Silent DNG one in Photoshop and lined them up as closely as i could, and the top left corner of the H.264 one was at position X=124, Y=51.

Hopefully this information will help, but let me know if i need to post up anything else.

Cheers!
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: a1ex on March 21, 2016, 05:25:55 PM
Can you upload the silent DNG, so we can check the skip offsets? However, since you've got a usable image without black borders, they are probably correct (or almost correct).

If you overlap the H.264 image on the silent DNG, you can see Canon does not record the center on the raw buffer as H.264. Thing is, ML has no way to know about this quirk.

However, the solution is now obvious. Just use the digital dolly feature to move the recorded area to the far right.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 22, 2016, 01:55:36 AM
Here is a link to the Silent.DNG:

https://onedrive.live.com/redir?resid=C14ECDF7700B5618!2504&authkey=!AF7IRSm17GWjjC8&ithint=file%2cDNG

I have had a play with the Digital Dolly feature, but unfortunately i don't think it's going to help.  :(
Once i turned it on, i was able to see a rectangle that took up almost all of the screen, and i was able to move it around using the direction buttons. And sure enough, it did actually have an effect on the resulting Raw video. The problems however, are that:

1) there is no fine control. I had to press the direction twice in a row for it to move (and then quickly in the opposite direction to stop it moving), and even then it moves way too fast and also in really large increments.
2) there was definitely enough travel in the up and down directions to match the H.264 file vertically, but nowhere near enough horizontally. I could only move it a very small amount to the right, so not enough to correct for the Raw video being shifted too far to the left.
3) wherever i moved it to, it would always reset back to it's original position on each reboot. So not much good for achieveing consistent, repeatable results.

So does this just leave us with the option of editing the code to allow for offsets in some way?

ps - i will be taking some more Silent.DNG's, one in each of the Canon video modes (including one in 1080p and x5 zoom) and will post them up, in the hope we might be able to get to the bottom of this.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: a1ex on March 22, 2016, 02:27:59 PM
Sorry, can't try it myself right now, but for repeatable results, all you should have to do is to press the right arrow and let it go to the far right position. That's all.

Can you attach a raw still screenshot with the digital dolly moved to the far right, and compare it with the silent picture screenshot and to the H.264 one?
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 22, 2016, 05:51:42 PM
As per dfort's request, here is a link to some Silent DNGs and their corresponding MLV files:

https://onedrive.live.com/redir?resid=C14ECDF7700B5618!2511&authkey=!AK_HoDSjL9HYWds&ithint=folder%2cDNG

In the folder are Silent DNG's and MLV files for each of the following:

1080p 30fps (Canon menu)___the highest reolution ML would let me choose was 1728 x 1156
720p 60fps (Canon menu)___the closest i could get to 720p in ML was 1280 x 694
640x480 60fps (Canon menu)___640x480 resolution chosen in ML
640x480 Movie Crop Mode (Canon menu)___640x480 resolution chosen in ML
1080p 30fps (Canon menu)___this time with x5 Zoom applied, again the highest resolution ML would let me choose was 1728 x 1156

Hopefully these will prove useful.

a1ex, i don't have any still at hand with the digital dolly moved to the far right, nor the H.264 one. I will try again either later tonight or tomorrow morning, but i can say for sure that there is hardly any 'leg room' to move it right, certainly not enough for the correction.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: a1ex on March 22, 2016, 08:20:35 PM
Right, there are about 30 pixels on the right side, which are not recorded.

The problem is this offset (raw.c):
Code: [Select]
        skip_right  = zoom ? 0 : 2;

It should be 0 in this crop mode.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on March 22, 2016, 11:24:47 PM
Here are my observations:

First of all to get the entire raw buffer, including OB area I ran 'dcraw -4 -E' on that mv640crop Silent DNG (920x624). Then I lightened it up to make it easier to see:

(https://farm2.staticflickr.com/1707/25993526435_ed9315ab21_z.jpg)

Next I checked it in Photoshop. Looks like the out of bounds area ends at 150x26. Does that mean that the top skip is 26 and the right skip is 150?

(https://farm2.staticflickr.com/1696/25364793423_b9a126cff1.jpg)

I don't see any skipped pixels on the right or the bottom:

(https://farm2.staticflickr.com/1586/25968207406_c3e7d47087.jpg)

Here is what I'm seeing on the files xiga posted:

ModeRaw Buffer Sizeskip_topskip_leftskip_right
mv640crop
920x624
26
150
0
mv640
1888x720
26
152
2
mv720
1888x720
26
152
2
mv1080
1888x1182
26
152
2
zoom
2520x1106
26
0
0

So going back to raw.c:

Code: [Select]
        #ifdef CONFIG_60D
        #warning FIXME: are these values correct for 720p and crop modes?
        skip_top    = 26;
        skip_left   = zoom ? 0 : 152;
        skip_right  = zoom ? 0 : 2;
        #endif

Should it be changed to this?

Code: [Select]
        #ifdef CONFIG_60D
        skip_top    = 26;
        skip_left   = zoom ? 0 : mv640crop ? 150 : 152;
        skip_right  = zoom ? 0 : mv640crop ? 0 : 2;
        #endif

I can make a test build for xiga though I'm not sure if this will address his image centering issue.

[EDIT: @xiga -- I believe that what a1ex is saying is that there are extra pixels in the right side of the raw buffer that aren't being used so if you digital dolly all the way to the right you should be closer to center.]
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 23, 2016, 02:21:02 AM
Thanks for the test build dfort!

I gave it a quick test, taking a couple of rough and ready shots just in my front room. As far as i could tell, i don't think it made any difference though. I'd need to do a more thorough test to be absolutely sure though.

However, this got me thinking, for what i'm trying to achieve here, i suppose it doesn't really matter if the Raw video doesn't exactly match the H.264 one. For me, what matters the most, is that what is displayed on the camera screen itself is exactly what is captured in the Raw video. With this in mind, i tried changing the 'Preview Options' under the Raw Video (MLV) section from Auto to 'ML Grayscale'. There is a note at the bottom of the screen that says 'Looks ugly, but at least framing is correct'. And indeed, when choosing this option i can see the framing suddenly shift in the required direction! It's true that it does indeed look ugly (the resolution is terrible, everything looks blocky as hell) but i took a quick video (lining up something in the very corner of the frame) and the resulting DNG files seemed to put it right in the corner, so i think i may have stumbled into a solution here by accident! I think i can live with the ugly preview issue, i'm hoping i will still be able to make out the features of the moon well enough to know where i am in terms of putting together the mosaic.

One thing i've noticed though, this means i have to have Global Draw on in Liveview (to take advantage of the ML Grayscale option). Global Draw adds a row of information at the top and bottom of the screen. Normally this information is desirable, but in my case it's simply getting in the way of important screen real estate, as what is underneath is still being captured. As a workaround, I can tap the Q button to get a peak through Canon's semi-transparent bar to see what's under there, but it would obviously be preferable to not have to touch the camera at all. I don't think it's possible, but it would be nice to have the option to turn these info strips off but keep Global Draw on in Liveview. Just a thought i suppose!

As for everything else above that's gone before, if you guys still think the issue with the offsets needs updating then i'm happy to continue to help with taking test shots and testing out any new builds.

Thanks everyone for all your help on this, you're all lovely people.

Cheers,

xiga.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on March 23, 2016, 04:34:53 AM
I didn't think that adjusting a pixel here and there would do it for you but looks like we cleared up some long standing doubts about raw video modes on the 60D. Looking at the code it seems that mv640crop is unique to the 60D so this next step should do it.

Add this to raw_rec and mlv_rec:
Code: [Select]
    skip_x = sx;
    skip_y = sy;

    refresh_cropmarks();

    /* mv640crop needs this to center the recorded image */
    if (is_movie_mode() && video_mode_resolution == 2 && video_mode_crop)
    {
        skip_x = skip_x - 5;
        skip_y = skip_y + 70;
    }

I believe that the offset should be done after refreshing the cropmarks but I'm not sure. I'm not far very far along the C tutorials so I'm not sure if this is going to work at all but if it does I'll put in a pull request.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 23, 2016, 09:39:10 PM
Thanks for the new test build dfort! Forget what i said above about me just using the Grayscale Liveview Preview, it's really not ideal at all, and after using your latest v2 build i can see a big improvement so let's keep going as i think we're getting close to a proper solution now!  :)

First off, i never tested Digital Dollying (from here on in simply referred to as DD) to the Top Right in the original vanilla nightly build, so i took a couple of quick test shots today on both the vanilla nightly build and on your v2 build and compared the Raw stills to the H.264 stills, and your v2 build is now much closer, so we're definitely on the right track.
The offsets i provided were only a rough guide (i tried to use Photoshop to come up with them but i probably didn't get it right tbh), and from the comparison between the two i think we have over-corrected in both directions (but not by much, and slightly more so in the vertical direction). So we need to back off slightly on the numbers that have caused the shift.
Once we get close enough (it doesn't need to be completely exact), it will be great to know that all i have to do is turn on Raw Video, DD to the top right (would obviously be ideal not to have to do this, it's one more thing for me to forget lol, but at least it's quick and easy to do), turn off Global Draw entirely, and then i can trust that what i see on the back of the camera is pretty much what is being captured.  :)

I've attached a link below to a folder of the shots i took today using your v2 build. It contains a still from the H.264 video, and a Silent DNG and MLV file (taken by DDing to the top right). You can see that they are now quite close. (in the original vanilla nightly build, the raw still was shifted left and up, whereas now in your v2 build we are slightly  too far to the right and down).

https://onedrive.live.com/redir?resid=C14ECDF7700B5618!2535&authkey=!AJPDFT_upJ5JBmI&ithint=folder%2cMLV

You mentioned in your PM that you saw some corrupted frames in my last MLV. This worries me slightly, i don't know what a corrupted frame even is (or what it looks like) but if they're showing up in a 2 sec clip i can only assume there will be a lot in the 50 sec clips i intend on taking! Is this likely to be a big deal do you think? You suggested running the old raw_rec instead, so i took a Raw shot as well (it's also included in the folder above, you can check if there are any corrupted frames in it too). The problem with using raw_rec however, is that to my eyes there definitely appears to be more colour noise than when using mlv_rec, so i've shy'd away from using it. Does this sound right to you? I'm using MLVMystic to convert the MLV and RAW files to DNGs.
MLV Lite sounds interesting. I'd definitely be willing to give it a bash once we get the offsets sorted.

Again, thanks for all your efforts so far up to this point. Hopefully we'll get this sorted soon and it can be incorporated into future builds for other 60D users.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on March 24, 2016, 03:11:25 AM
Ok--encouraging news.

First of all, this is what one of your corrupted frames looks like. This is from the previous MLV file set that you posted, specifically 640x480_MVC_frame_000014. You aren't seeing this on your end? (Your new set doesn't have any corrupt frames.)

(https://farm2.staticflickr.com/1450/25922589371_e846e56096_z.jpg)

This latest batch of files show that the MLV and RAW frames match up exactly--great. mlv_dump is reporting these values:

Code: [Select]
    Crop: 280x96
     Pan: 273x96

Matching up the Simple Silent DNG with a DNG extracted from the MLV and run through dcraw (all run with the -4 -E option) then lining up the layers in Photoshop confirm that crop_X=280 and crop_Y=96. Finally, that tiff you provided from the H.264 video lines up at crop_X=272 and crop_Y=80.

That means I need to move it up and to the left by X-8 and Y-16 -- so the new adjustment would be:

Code: [Select]
    {
        skip_x = skip_x + 3;
        skip_y = skip_y + 54;
    }

Hope my math teacher is checking because I've got a problem :D

The first MLV you sent, without any skip adjustment had these values:

Code: [Select]
    Crop: 200x84
     Pan: 200x85

Now I'm no math wiz but the previous skip adjustments of x-5 and y+70 doesn't add up to where the new crop position landed.

I'm a bit confused about how you are using DD. Isn't the adjustments I'm providing eliminating any need to use DD to center the image? It looks like last time I moved it slightly to the left of where we started and now I'm moving it slightly to the right of where we started. Did you do something different?

Anyway, let's give this a try. Once we've nailed it we can play around with MLV Lite.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 24, 2016, 05:39:14 PM
Sorry dfort, i did indeed do something different. For the last batch of files i used the DD to move to the far Top Right, whereas before i hadn't done this. I did it as i thought it was going to make things easier, but in hindsight it was just stupid! lol

I'm not sure why the 2nd batch had no corrupt frames, perhaps because i turned off Global Draw (Liveview only)? I can't think of anything else i did differently. Can you teach me how i can quickly scan all my DNG's for corrupt files? My 50 sec clips are going to have in the region of 2,400 frames each (and that's just for 1 panel of the mosaic) so i'd like to do some test runs at home just to make sure my settings are stable and i don't end up with a load of corrupt frames on a clear night. Actually, maybe MLV Lite will solve this?

I took a couple of quick comparison Raw and MOV videos using your v3 build. Again, i DD'ed to the Top Right (as your edits were based on me doing this), and compared the two. The good news is they came out very, very close! Vertically the Raw video looked bang on, it was only very slightly too far right, perhaps about 12 pixels or so (i'm no PS expert so i can't say for absolute sure though, the same goes for my original 5 and 70 pixel estimates). Also, there was a thin black bar on the far right of the Raw still.

Anyhoo, now that i know we won't be bothering with the Digital Dolly at all, i took a new batch of files using your v3 build (i left the DD alone). The link is below, it has the usual files:

https://onedrive.live.com/redir?resid=C14ECDF7700B5618!2540&authkey=!AJt7MDIvQiuhVeI&ithint=folder%2cDNG

Sorry about the mixup before. We're getting close now, i can feel it!  :)
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: DeafEyeJedi on March 24, 2016, 06:03:22 PM
Nice work, guys! Once this has been nailed down ... Would this fix be implemented for other cameras as well or is the 60D far too different from others?
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on March 24, 2016, 10:21:33 PM
Nice work, guys! Once this has been nailed down ... Would this fix be implemented for other cameras as well or is the 60D far too different from others?

This is the only camera and video mode that has been reported to be off. If others need adjustment at least we know it is possible. Hope I'm not opening up a can of worms with this.

So with this latest version mlv_dump is reporting:

Code: [Select]
    Crop: 224x138
     Pan: 217x139

In Photoshop it appears that the y position is actually at 136. Maybe the tripod moved slightly? In any case, let's keep trying to nudge the frame a little closer to center.

The tiff frame from the H.264 movie file you supplied is at 273x78, I don't think we can work with odd numbers so let's call it 272.

Now assuming nothing else has changed the new numbers should be:

Code: [Select]
    {
        skip_x = skip_x + 51;
        skip_y = skip_y - 6;
    }

Let's give that a try.

Can you teach me how i can quickly scan all my DNG's for corrupt files?

It depends what computer platform you're using. I'm on a Mac and MLP is great for making mov files. Another app, though it isn't maintained and has issues with some files is MlRawViewer (http://www.magiclantern.fm/forum/index.php?topic=9560.0). I'm using version 1.4.3 and it is great for quickly reviewing MLV files.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on March 25, 2016, 01:20:38 AM
Dfort

You, my friend, are a legend. Your v4 build looks to be pretty much bang on!  :)

I took some test shots (link below) on your v4 build (apologies for the low quality, they are night time shots in Movie Crop Mode across my living room at a very high ISO, but at least the pattern on the curtains makes it easy to spot movement  ;) ). I should also point out that my tripod is not great, and my floors are terrible in terms of being level (don't get me started on that one, lol) so if there are a few pixels of movement showing here or there, it could absolutely be down to that). But the good news is, the Raw video is now showing almost an identical framing to the H.264 video!  :)

https://onedrive.live.com/redir?resid=C14ECDF7700B5618!2545&authkey=!AAmIA2Hkffx_Ba0&ithint=folder%2cDNG

Have a look at the files yourself, just to check there are no corrupt frames again, and that you agree it now looks close enough (i can see a very, very slight difference vertically, but like i say this could just be down to my circumstances, and for my purposes anyway this is more than good enough).

Thanks for the heads up on MLRawViewer. It seems to be working ok for me here on my Windows 8.1 machine.

As far as i know, the only other camera (apart from the 60Da, which is a very niche camera to say the least!) which has a similar 640x480 Movie Crop Mode is the 550d, so perhaps this fix will also work for it (will need tested obviously though).

For everyone else here's the stills from the .MLV and .MOV files in the folder above:

.MOV
(https://6caysg-sn3302.files.1drv.com/y3m52OOICaGZ-azZrbS0Xlyw0IHK8HEB9NgzJikCeE50OoTMwiVVo80pUh2InrD12IYPd79ble4s7OYC4uw6zpwSo-XkLJibZhY4rtzesKHAJPS9L50XmX9t54oltq5LyUyN2GgAplQOfVwSKv-UiQv8t5W6AtuczIZ861q6F7DuI0?width=640&height=480&cropmode=none)

.MLV
(https://2yaysg-sn3302.files.1drv.com/y3m0NJjtBFcDb3y3fV0iYUbY276_GlYsvDjQ-Q6lXtu0N4DSRZFaMAbOMJ2PMSf6cqfHrT_Vi8SmLCBNZoMt650TuDfrUnHgPk8IA7sKYathkZMENCFK9Ms-KVbh5xfMoBdhdAfXsTSeB4YwMEnSy4tt2c5V4ZV2nYIOHzM2gyuYgU?width=640&height=480&cropmode=none)

Let me know what you think dfort, but to me it looks like we've finally solved this (well, you have really!).

xiga.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on March 25, 2016, 02:09:42 AM
I can see some vertical movement on your mov file so it looks like we shouldn't try to tweak any more.

According to mlv_dump the latest numbers are:

Code: [Select]
    Crop: 272x78
     Pan: 265x79

That is exactly the crop we were after from the previous test.

This is now probably as good as the other video modes. I'll go ahead and put in a pull request so the developers can check it out. You say that the 550D also has this mode or something similar to it? Maybe a developer can verify that and it can be tested on that camera if necessary.

I'll also prepare an MLV Light module for you to test out--please report your findings to the MLV Lite topic (http://magiclantern.fm/forum/index.php?topic=16650.0).
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: DeafEyeJedi on March 25, 2016, 04:15:03 AM
Once again, nice work by the great legendary @dfort!!!
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on April 13, 2016, 09:37:01 PM
a1ex suggested a better fix patching the raw recorders. @xiga are you still checking the forum? I sent you a PM.

In any case, if anyone with a 60D that can test out this issue, I made a testing build using a1ex's fix:

http://www.magiclantern.fm/forum/index.php?topic=12608.msg165718#msg165718

Here's the pull request for feedback:

https://bitbucket.org/hudson/magic-lantern/pull-requests/693/fix-mv640crop-mode/diff
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: xiga on April 16, 2016, 03:57:14 PM
Sorry I missed this guys. I will test this out as soon as i can and report back.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on April 22, 2016, 02:34:05 AM
Made an update today. Should work same as the previous test that worked but this one has all the latest updates and does the centering on the backend instead of the modules. It is a full moon so if you want to give it a try tonight.
Title: Re: Raw Video framing is off when using 60D's 'Movie Crop Mode'. Help!
Post by: dfort on May 07, 2016, 07:38:09 PM
Hi 60D users -- I just wanted to update this post to inform you that the changes we made to center mv640crop are now in the nightly builds. Thanks xiga for this.