-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffmpeg-commands.txt
130 lines (89 loc) · 5.15 KB
/
ffmpeg-commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Create some ProRes video in Premier or another tool
# Create the two track video
ffmpeg -i transparent-shapes-overlay.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart transparent-shapes-overlay.mp4
# Confirm a track by outputting it's frames as images (look at color-frames/alpha-frames folder for the outputted images)
rm -rf color-frames; mkdir color-frames; ffmpeg -i transparent-shapes-overlay.mp4 -map 0:0 -an color-frames/frame%04d.png;
rm -rf alpha-frames; mkdir alpha-frames; ffmpeg -i transparent-shapes-overlay.mp4 -map 0:1 -an alpha-frames/frame%04d.png
# Transcode ProRes to mp4 single track
ffmpeg -i transparent-shapes-overlay.mov -c:v libx264 -preset medium -crf 23 -movflags +faststart transparent-shapes-overlay-colors-only.mov
rm -rf color-2; mkdir color-2; ffmpeg -i transparent-shapes-overlay.mov -map 0:0 -an color-2/frame%04d.png;
ffmpeg -i transparent-shapes-1280p.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart transparent-shapes-1280p.mp4
# Attempt to run the above on vp8 files fails
ffmpeg -i soccer-vp8-with-alpha.webm \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart soccer-vp8-with-alpha2.mp4
ffmpeg -i rotating-iphone-hevc-with-alpha.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart rotating-iphone-hevc-with-alpha.mp4
ffmpeg -i LightLeak.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart LightLeak.mp4
rm -rf alpha-frames; mkdir alpha-frames; ffmpeg -i /Users/francoislaberge/Downloads/playlist.m3u8 -map 0:1 -an alpha-frames/frame%04d.png
# Support for segmented videos
ffmpeg -i LightLeak.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]format=yuva420p,extractplanes=a[alphaout]" \
-map "[color]" -c:v:0 h264 \
-map "[alphaout]" -c:v:1 h264 \
-f segment -segment_list playlist.m3u8 -segment_time 1 output%03d.ts
# Create some ProRes video in Premier or another tool
# Create the two track video
ffmpeg -i transparent-shapes-overlay.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart transparent-shapes-overlay.mp4
# Confirm a track by outputting it's frames as images (look at color-frames/alpha-frames folder for the outputted images)
rm -rf color-frames; mkdir color-frames; ffmpeg -i transparent-shapes-overlay.mp4 -map 0:0 -an color-frames/frame%04d.png;
rm -rf alpha-frames; mkdir alpha-frames; ffmpeg -i transparent-shapes-overlay.mp4 -map 0:1 -an alpha-frames/frame%04d.png
# Transcode ProRes to mp4 single track
ffmpeg -i transparent-shapes-overlay.mov -c:v libx264 -preset medium -crf 23 -movflags +faststart transparent-shapes-overlay-colors-only.mov
rm -rf color-2; mkdir color-2; ffmpeg -i transparent-shapes-overlay.mov -map 0:0 -an color-2/frame%04d.png;
ffmpeg -i transparent-shapes-1280p.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart transparent-shapes-1280p.mp4
# Attempt to run the above on vp8 files fails
ffmpeg -i soccer-vp8-with-alpha.webm \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart soccer-vp8-with-alpha2.mp4
ffmpeg -i rotating-iphone-hevc-with-alpha.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart rotating-iphone-hevc-with-alpha.mp4
ffmpeg -i LightLeak.mov \
-filter_complex "[0:v]split=2[color][alpha]; \
[alpha]alphaextract,format=gray[alphaout]" \
-map "[color]" -c:v:0 libx264 -b:v:0 5M \
-map "[alphaout]" -c:v:1 libx264 -b:v:1 1M \
-movflags +faststart LightLeak.mp4
rm -rf alpha-frames; mkdir alpha-frames; ffmpeg -i /Users/francoislaberge/Downloads/playlist.m3u8 -map 0:1 -an alpha-frames/frame%04d.png
rm -rf color-frames; mkdir color-frames; ffmpeg -i /Users/francoislaberge/Downloads/0.mp4 -map 0:0 -an color-frames/frame%04d.png;
rm -rf alpha-frames; mkdir alpha-frames; ffmpeg -i /Users/francoislaberge/Downloads/0.mp4 -map 0:1 -an alpha-frames/frame%04d.png