this repo has no description
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

➖ Remove dependency on video-rs and ffmpeg-next

authored by

Gwenn Le Bihan and committed by
Gwenn Le Bihan
cffb9853 164bf3d9

+11 -194
+2 -26
.github/workflows/check.yml
··· 7 7 steps: 8 8 - uses: actions/checkout@v2 9 9 - name: install system deps for ffmpeg-sys-next 10 - run: | 11 - sudo apt update 12 - sudo apt install -y \ 13 - pkg-config \ 14 - clang \ 15 - libavcodec-dev \ 16 - libavdevice-dev \ 17 - libavfilter-dev \ 18 - libavformat-dev \ 19 - libswresample-dev \ 20 - libavutil-dev \ 21 - libpostproc-dev \ 22 - libswscale-dev 10 + run: sudo apt-get update && sudo apt-get install -y ffmpeg 23 11 - uses: actions-rs/toolchain@v1 24 12 with: { toolchain: stable } 25 13 - uses: extractions/setup-just@v1 ··· 64 52 steps: 65 53 - uses: actions/checkout@v2 66 54 - name: install system deps for ffmpeg-sys-next 67 - run: | 68 - sudo apt update 69 - sudo apt install -y \ 70 - pkg-config \ 71 - clang \ 72 - libavcodec-dev \ 73 - libavdevice-dev \ 74 - libavfilter-dev \ 75 - libavformat-dev \ 76 - libswresample-dev \ 77 - libavutil-dev \ 78 - libpostproc-dev \ 79 - libswscale-dev 55 + run: sudo apt-get update && sudo apt-get install -y ffmpeg 80 56 - uses: actions-rs/toolchain@v1 81 57 with: { toolchain: stable } 82 58 - uses: actions-rs/cargo@v1
+1 -14
.github/workflows/docs.yml
··· 10 10 runs-on: ubuntu-latest 11 11 steps: 12 12 - uses: actions/checkout@v2 13 - - name: install system deps for ffmpeg-sys-next 14 - run: | 15 - sudo apt update 16 - sudo apt install -y \ 17 - pkg-config \ 18 - clang \ 19 - libavcodec-dev \ 20 - libavdevice-dev \ 21 - libavfilter-dev \ 22 - libavformat-dev \ 23 - libswresample-dev \ 24 - libavutil-dev \ 25 - libpostproc-dev \ 26 - libswscale-dev 13 + - run: sudo apt-get update && sudo apt-get install -y ffmpeg 27 14 - uses: actions-rs/toolchain@v1 28 15 with: { toolchain: stable } 29 16 - uses: actions-rs/cargo@v1
+2 -102
Cargo.lock
··· 207 207 source = "registry+https://github.com/rust-lang/crates.io-index" 208 208 checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 209 209 dependencies = [ 210 - "hermit-abi 0.1.19", 210 + "hermit-abi", 211 211 "libc", 212 212 "winapi 0.3.9", 213 213 ] ··· 250 250 version = "1.7.3" 251 251 source = "registry+https://github.com/rust-lang/crates.io-index" 252 252 checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" 253 - 254 - [[package]] 255 - name = "bindgen" 256 - version = "0.70.1" 257 - source = "registry+https://github.com/rust-lang/crates.io-index" 258 - checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" 259 - dependencies = [ 260 - "bitflags 2.8.0", 261 - "cexpr", 262 - "clang-sys", 263 - "itertools 0.13.0", 264 - "proc-macro2", 265 - "quote", 266 - "regex", 267 - "rustc-hash 1.1.0", 268 - "shlex", 269 - "syn 2.0.98", 270 - ] 271 253 272 254 [[package]] 273 255 name = "bitflags" ··· 458 440 "rand 0.8.5", 459 441 "regex", 460 442 "rusqlite", 461 - "rustc-hash 2.1.1", 443 + "rustc-hash", 462 444 "rustc-stable-hash", 463 445 "rustfix", 464 446 "same-file", ··· 616 598 ] 617 599 618 600 [[package]] 619 - name = "cexpr" 620 - version = "0.6.0" 621 - source = "registry+https://github.com/rust-lang/crates.io-index" 622 - checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" 623 - dependencies = [ 624 - "nom", 625 - ] 626 - 627 - [[package]] 628 601 name = "cfg-if" 629 602 version = "0.1.10" 630 603 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 654 627 "num-traits", 655 628 "wasm-bindgen", 656 629 "windows-targets 0.52.6", 657 - ] 658 - 659 - [[package]] 660 - name = "clang-sys" 661 - version = "1.8.1" 662 - source = "registry+https://github.com/rust-lang/crates.io-index" 663 - checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" 664 - dependencies = [ 665 - "glob", 666 - "libc", 667 - "libloading", 668 630 ] 669 631 670 632 [[package]] ··· 1249 1211 ] 1250 1212 1251 1213 [[package]] 1252 - name = "ffmpeg-next" 1253 - version = "7.1.0" 1254 - source = "registry+https://github.com/rust-lang/crates.io-index" 1255 - checksum = "da02698288e0275e442a47fc12ca26d50daf0d48b15398ba5906f20ac2e2a9f9" 1256 - dependencies = [ 1257 - "bitflags 2.8.0", 1258 - "ffmpeg-sys-next", 1259 - "libc", 1260 - ] 1261 - 1262 - [[package]] 1263 - name = "ffmpeg-sys-next" 1264 - version = "7.1.0" 1265 - source = "registry+https://github.com/rust-lang/crates.io-index" 1266 - checksum = "2bc3234d0a4b2f7d083699d0860c6c9dd83713908771b60f94a96f8704adfe45" 1267 - dependencies = [ 1268 - "bindgen", 1269 - "cc", 1270 - "libc", 1271 - "num_cpus", 1272 - "pkg-config", 1273 - "vcpkg", 1274 - ] 1275 - 1276 - [[package]] 1277 1214 name = "fiat-crypto" 1278 1215 version = "0.2.9" 1279 1216 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2421 2358 ] 2422 2359 2423 2360 [[package]] 2424 - name = "hermit-abi" 2425 - version = "0.3.9" 2426 - source = "registry+https://github.com/rust-lang/crates.io-index" 2427 - checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 2428 - 2429 - [[package]] 2430 2361 name = "hex" 2431 2362 version = "0.4.3" 2432 2363 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3503 3434 ] 3504 3435 3505 3436 [[package]] 3506 - name = "num_cpus" 3507 - version = "1.16.0" 3508 - source = "registry+https://github.com/rust-lang/crates.io-index" 3509 - checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 3510 - dependencies = [ 3511 - "hermit-abi 0.3.9", 3512 - "libc", 3513 - ] 3514 - 3515 - [[package]] 3516 3437 name = "num_threads" 3517 3438 version = "0.1.7" 3518 3439 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4150 4071 4151 4072 [[package]] 4152 4073 name = "rustc-hash" 4153 - version = "1.1.0" 4154 - source = "registry+https://github.com/rust-lang/crates.io-index" 4155 - checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 4156 - 4157 - [[package]] 4158 - name = "rustc-hash" 4159 4074 version = "2.1.1" 4160 4075 source = "registry+https://github.com/rust-lang/crates.io-index" 4161 4076 checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" ··· 4268 4183 version = "0.1.0" 4269 4184 dependencies = [ 4270 4185 "env_logger", 4271 - "ffmpeg-next", 4272 4186 "rand 0.9.0", 4273 4187 "shapemaker", 4274 4188 ] ··· 4493 4407 "console", 4494 4408 "docopt", 4495 4409 "env_logger", 4496 - "ffmpeg-next", 4497 4410 "futures-util", 4498 4411 "getrandom 0.2.14", 4499 4412 "indexmap", ··· 4524 4437 "toml 0.8.20", 4525 4438 "tungstenite", 4526 4439 "url", 4527 - "video-rs", 4528 4440 "wasm-bindgen", 4529 4441 "watchexec", 4530 4442 "watchexec-events", ··· 5338 5250 version = "0.9.4" 5339 5251 source = "registry+https://github.com/rust-lang/crates.io-index" 5340 5252 checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 5341 - 5342 - [[package]] 5343 - name = "video-rs" 5344 - version = "0.10.3" 5345 - source = "registry+https://github.com/rust-lang/crates.io-index" 5346 - checksum = "9c9f6df3b49d862ea35d2c509801ee64983f2169ea02e3a8642e69ce2230e47c" 5347 - dependencies = [ 5348 - "ffmpeg-next", 5349 - "ndarray", 5350 - "tracing", 5351 - "url", 5352 - ] 5353 5253 5354 5254 [[package]] 5355 5255 name = "vst3-com"
+1 -3
Cargo.toml
··· 48 48 "dep:miette", 49 49 ] 50 50 web = ["dep:wasm-bindgen", "dep:web-sys"] 51 - mp4 = ["dep:env_logger", "dep:ffmpeg-next", "dep:video-rs"] 51 + mp4 = ["dep:env_logger"] 52 52 53 53 [dependencies] 54 54 nih_plug = { git = "https://github.com/robbert-vdh/nih-plug.git", features = [ ··· 91 91 env_logger = { version = "0.11.6", optional = true } 92 92 log = "0.4.26" 93 93 ndarray = "0.16.1" 94 - video-rs = { version = "0.10.3", features = ["ndarray"], optional = true } 95 - ffmpeg-next = { version = "7.1.0", optional = true } 96 94 rayon = "1.10.0" 97 95 futures-util = "0.3.31" 98 96 ws = { version = "0.9.2", optional = true }
-1
examples/schedule-hell-backbone/Cargo.toml
··· 5 5 6 6 [dependencies] 7 7 env_logger = "0.11.8" 8 - ffmpeg-next = "7.1.0" 9 8 rand = "0.9.0" 10 9 shapemaker = { version = "1.2.2", path = "../.." }
+5 -46
src/video/encoding.rs
··· 4 4 use anyhow::Result; 5 5 use indicatif::ProgressIterator; 6 6 use measure_time::debug_time; 7 - use rayon::iter::ParallelIterator; 8 - use rayon::{iter::IndexedParallelIterator, slice::ParallelSliceMut}; 9 7 use std::io::Write; 10 8 use std::sync::mpsc::Sender; 11 9 use std::thread; 10 + use std::time::Duration; 12 11 use std::{fs::create_dir_all, path::PathBuf}; 13 - use video_rs::Time; 14 - 15 - impl Canvas { 16 - pub fn render_to_hwc_frame( 17 - &mut self, 18 - size: (usize, usize), 19 - ) -> anyhow::Result<video_rs::Frame> { 20 - let (width, height) = size; 21 - let pixmap = self.render_to_pixmap(width as u32, height as u32)?; 22 - self.pixmap_to_hwc_frame(size, &pixmap) 23 - } 24 - 25 - pub fn pixmap_to_hwc_frame( 26 - &self, 27 - size: (usize, usize), 28 - pixmap: &tiny_skia::Pixmap, 29 - ) -> anyhow::Result<video_rs::Frame> { 30 - debug_time!("pixmap_to_hwc_frame"); 31 - let (width, height) = size; 32 - let mut data = vec![0u8; height * width * 3]; 33 - 34 - data.par_chunks_exact_mut(3) 35 - .enumerate() 36 - .for_each(|(index, chunk)| { 37 - let x = index % width; 38 - let y = index / width; 39 - 40 - let pixel = 41 - pixmap.pixel(x as u32, y as u32).unwrap_or_else(|| { 42 - panic!("No pixel found at x, y = {x}, {y}") 43 - }); 44 - 45 - chunk[0] = pixel.red(); 46 - chunk[1] = pixel.green(); 47 - chunk[2] = pixel.blue(); 48 - }); 49 - 50 - Ok(video_rs::Frame::from_shape_vec([height, width, 3], data)?) 51 - } 52 - } 53 12 54 13 impl<AdditionalContext: Default> Video<AdditionalContext> { 55 14 fn setup_encoder( ··· 89 48 90 49 pub fn render_frames( 91 50 &self, 92 - output: Sender<(video_rs::Time, String)>, 51 + output: Sender<(Duration, String)>, 93 52 ) -> Result<usize> { 94 53 debug_time!("render_frames"); 95 54 let mut written_frames_count: usize = 0; ··· 188 147 189 148 if context.frame != previous_rendered_frame { 190 149 output.send(( 191 - Time::from_secs_f64(context.ms as f64 * 1e-3), 150 + Duration::from_millis(context.ms as _), 192 151 stringify_svg( 193 152 canvas 194 153 .render_to_svg( ··· 199 158 ) 200 159 .unwrap(), 201 160 ), 202 - )); 161 + ))?; 203 162 204 163 written_frames_count += 1; 205 164 ··· 267 226 fn encode_frame( 268 227 encoder: &mut std::process::Child, 269 228 resolution: u32, 270 - timestamp: Time, 229 + _timestamp: Duration, 271 230 canvas: &Canvas, 272 231 svg: &String, 273 232 ) -> anyhow::Result<()> {
-2
src/video/engine.rs
··· 9 9 use chrono::{DateTime, NaiveDateTime}; 10 10 use indicatif::ProgressBar; 11 11 use measure_time::debug_time; 12 - #[cfg(feature = "mp4")] 13 - use std::sync::{Arc, Mutex}; 14 12 use std::{fmt::Formatter, panic, path::PathBuf}; 15 13 16 14 pub type BeatNumber = usize;