- ein fortgeschritteneres Beispiel für ein Makefile für die
Videokomprimierung mit Stabilisierung - leider kommt es immer wieder zu seltsamen Unschärfe-Flashs new file: homepage/redesign2018/markdownExperiment/src/Makefiles/Makefile.vidstabTest
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
FFMPEG = /c/proggis/media/editoren/ffmpeg-4.0.2-win64-static/bin/ffmpeg.exe
|
||||
GUETZLI = /d/projekte/tests/guetzli.git/bin/Release/guetzli.exe
|
||||
|
||||
VID_CODEC_HEIGHT = 360
|
||||
VID_CODEC_BITRATE = 500k
|
||||
VID_CODEC = libvpx-vp9
|
||||
|
||||
|
||||
sourceVideos = $(wildcard videos/.forCompressing/*.video)
|
||||
|
||||
vidstabLogs = $(addsuffix .trf, $(basename $(sourceVideos)))
|
||||
firstPassLogs = $(addsuffix .firstPassLog, $(basename $(sourceVideos)))
|
||||
webmVideos = $(addprefix videos/webm/, $(addsuffix .webm, $(basename $(notdir $(sourceVideos)))))
|
||||
jpegThumbs = $(addprefix videos/thumbnails/, $(addsuffix .jpg, $(basename $(notdir $(sourceVideos)))))
|
||||
|
||||
|
||||
.SECONDARY: $(vidstabLogs) $(firstPassLogs)
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(webmVideos) $(jpegThumbs)
|
||||
|
||||
clean:
|
||||
$(RM) \
|
||||
$(vidstabLogs) \
|
||||
$(firstPassLogs) \
|
||||
$(webmVideos) \
|
||||
$(jpegThumbs)
|
||||
|
||||
.PHONY: thumbnails
|
||||
thumbnails: $(jpegThumbs)
|
||||
|
||||
# Erzeugen der Targets
|
||||
.PHONY: targets
|
||||
targets:
|
||||
for file in videos/aufnahmen/papaRomy/*.webm;\
|
||||
do \
|
||||
checkSum=$$(sha512sum $${file});\
|
||||
ln -f $${file} videos/.forCompressing/$${checkSum%%\ *}.video;\
|
||||
done;
|
||||
|
||||
videos/.forCompressing/%.trf: videos/.forCompressing/%.video
|
||||
# Die Stabilisierungsberechnung:
|
||||
# eventuell sollte hier die Skalierung vorgeschaltet werden...
|
||||
$(FFMPEG) -i $^ \
|
||||
-filter:v vidstabdetect=result="$@" \
|
||||
-f null \
|
||||
-
|
||||
|
||||
videos/.forCompressing/%.log: videos/.forCompressing/%.video videos/.forCompressing/%.trf
|
||||
# First Pass
|
||||
$(FFMPEG) -i $< \
|
||||
-filter:v vidstabtransform=smoothing=30:input="$(basename $<).trf",nlmeans=s=6:p=5:r=7,scale=-2:$(VID_CODEC_HEIGHT):sws_flags=sinc,unsharp=5:5:0.8:3:3:0.4 \
|
||||
-codec:v $(VID_CODEC) \
|
||||
-pass 1 \
|
||||
-passlogfile "$(basename $<).firstPassLog" \
|
||||
-b:v $(VID_CODEC_BITRATE) \
|
||||
-threads 1 \
|
||||
-speed 4 \
|
||||
-tile-columns 0 \
|
||||
-frame-parallel 0 \
|
||||
-g 9999 \
|
||||
-aq-mode 0 \
|
||||
-an \
|
||||
-f webm \
|
||||
-y \
|
||||
/dev/null
|
||||
|
||||
|
||||
# target und dependencies müssen noch angepasst werden
|
||||
# Die erste Abhängigkeit muss das quellVideo sein!
|
||||
videos/webm/%.webm: videos/.forCompressing/%.video videos/.forCompressing/%.trf videos/.forCompressing/%.log
|
||||
mkdir -p videos/webm
|
||||
# Second Pass
|
||||
$(FFMPEG) -i $< \
|
||||
-filter:v vidstabtransform=smoothing=30:input="$(basename $<).trf",nlmeans=s=6:p=5:r=7,scale=-2:$(VID_CODEC_HEIGHT),unsharp=5:5:0.8:3:3:0.4 \
|
||||
-codec:v $(VID_CODEC) \
|
||||
-pass 2 \
|
||||
-passlogfile "$(basename $<).firstPassLog" \
|
||||
-deadline best \
|
||||
-b:v $(VID_CODEC_BITRATE) \
|
||||
-threads 1 \
|
||||
-speed 0 \
|
||||
-tile-columns 0 \
|
||||
-frame-parallel 0 \
|
||||
-auto-alt-ref 1 \
|
||||
-lag-in-frames 25 \
|
||||
-g 9999 \
|
||||
-aq-mode 0 \
|
||||
-an \
|
||||
-f webm \
|
||||
$@
|
||||
|
||||
videos/thumbnails/%.png: videos/.forCompressing/%.video
|
||||
mkdir -p videos/thumbnails
|
||||
# $(FFMPEG) -i "$<" -vf "select=gt(scene\,0.4)" -frames:v 5 -vsync vfr -vf scale=-2:$(VID_CODEC_HEIGHT),fps=fps=1/600 "$@"
|
||||
$(FFMPEG) -i "$<" -vf thumbnail,scale=-2:$(VID_CODEC_HEIGHT) -frames:v 1 "$@"
|
||||
|
||||
videos/thumbnails/%.jpg: videos/thumbnails/%.png
|
||||
$(GUETZLI) --quality 90 "$<" "$@"
|
||||
|
||||
|
||||
###
|
||||
|
||||
#$(FFMPEG) -i %1 -map 0 -c copy -c:v libvpx-vp9 -pass 1 -passlogfile "%~dpn1.log" -b:v 150K -threads 1 -deadline good -cpu-used 4 -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 24 -g 9600 -aq-mode 1 -sws_dither none -pix_fmt yuv420p10le -filter:v nlmeans=s=6:p=5:r=7,scale=w=428:h=240:force_original_aspect_ratio=decrease:sws_flags=area:sws_dither=none,crop=trunc(iw/2)*2:trunc(ih/2)*2:0:0 -an -f null NUL
|
||||
#$(FFMPEG) -i %1 -map 0 -c copy -c:v libvpx-vp9 -pass 2 -passlogfile "%~dpn1.log" -b:v 150K -threads 1 -deadline good -cpu-used 1 -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 24 -g 9600 -aq-mode 1 -sws_dither none -pix_fmt yuv420p10le -filter:v nlmeans=s=6:p=5:r=7,scale=w=428:h=240:force_original_aspect_ratio=decrease:sws_flags=area:sws_dither=none,crop=trunc(iw/2)*2:trunc(ih/2)*2:0:0 -c:a libopus -b:a 32k -ac 2 -f webm "%~dpn1.webm"
|
||||
Reference in New Issue
Block a user