Switch for macOS Catalina/Linux (former cr2hdr.app)

Started by Danne, May 05, 2015, 04:32:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Danne

Darkframe automation
new upload

Spend a few hours with different kinds of automation around darkframe averaging with mlv_dump(g3gg0,a1ex). With imagemagick cr2hdr.app can read the rgb pixel and exposure level. This way I first automated HDR processing so that the mov file will automatically be detected as HDR or not.
With this in mind I also automated darkframe processing to make this much easier to integrate in a mlv workflow. The workflow is pretty straightforward. Record MLV footage MLV and see to it that you record a short darkframe with the cap on the lens. If you change settings film another darkframe to go with that footage etc. cr2hdr.app will create averaged files and then match those to the footage you filmed. It will match according to iso, camera model, frames per second and shutter settings.
Don,t film the darkframe longer than 8-10 seconds. 3-4 seconds will do.
The easy way to understand it:
1 - Record MLV footage as usual
2 - Record a short MLV file with the lens cap on(your darkframe footage)
3 - If you change settings film another darkframe that match the new settings
4 - Put all the files in the root folder select (A) from the main menu and then (r) to start cr2hdr.app

cr2hdr.app will search for three different criterias to determine if it has a darkframe shot to work with. It checks if the file has less than 400 frames, that it is smaller than 1gb in size and finally it uses imagemagick to read the rgb pixel before it goes into averaging the file.
Here is a short demonstration.
Code starts at line 96
https://bitbucket.org/Dannephoto/cr2hdr/src/8395b3a49108eb2256871ed40bb559f3f6407038/source_code/cr2hdr_MAIN.txt?at=default&fileviewer=file-view-default



Danne

Added support for flatframe correction.
What,s a flatframe? Start reading here.
http://www.magiclantern.fm/forum/index.php?topic=17795.msg171607#msg171607
WHat does it do? The little I tested this out it will even out vignetting and other uneven anomalies. You can run both flatframe and darkframes in cr2hdr.app. I tested this on some clips filmed with canon eos m and it got rid of most of the focus pixels.
Darkframe averaging is automated but a flatframe is selected when choosing flatframe from the main menu. I,ll might put some workflow video when I get some time for it. Meanwhile feel free to test it out as is.
Flatframe script starting at line 97.
https://bitbucket.org/Dannephoto/cr2hdr/src/57b9a6af31cbc218ac67f975e0c925e30797fce2/source_code/cr2hdr_MAIN.txt?at=default&fileviewer=file-view-default

Danne

For future reference here is an example of how to work with both darkframe and flatframe subtraction through cr2hdr.app.

Been testing darkframes and flatframes and now I got some scripted automated solutions for both darkframes and flatframes in cr2hdr.app
http://www.magiclantern.fm/forum/index.php?topic=15108.msg146822#msg146822

Darkframe subtraction really cleans up color noise significantly on higher isos(example 800 iso) and flatframes evens out vignetting among other things. I ended up with a flatframe filmed at f5.6 while cat clip was filmed at f1.4.
A lot more to learn and test with in regard of creating the better flatframe. Here is an interested read about it. Note that I didn,t follow the rule.
https://photographingspace.com/how-to-create-dslr-and-ccd-flat-frames-for-astrophotography/

Original dng files here
https://drive.google.com/file/d/0B4tCJMlOYfirS2RoRV9jUGVVOE0/view?usp=sharing

Original


Darkframe subtraction added


Darkframe+flatframe added


Included in the root folder is one darkframe, one flatframe and one movie clip.
cr2hdr.app will automate processing the way it,s shown in the movie below.




Danne

Yesterday I started playing with the experimental Crop mode 3x3 720p in the canon eos m. I found out it,s actually possible to film this way with H.264 when raw movie tab is set to off. That also makes it possible to select 60fps 720p in canon menu. Now when filming HDR you,ll get a much cleaner image than otherwise, much closer to mv1080. The output will be skewed but that is easy to fix with ffmpeg. There is also the problem around focus pixels but hopefully this will either be fixed somehow with another raw stream or dfort,s pixel maps might work with a certain ffmpeg filter. I can,t say that they disturb in the footage right now but you might see them if you pixel peep.

I put in a feature in the scaler which is included in the X to ProRes menu. Select the appropriate one when exporting HDR material.


Tutorial
https://youtu.be/S_jeLyA6LWI

Test footage
https://youtu.be/Suj-tknA3mI

The crop module versions I,m using are coming from dfort here. Use them at your own risk of course.
https://bitbucket.org/daniel_fort/magic-lantern/downloads/magiclantern-x-perimental.2016Nov23.zip

dfort

Quote from: Danne on November 24, 2016, 01:19:19 PM
Yesterday I started playing with the experimental Crop mode 3x3 720p in the canon eos m. I found out it,s actually possible to film this way with H.264 when raw movie tab is set to off...There is also the problem around focus pixels...

Please tell me you aren't seeing focus pixels when recording to H.264. They should only appear when shooting MLV/raw. Well, they shouldn't appear at all but we're dealing with it. Removing focus pixels from H.264 footage would be even more challenging than raw.

Danne


dfort

So this only happens with the crop_rec module, right? All the other H.264 video modes are fine? You said you can deal with them with ffmpeg?

Danne

I think this is only happening with crop module.
Well. There is a filter called delogo which works like dcraw neighburing pixel fix but I,m not sure this will work with multiple coordinates in any easy fashion.  RIght now I actually include the deflate filter to the HDR footage in the crop rec module. It works good and it,s hard to see the pixels if at all on the exported footage.

Danne

MLVFS_workflow(download in first post)
Lately I,ve been trying to figure out how to make good use of the command line options in MLVFS(dmilligan) and to find a fast way to develop my MLV files into folders with dng files. Needles to say MLVFS works with dfort pixel focus lists as well as with 10/12-bit files and is by far the fastest way to get into dng editing.
In the other script program MLP I simply leech on the the automator created partition folders but in cr2hdr.app I have been porting most of the command line options into a bash menu selector. I choose to default into resolve folder setting.
Also different is that cr2hdr.app creates symlinks of the dng folders which is then put into your root folder. This makes it work seemlessly with the other functionalities in the program. This idea I had for a long time and after some discussion with so-rose, author of convmlv I decided to give it a go. It seems to work well.
What cr2hdr.app does it creates two folders, name/of/your/root/folder_mount and name/of/your/root/folder _storage inside A_ORIGINALS folder and then goes from there creating the mlvfs mount and copies/creates the symlink folders. You can check the menu and the movie for further understanding.
Treat this workflow as bleeding edge and test it a lot with back up files before doing any important stuff with it.
If you get any ideas feel free to share them here.

MLVFS workflow menu







The MLVFS_workflow menu is based around this script.
#root folder name
root=$(grep -o '[^/]*$' /tmp/DUALISO/"path_1")
kill $(cat /tmp/"$root"_pid) 1> /dev/null 2>&1 &
rm "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_storage/*.IDX &>/dev/null
find "$(cat /tmp/DUALISO/path_1)"/ -maxdepth 1 -type l -delete
mkdir -p "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS 1> /dev/null 2>&1 &
mkdir -p "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_storage 1> /dev/null 2>&1 &
mkdir -p "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_mount 1> /dev/null 2>&1 &
if ! ls "$(cat /tmp/DUALISO/path_1)"/*.MLV &>/dev/null
then
if ! ls "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_storage/*.MLV &>/dev/null
then
echo > /tmp/no_files
fi
fi

if ! ls /tmp/no_files
then
mv -i "$(cat /tmp/DUALISO/path_1)"/*.M* "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_storage &>/dev/null
cd ~/Library/Services/MLVFS.workflow/Contents/
./mlvfs "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_mount --mlv-dir="$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_storage -f -o local -o volname=""$root"_mount" -o allow_other --resolve-naming $(cat "/tmp/"$root"_settings.txt" | sed -e 's/^[ \t]*//') &
echo $(ps aux | pgrep mlvfs) > /tmp/"$root"_pid
cd "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_storage/
check=$(ls -r *.MLV | head -1 | cut -d "." -f1) &>/dev/null
cd "$(cat /tmp/DUALISO/path_1)"/
while ! ls -d "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_mount/"$check"MLV_* &>/dev/null
do sleep 1
done
ln -s "$(cat /tmp/DUALISO/path_1)"/A_ORIGINALS/"$root"_mount/* "$(cat /tmp/DUALISO/path_1)"/ 1> /dev/null 2>&1 &
open "$(cat /tmp/DUALISO/path_1)"/
else
rm /tmp/no_files 1> /dev/null 2>&1 &
fi


Danne

Lately I,ve been adding some more stuff around darkframe automation(mlv_dump) and around mlvfs integration into cr2hdr.app. It,s now posible to have a storage folder containing already created(averaged) darkframes or add non averaged darkframes to the storage folder and they will be averaged. You activate this by selecting the storage folder before running any processing of mlv files. You can then leave this storage folder activated all the time or disconnect it from the Main menu the next time you open up cr2hdr.app.

Select (A) from Main menu to get to this:



The other thing is I noticed you can actually change metadata tags in the virtual dng files in mlvfs with exiv2(A.Huggel)http://www.exiv2.org/
I therefore added the possibility to run auto white balance on the virtual dng folders if anybody likes that. It,s reasonably fast despite the fact that it will iterate and apply tags to all dng files. It starts and will then run in background so you can keep working with other stuff meanwhile.
Also added is a reset scale tag. That is for bleeding edge material such as footage coming from crop_rec which are being read as stretched footage for the time being. If that is a problem you can now reset the metadata scale tag.
With xxd I added the possibilty to alter white level in 5D mark III from 15000 to 16383(White level maximum 14-bit) for some extra highlight information. This will only work if the tag is either 15000 or 16383 to begin with otherwise nothing will be changed in the file to prevent other cameras to get these tags. Xxd is altering the MLV files directly.




DeafEyeJedi

Simply stunning @Danne and can't wait to get my hands on this gem of yours once again!

Thanks for making DarkFraming Avg at least one of your priorities. Been wanting this new storage feature for a long time and it absolutely was worth the wait!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Danne

Your welcome and please report how it works out for you.

DeafEyeJedi

I know this is a little off topic but felt this was worth sharing since it is actually incredible to be able to preview 10/12-bit files with MLRawViewer while running MLVFS within your cr2hdr.app which is a dream come true for many.

Here's what I was able to do with a quick test file shot in 10-bit from 100D.101:

https://vimeo.com/198240254

Thanks again @Danne for your never ending Magic!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Danne

Thanks for sharing your workflow. It,s not that strange really. both mlv_dump and MLVFS outputs 14/16 bit even if being recorded 10bit. That,s why MlRawViewer works. It can be done outside cr2hdr.app as well. cd into a virtual folder of dng files right click a dng file and choose to open with MlRawviewer.

Danne

Worth mentioning some recent progress on handling focus pixels coming from MLV files. Until now this has been taken care of only when piping through dcraw to different formats ProRes in MLP and cr2hdr.app leaving the dng file still full of pixels.
I,ve been discussing the possibilites together with Bouncyball about utilise cold pixel code in raw2dng, used in mlv_dump somehow to also account for x,y coordinates created in dforts focus pixel script for those cameras affected. This was possible and Bouncyball used his magic fingers and created som real nice list handling through mlv_dump. Now the vital piece of the puzzle is the actual coordinates generated in dfort,s focus pixel script which are used also in mlvfs so I married the "allbadpixel.map" code from Bouncyball and the focus pixel script from dfort and I let them both live and prosper in cr2hdr.app in a nice multithreaded way :). It,s all taken care of automagically so just run cr2hdr.app and let dngĀ“s be baked.
In this version I also put in chroma smoothing code from raw2dng since cr2hdr cs code code seems to not work so good in blown highlights for now.

Code here
https://bitbucket.org/Dannephoto/magic-lantern/branch/ml-dng-unified_4_chroma_smooth

Focus pixel code(dfort)
https://bitbucket.org/daniel_fort/ml-focus-pixels

A picture that says it all. Dng file with and without allbadpixels.map file generated.




Danne

Added a switch which will disable cr2hdr automation in mlv files. Could be used for picky files which sometimes will fool cr2hdr into thinking it,s actually a dualiso file when it,s not. Of course when the switch is set it won,t transcode movie dualiso dng files at all coming from MLV files.
Discussed here.
http://www.magiclantern.fm/forum/index.php?topic=5601.msg180229#msg180229




Teamsleepkid

love this app. i keep getting pink footage though. do i need to change the black and white level in mlv_dump? sorry I'm a noob just really liking this app and i always get pink footage. using experimental builds. maybe thats why?
EOS M

Danne

Nice to hear :).
What camera and firmware?
If black and white level related you can change these numbers in mlv_dump menu. You can test:
White level 16000
Black level 2048

Teamsleepkid

https://vimeo.com/205001874
eos m firmware 2.0.2. my proxies and 4444 prores come out fine but my raw dng folder always has strange color like neon pink skin. maybe I'm missing an add on? I might not even have mlv_dump I'm on a mac and I don't know what I'm doing lol. I only see it as a windows exe.
EOS M

Danne

Thought you were using cr2hdr.app? Mlv_dump is incuded in there. Head over to the correct menu by selecting (m) from the main menu. In there you can set white and black levels.

Teamsleepkid

ok so mlv_dump is already in cr2hdr. good to know. yeah tried the white and black settings you suggested still pink skin. you have an eos m that works fine? I'm using the 2-11 experimental build with h.264 proxie.. but I've been getting this pink skin thing since I've started using cr2hdr. with other builds as well. I have no idea what it is. just really love the 4444 proxies but i need to open the raw folder in davinci to adjust exposure and kick out my own proxies or do an online color correction on the raw material.
EOS M

Danne

Preview set to hacked? This is really experimental stuff.
Best movie mode for eos m is the crop_rec module. Coninuous 10bit without proxy needed to be set.

Teamsleepkid

I've tried lots of different things. I've had it set to hacked and gotten MLV files that open fine in mlvfs. I was using that before and it was working. Then it just stopped working when the experimental builds came out. Focus Pixels show up. I used mlvfs through your app and they are gone. Strange.. but I need actual files can't have ghost folders that unmount. So I wanted to use your app but it comes out pink.
EOS M

Danne

Can you post a file which comes out pink? Hopefully not too big.
About focus pixels it can be problematic. crop_rec needs a special fpm map which dfort created and I,m using it in cr2hdr.app.