This workflow generates a 30fps movie from a 30fps recording. It's pretty cpu intensive, and is at the moment not usefull for large films. The script is set to process the first 15 frames, to test the procedure, and can be set to the full length offcourse. This process can be made multi-threading if it proves to be usefull :-) If anybody's got suggestions, I'm glad to hear them!
The script needs the following applications installed to work:
mplayer, for extracting the frames
mencoder, for merging the frames to a movie
align_image_stack, for aligning the dark and light frame, this is the part that is cpu intensitive
enfuse, for generating the hdr image
mogrify, for cropping the image, this should be done by enfuse, but it has a bug that it does not work
This is a test movie I made with it, shot with a 50d:
This is a visual of my workflow:

This is the bash script, make sure you test this script in an empty directory with just the script and the .mov file.
#!/bin/bash
# Usage: vid2hdr.sh namevid.mov
alignFrames() {
noframes=`ls *.png | wc -l`
for i in `seq 1 2 $noframes`; do
in1=`printf "%08d.png" "$i"`
in2=`printf "%08d.png" "$((i+1))"`
out1a=`printf "%08d_A.tif" "$i"`
out1b=`printf "%08d_B.tif" "$i"`
out2a=`printf "%08d_A.tif" "$((i+1))"`
out2b=`printf "%08d_B.tif" "$((i+1))"`
align_image_stack -a first_frame $in1 $in2
mv first_frame0000.tif ./align/$out1a
mv first_frame0001.tif ./align/$out1b
align_image_stack -a second_frame $in2 $in1
mv second_frame0000.tif ./align/$out2b
mv second_frame0001.tif ./align/$out2a
done
}
myCropFrames() {
noframes=`ls ./align/*.tif | wc -l`
noframes=$(($noframes/2)) #delen door twee
for (( n=1; n<=$noframes; n++ )); do
in1=`printf "./align/%08d_A.tif" "$n"`
in2=`printf "./align/%08d_B.tif" "$n"`
echo "cropping frame $out from $in1 and $in2 ..."
#w=1920:h=1080
mogrify -crop 1820x1024+50+28 $in1 # crop, but maintain aspect ratio
mogrify -crop 1820x1024+50+28 $in2
done
}
myHdrFrames() {
noframes=`ls ./align/*.tif | wc -l`
noframes=$(($noframes/2)) #delen door twee
for (( n=1; n<=$noframes; n++ )); do
in1=`printf "./align/%08d_A.tif" "$n"`
in2=`printf "./align/%08d_B.tif" "$n"`
out=`printf "./align/hdr/%08d.jpg" "$n"`
echo "creating HDR frame $out from $in1 and $in2 ..."
#enfuse -f 1820x1024+50+28 --compression=95 -o $out $in1 $in2 #Doesn't crop, bug...
enfuse --compression=95 -o $out $in1 $in2
done
}
encodeVideo() {
vid_input_width=1820
vid_input_heigth=1024
vid_output_width=1280
vid_output_height=720
# 2 stage encoding with mpeg4 codec, settings from mencoder wiki
# optimal_bitrate = (40..60) * 25 * width * height / 256
opts="vbitrate=12150000:mbd=2:keyint=132:v4mv:vqmin=3:vlelim=-4:vcelim=7:lumi_mask=0.07:dark_mask=0.10:naq:vqcomp=0.7:vqblur=0.2:mpeg_quant"
#w=1920:h=1080
mencoder mf://./align/hdr/*.jpg -mf w=$vid_input_width:h=$vid_input_heigth:fps=30:type=jpg -oac copy -ovc lavc -vf scale=$vid_output_width:$vid_output_height -lavcopts vcodec=mpeg4:vpass=1:$opts -o /dev/null
mencoder mf://./align/hdr/*.jpg -mf w=$vid_input_width:h=$vid_input_heigth:fps=30:type=jpg -oac copy -ovc lavc -vf scale=$vid_output_width:$vid_output_height -lavcopts vcodec=mpeg4:vpass=2:$opts -o output.mpeg
}
cleanup() {
rm -rf align
mkdir align
mkdir align/hdr
rm *.tif
rm *.png
rm *.jpg
}
cleanup # Be sure this is what you want ;-)
mplayer -frames 15 -vo png:z=1 $1 # process only 15 frames, for testing
#mplayer -vo png:z=1 $1 # Process all frames, takes a while ;-)
alignFrames
myCropFrames
myHdrFrames
encodeVideo
#cleanup
exit