This post recently came across my news feed and outlines a means to convert a modern video to look vintage or 'old timey'. This post will summarize the method and offer a makefile that performs the transformation.
The general effect takes three steps: 1) downsample the frame rate, 2) color adjust to an older style, 3) grab a vcr noise overlay, scale it and apply it.
$ cat -n Makefile
1 all: sideBySide.mp4
2 # https://ottverse.com/create-vintage-videos-using-ffmpeg/
3
4 %.ts: %
5 ${SH} ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $< > $@
6
7 %.size: %
8 ${SH} ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 $< > $@
9
10 input.mp4:
11 ${SH} youtube-dl -f mp4 -o $@ https://www.youtube.com/watch?v=uvy02Cv7DIc
12
13 adjustFps.mp4: input.mp4
14 ${SH} ffmpeg -i $< -filter:v fps=fps=10 -strict -2 $@
15
16 vintageFilter.mp4: adjustFps.mp4
17 ${SH} ffmpeg -i $< -vf curves=vintage -strict -2 $@
18
19 vcrOverlay.mp4:
20 ${SH} youtube-dl -f mp4 https://www.youtube.com/watch?v=J_MZb7qTenE -o $@
21
22 overlay.mp4: vcrOverlay.mp4 input.mp4.ts vcrOverlay.mp4.ts input.mp4.size
23 ${RM} list.txt
24 ${SH} bash -c "for i in {1..$(shell echo `cat $(shell echo $^ | cut -f 2 -d ' ')` / `cat $(shell echo $^ | cut -f 3 -d ' ')` + 1 | bc)}; do printf \"file '%s'\n\" $< >> list.txt; done"
25 ${SH} ffmpeg -f concat -i list.txt -vf scale=$(shell cat $(shell echo $^ | cut -f 4 -d ' ') | sed -e "s/x/:/g"),setsar=1:1 -an $@
26
27 video.mp4: overlay.mp4 vintageFilter.mp4
28 ${SH} ffmpeg -i $(shell echo $^ | cut -f 1 -d ' ') -i $(shell echo $^ | cut -f 2 -d ' ') \
29 -filter_complex "[0]format=rgba,colorchannelmixer=aa=0.25[fg]; [1][fg]overlay[out]" \
30 -map [out] -pix_fmt yuv420p -c:v libx264 -crf 18 $@
31
32 sideBySide.mp4: input.mp4 video.mp4
33 ${SH} ffmpeg -y -i $(shell echo $^ | cut -f 1 -d ' ') -i $(shell echo $^ | cut -f 2 -d ' ') \
34 -filter_complex '[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' -map [vid] \
35 -map 0:a -acodec copy -shortest $@
36
37 clean:
38 ${RM} *.mp4 *.ts list.txt *.size
The end result should give you something of the form of this:
For more details, refer to FFmpeg Official Site: http://ffmpeg.org/
No comments:
Post a Comment