Magic Lantern Forum

Using Magic Lantern => Raw Video => Raw Video Postprocessing => Topic started by: sgofferj on February 04, 2015, 08:38:31 PM

Title: Linux love?
Post by: sgofferj on February 04, 2015, 08:38:31 PM
Hi,

so I looked at RAW again after several months of doing other stuff and it's still rather hard. I installed the latest ffmpeg static for Ubuntu 14.04 from ppa:mc3man/trusty-media and guess what... when I try to convert an MLV into anything else, it segfaults. The fuse-based MLVFS works like a charm and I now have a whole ton of DNGs. Which I can't do anything with because again, ffmpeg does not read DNGs, so no way to convert it to something editable like ProRes or so.
Does ANYbody here works regularly on Linux, preferably Ubuntu, and has a preferably simple solution on how to convert MLVs into something I can use with kdenlive or similar?

-Stefan
Title: Re: Linux love?
Post by: Danne on February 04, 2015, 10:32:04 PM
ffmpeg can pipe dng through dcraw and you get prores. I have it working on my mac. Dcraw (options | ffmpeg ((options) output. The guy who worked with raw2dng app has the code for it in his app. I could send you the solution tomorrow.
Realize your on linux, would it be close to a mac solution like mine you think?
Title: Re: Linux love?
Post by: dmilligan on February 04, 2015, 11:25:45 PM
Yes, dcraw will work on Linux, also if you'd prefer a GUI, any of the open source raw editors built around dcraw like: RAWTherapee, UFRAW, or darktable.
Title: Re: Linux love?
Post by: sgofferj on February 05, 2015, 10:50:00 AM
For anything else than web, photo/video editing and CG, a GUI for me is only a way to get multiple CLIs open at the same time :D.
If anybody had a sample line how to use dcraw with ffmpeg that would be great!

I did report a bug to ffmpeg but one never knows how fast they fix it. MLV isn't exactly mainstream...

Edit: of course, I COULD push all the DNGs through ImageMagick's convert and make TIF's out of them but that would be a very long additional step in the workflow...
Title: Re: Linux love?
Post by: Danne on February 05, 2015, 11:55:49 AM
raw2dng *.dng | awk '/FPS/ { print $3; }' > /tmp/fps
FPS=$(cat /tmp/fps) ;

dcraw -a -c -H 0 -6 -W -q 3 *.dng | ffmpeg -f image2pipe -vcodec ppm -r "$FPS" -i pipe:0 -vcodec prores_ks -profile:v 3 -vendor ap10 -pix_fmt yuv444p10 -y -r "$FPS" output.mov

rm /tmp/fps ;


awk will grab fps from raw2dng transcodes and apply it to the file. For MLV files you could get the fps with exiftool. Can,t find the code right now. Tell me if you want for MLV and I check later.

Title: Re: Linux love?
Post by: Danne on February 05, 2015, 03:04:13 PM
Here,s a command for mac.
https://drive.google.com/file/d/0B4tCJMlOYfirWU1PX2tjTDB1RVE/view?usp=sharing

Code derive from raw2dng created by Scrax long time ago.

When run in the same folder with MLV and RAW files it will convert and apply exiftool information including correct fps to ffmpeg to transcode to ProRes. Many of the script calls needs the binares from cr2hdr-r but should work with just Mlv_dump, Raw2dng, exiftool, dcraw and ffmpeg.

cr2hdr-r
http://www.magiclantern.fm/forum/index.php?topic=13512.0

I run an old ffmpeg called ffmpegx86 in the script so if running a newer release rename accordingly.

Part of the code. When filming slowmotion ffmpeg will scale the file to correct aspect ratio.

raw2dng *.RAW ${BASE}_1_$(date +%Y-%m-%d)_0001_C0000_ | awk '/FPS/ { print $3; }' > /tmp/fps

FPS=$(cat /tmp/fps) ;

exiftool -tagsfromfile ${BASE}_1_$(date +%Y-%m-%d)_0001_C0000_000000.dng -FrameRate="$FPS" *.dng -FrameRate="$FPS" -overwrite_original ;
01_C0000_000000.DNG "-FrameRate="$FPS"" -overwrite_original ;

 
if grep -q '40.000\|48.000\|50.000\|60.000' /tmp/fps
then
dcrawx86 -a -c -H 0 -6 -W -q 3 *.dng | ffmpeg -f image2pipe -vcodec ppm -r "$FPS" -i pipe:0 -vcodec prores_ks -profile:v 3 -vendor ap10 -pix_fmt yuv444p10 -y -r "$FPS" -vf scale=iw:ih*1.61 ../${BASE}_1_$(date +%Y-%m-%d)_0001_C0000.mov ;

else

dcrawx86 -a -c -H 0 -6 -W -q 3 *.dng | ffmpeg -f image2pipe -vcodec ppm -r "$FPS" -i pipe:0 -vcodec prores_ks -profile:v 3 -vendor ap10 -pix_fmt yuv444p10 -y -r "$FPS" ../${BASE}_1_$(date +%Y-%m-%d)_0001_C0000.mov ;
fi



For MLV (Part of the code)

exiftool and awk grabbing the framerate

exiftool ${BASE}_1_$(date +%Y-%m-%d)_0001_C0000_000000.dng | awk '/Frame Rate/ { print $4; }' > /tmp/fps 

   FPS=$(cat /tmp/fps)


/D
Title: Re: Linux love?
Post by: sgofferj on February 09, 2015, 01:35:09 PM
Woooooooorks! :D I finally can use raw/MLV footage... :).

Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!
Title: Re: Linux love?
Post by: Danne on February 09, 2015, 08:00:32 PM
Cool :)
You,re welcome
Title: Re: Linux love?
Post by: sgofferj on February 24, 2015, 03:14:52 PM
Question:
When I take those DNGs and pipe them through the script, the ProRes result is very Rec709-ish. Means, colors and contrast look already pretty normal which doesn't leave awfully much space to work with. Is it possible to get a result more towards the direction of C-Log or Cinestyle?
Title: Re: Linux love?
Post by: Danne on February 24, 2015, 10:02:52 PM
You could work with gamma settings but more efficient would be to implement a lut. I just got a log lut from Andy600 that fits really good here but with dual iso files.

I,d also recommend using find when piping bigger amounts of files since ls won,t list endless amount of files. I changed my code to this.

find . -name '*.DNG' -print0 | xargs -0 dcraw -c -H 0 -6 -W -q 3 -r $Wtemp | ffmpeg -f image2pipe -vcodec ppm -r "$FPS" -i pipe:0 -vcodec prores_ks -pix_fmt yuv444p10 -n -r "$FPS" -vf lut3d=/usr/bin/bmcc_ixml_luts/Andy600_cr2hdr-r_luts/Andy600_lin_to_log.cube ../${BASE}_1_$(date +%Y-%m-%d)_0001_C0000.mov ;

-r $Wtemp (white balance) and $FPS" (frames per second). THese are settings used with awk and not to be used as is.

Log lut implementation

-vf lut3d=/usr/bin/bmcc_ixml_luts/Andy600_cr2hdr-r_luts/Andy600_lin_to_log.cube
Title: Re: Linux love?
Post by: sgofferj on February 25, 2015, 12:02:12 PM
Ah, hmm, where would I find suitable LUTs?