Jordan Legg
commited on
Commit
•
9a6035e
1
Parent(s):
87fae93
changed to 442 proxy
Browse files- create-video.ipynb +86 -6
create-video.ipynb
CHANGED
@@ -132,9 +132,88 @@
|
|
132 |
},
|
133 |
{
|
134 |
"cell_type": "code",
|
135 |
-
"execution_count":
|
136 |
"metadata": {},
|
137 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
"source": [
|
139 |
"import os\n",
|
140 |
"import subprocess\n",
|
@@ -187,10 +266,11 @@
|
|
187 |
" elif codec == 'prores':\n",
|
188 |
" output_file = output_file.rsplit('.', 1)[0] + '.mov' # ProRes is typically used with MOV container\n",
|
189 |
" ffmpeg_command.extend([\n",
|
190 |
-
"
|
191 |
-
"
|
192 |
-
"
|
193 |
-
"
|
|
|
194 |
" logger.info(\"Using ProRes codec (near-lossless)\")\n",
|
195 |
" else:\n",
|
196 |
" logger.error(f\"Unsupported codec: {codec}\")\n",
|
|
|
132 |
},
|
133 |
{
|
134 |
"cell_type": "code",
|
135 |
+
"execution_count": 2,
|
136 |
"metadata": {},
|
137 |
+
"outputs": [
|
138 |
+
{
|
139 |
+
"name": "stderr",
|
140 |
+
"output_type": "stream",
|
141 |
+
"text": [
|
142 |
+
"2024-08-12 22:25:58,907 - INFO - Found 1000 PNG files.\n",
|
143 |
+
"2024-08-12 22:25:58,908 - INFO - Expected duration: 50.00 seconds\n",
|
144 |
+
"2024-08-12 22:25:58,909 - INFO - Using ProRes codec (near-lossless)\n",
|
145 |
+
"2024-08-12 22:25:58,909 - INFO - Starting high-quality video creation with prores codec...\n"
|
146 |
+
]
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"name": "stdout",
|
150 |
+
"output_type": "stream",
|
151 |
+
"text": [
|
152 |
+
"ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers\n",
|
153 |
+
" built with Apple clang version 15.0.0 (clang-1500.3.9.4)\n",
|
154 |
+
" configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon\n",
|
155 |
+
" libavutil 59. 8.100 / 59. 8.100\n",
|
156 |
+
" libavcodec 61. 3.100 / 61. 3.100\n",
|
157 |
+
" libavformat 61. 1.100 / 61. 1.100\n",
|
158 |
+
" libavdevice 61. 1.100 / 61. 1.100\n",
|
159 |
+
" libavfilter 10. 1.100 / 10. 1.100\n",
|
160 |
+
" libswscale 8. 1.100 / 8. 1.100\n",
|
161 |
+
" libswresample 5. 1.100 / 5. 1.100\n",
|
162 |
+
" libpostproc 58. 1.100 / 58. 1.100\n",
|
163 |
+
"[image2 @ 0x13d61ef40] Pattern type 'glob_sequence' is deprecated: use pattern_type 'glob' instead\n",
|
164 |
+
"Input #0, image2, from 'train/%*.png':\n",
|
165 |
+
" Duration: 00:00:50.00, start: 0.000000, bitrate: N/A\n",
|
166 |
+
" Stream #0:0: Video: png, rgb24(pc, gbr/unknown/unknown), 768x1024, 20 fps, 20 tbr, 20 tbn\n",
|
167 |
+
"Stream mapping:\n",
|
168 |
+
" Stream #0:0 -> #0:0 (png (native) -> prores (prores_ks))\n",
|
169 |
+
"Press [q] to stop, [?] for help\n",
|
170 |
+
"Output #0, mov, to 'high_quality_output.mov':\n",
|
171 |
+
" Metadata:\n",
|
172 |
+
" encoder : Lavf61.1.100\n",
|
173 |
+
" Stream #0:0: Video: prores (Proxy) (apco / 0x6F637061), yuv444p10le(progressive), 768x1024, q=2-31, 200 kb/s, 20 fps, 10240 tbn\n",
|
174 |
+
" Metadata:\n",
|
175 |
+
" encoder : Lavc61.3.100 prores_ks\n",
|
176 |
+
"frame= 56 fps=0.0 q=-0.0 size= 7936KiB time=00:00:02.80 bitrate=23218.6kbits/s speed=5.56x \n",
|
177 |
+
"frame= 125 fps=124 q=-0.0 size= 17664KiB time=00:00:06.25 bitrate=23152.6kbits/s speed=6.19x \n",
|
178 |
+
"frame= 199 fps=131 q=-0.0 size= 28416KiB time=00:00:09.95 bitrate=23395.4kbits/s speed=6.57x \n",
|
179 |
+
"frame= 278 fps=138 q=-0.0 size= 39936KiB time=00:00:13.90 bitrate=23536.4kbits/s speed=6.88x \n",
|
180 |
+
"frame= 352 fps=139 q=-0.0 size= 50944KiB time=00:00:17.60 bitrate=23712.1kbits/s speed=6.97x \n",
|
181 |
+
"frame= 419 fps=138 q=-0.0 size= 60416KiB time=00:00:20.95 bitrate=23624.3kbits/s speed=6.92x \n",
|
182 |
+
"frame= 485 fps=137 q=-0.0 size= 70144KiB time=00:00:24.25 bitrate=23695.7kbits/s speed=6.87x \n",
|
183 |
+
"frame= 561 fps=139 q=-0.0 size= 81152KiB time=00:00:28.05 bitrate=23700.4kbits/s speed=6.96x \n",
|
184 |
+
"frame= 631 fps=139 q=-0.0 size= 91136KiB time=00:00:31.55 bitrate=23663.6kbits/s speed=6.96x \n",
|
185 |
+
"frame= 711 fps=141 q=-0.0 size= 102912KiB time=00:00:35.55 bitrate=23714.6kbits/s speed=7.06x \n",
|
186 |
+
"frame= 784 fps=141 q=-0.0 size= 113408KiB time=00:00:39.20 bitrate=23700.0kbits/s speed=7.07x \n",
|
187 |
+
"frame= 864 fps=143 q=-0.0 size= 124928KiB time=00:00:43.20 bitrate=23690.1kbits/s speed=7.14x \n"
|
188 |
+
]
|
189 |
+
},
|
190 |
+
{
|
191 |
+
"name": "stderr",
|
192 |
+
"output_type": "stream",
|
193 |
+
"text": [
|
194 |
+
"2024-08-12 22:26:05,979 - INFO - Encoding speed: 7.3100x\n",
|
195 |
+
"2024-08-12 22:26:05,980 - INFO - Video created successfully: high_quality_output.mov\n",
|
196 |
+
"2024-08-12 22:26:06,034 - INFO - Video properties:\n",
|
197 |
+
"codec_name=prores\n",
|
198 |
+
"width=768\n",
|
199 |
+
"height=1024\n",
|
200 |
+
"duration=50.000000\n",
|
201 |
+
"bit_rate=23781117\n",
|
202 |
+
"\n",
|
203 |
+
"2024-08-12 22:26:06,076 - INFO - Actual video duration: 50.00 seconds\n",
|
204 |
+
"2024-08-12 22:26:06,076 - INFO - Video duration check passed.\n"
|
205 |
+
]
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"name": "stdout",
|
209 |
+
"output_type": "stream",
|
210 |
+
"text": [
|
211 |
+
"frame= 944 fps=144 q=-0.0 size= 136704KiB time=00:00:47.20 bitrate=23726.3kbits/s speed= 7.2x \n",
|
212 |
+
"[out#0/mov @ 0x13d70efa0] video:145148KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.004134%\n",
|
213 |
+
"frame= 1000 fps=146 q=-0.0 Lsize= 145154KiB time=00:00:50.00 bitrate=23782.1kbits/s speed=7.31x \n"
|
214 |
+
]
|
215 |
+
}
|
216 |
+
],
|
217 |
"source": [
|
218 |
"import os\n",
|
219 |
"import subprocess\n",
|
|
|
266 |
" elif codec == 'prores':\n",
|
267 |
" output_file = output_file.rsplit('.', 1)[0] + '.mov' # ProRes is typically used with MOV container\n",
|
268 |
" ffmpeg_command.extend([\n",
|
269 |
+
" '-c:v', 'prores_ks',\n",
|
270 |
+
" '-profile:v', 'proxy', # Use ProRes 422 Proxy profile\n",
|
271 |
+
" '-qscale:v', '11' # Adjust quality scale; higher values mean lower quality. 11 is typical for proxy quality.\n",
|
272 |
+
"])\n",
|
273 |
+
"\n",
|
274 |
" logger.info(\"Using ProRes codec (near-lossless)\")\n",
|
275 |
" else:\n",
|
276 |
" logger.error(f\"Unsupported codec: {codec}\")\n",
|