Last active
December 11, 2021 14:18
-
-
Save pyldin601/55cbf3ec06b0693909be159d5d6cc84c to your computer and use it in GitHub Desktop.
Compose small videos from video registrator into big single video (with front and back camera tracks)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: clean rename video | |
ffmpeg := /mnt/c/Users/roman/Downloads/ffmpeg-4.4-full_build/ffmpeg-4.4-full_build/bin/ffmpeg.exe | |
filename = $(shell ls Front/${mask}* | head -n 1 | cut -d. -f1 | xargs -n 1 basename) | |
front.txt: | |
ls Front/${mask}* | sed "s/.*/file '&'/" > front.txt | |
back.txt: | |
ls Back/${mask}* | sed "s/.*/file '&'/" > back.txt | |
video: front.txt back.txt | |
${ffmpeg} \ | |
-loglevel error -stats \ | |
-f concat -safe 0 -i front.txt \ | |
-f concat -safe 0 -i back.txt \ | |
-filter_complex "[1]scale=iw/3:ih/3 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10" \ | |
-c:a copy \ | |
-c:v h264_nvenc -profile:v high -bf 2 -g 30 -crf 18 -b:v 20M -pix_fmt yuv420p -s 1920x1080 \ | |
-movflags faststart \ | |
Composed/${filename}.mp4 | |
fix: | |
${ffmpeg} \ | |
-i Composed/NO20210710-163901-002215F.mkv \ | |
-ss 00:05:00 \ | |
-filter_complex "[0:v:1]scale=iw/3:ih/3 [pip]; [0:v:0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10" \ | |
-c:a copy \ | |
-c:v h264_nvenc -profile:v high -bf 2 -g 30 -crf 18 -b:v 20M -pix_fmt yuv420p -s 1920x1080 \ | |
-movflags faststart \ | |
Composed/NO20210710-163901-002215PIP.mp4 | |
clean: | |
rm -f front.txt back.txt | |
all: video clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment