hehe, maybe you are right.
Etiquette, expectations, entitlement...
@autoexec_bin | #magiclantern | Discord | Reddit | Server issues
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
#!/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
Page created in 0.083 seconds with 13 queries.