[FFmpeg-user] Filter for smoothening gradual luminance changes?
Markku Tavasti
tavasti at tavasti.fi
Tue Apr 18 22:26:10 EEST 2017
On 18.04.2017 14:02, Markku Tavasti wrote:
> Maybe I try to create script which would get frames as pictures. And in
> addition, to darkest parts of the video, there is huge noise in picture,
> averaging maybe 4 frames migth give better results.
Made a script:
----------------------------------------
#!/bin/bash
interval=1
if [ $# -gt 0 ] ; then interval=$1 ; fi
echo "Using interval of $interval seconds"
mkdir -p raw
mkdir -p avg
mkdir -p frm
FRM=0
for f in FHD*; do
len=$(ffprobe -select_streams v -show_streams $f 2>/dev/null| grep
'duration=' | sed 's/.*=//i;s/\..*//')
echo $f $len $FRM
pos=0
while [ $pos -lt $len ]; do
ffmpeg -ss $pos -i $f -frames:v 4 raw/frm$(printf "%05d"
${FRM})_%d.png 2>/dev/null
convert raw/frm$(printf "%05d" ${FRM})_*.png -average
avg/frm$(printf "%05d" ${FRM}).png
mv raw/frm$(printf "%05d" ${FRM})_1.png frm
rm raw/frm$(printf "%05d" ${FRM})_*.png
FRM=$(($FRM+1))
pos=$((${pos}+${interval}))
done
done
echo deflickering avg
cd avg
timelapse-deflicker.pl 2>/dev/null
echo deflickering frm
cd ../frm
timelapse-deflicker.pl 2>/dev/null
cd ..
ffmpeg -r 25 -pattern_type glob -i 'avg/Deflickered/*.png' -c:v libx264
-pix_fmt yuv420p avg.mp4
ffmpeg -r 25 -pattern_type glob -i 'frm/Deflickered/*.png' -c:v libx264
-pix_fmt yuv420p normal.mp4
----------------------------------------
And results https://youtu.be/5u3t6hiaEPI
Looks like ok. Uses lot of time and disk, real filter to ffmpeg would be
much faster, but I am not in such mass production / my release schedule
is not tight, so this will be sufficient to me.
--Tavasti
More information about the ffmpeg-user
mailing list