From 03a34d34484580f607bff6af6bbc15c3bd8cc459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Mon, 10 Aug 2026 08:51:27 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(engine):=20VP9=20import=20via?= =?UTF-8?q?=20the=20VA-API=20plugin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The demuxer takes a vp09 track alongside avc1 and hands its samples through untouched -- an mp4 VP9 sample is a self-contained superframe, so there is no avcC repack and no parameter sets to re-inject. VideoMeta carries the codec, and the plugin picks its cros-codecs decoder from it. The C ABI is unchanged on purpose: the plugin demuxes the file it is given, so the codec is a property of the container rather than of the call, and a libengine_hw.so built before this still loads and still decodes H.264 -- it simply returns null for a VP9 path, the same no it gives for an unsupported profile. There is no software VP9 decoder to fall back to, so a VP9 file the plugin will not take is refused at open, by name, where the front-end can show it -- never a black screen, and never VP9 bytes fed to rusty_h264. One timeline stays one codec, and export re-encodes to H.264 as before; only audio is ever copied packet for packet. --- crates/engine-hw/src/lib.rs | 55 ++++++++++--- crates/engine/src/decode.rs | 16 +++- crates/engine/src/demux.rs | 63 ++++++++++++--- crates/engine/src/export.rs | 9 ++- crates/engine/src/hw.rs | 6 ++ crates/engine/src/lib.rs | 2 +- crates/engine/src/playback.rs | 12 +++ crates/engine/tests/vp9.rs | 146 ++++++++++++++++++++++++++++++++++ scripts/gen_fixtures.sh | 9 +++ 9 files changed, 297 insertions(+), 21 deletions(-) create mode 100644 crates/engine/tests/vp9.rs diff --git a/crates/engine-hw/src/lib.rs b/crates/engine-hw/src/lib.rs index c14e04e..67cf6b1 100644 --- a/crates/engine-hw/src/lib.rs +++ b/crates/engine-hw/src/lib.rs @@ -1,5 +1,6 @@ -//! VA-API H.264 decode and encode, shipped as a `dlopen`-able plugin so the main -//! binary never gets a DT_NEEDED on libva/gbm/drm. Every entry point is +//! VA-API decode (H.264 and VP9) and H.264 encode, shipped as a `dlopen`-able +//! plugin so the main binary never gets a DT_NEEDED on libva/gbm/drm. Every +//! entry point is //! `extern "C"`, catches unwinds and reports failure as a null pointer or a //! negative code: the caller's contract is "any failure means use the software //! codec". @@ -18,6 +19,7 @@ use cros_codecs::backend::vaapi::decoder::VaapiBackend; use cros_codecs::backend::vaapi::encoder::VaapiBackend as VaapiEncBackend; use cros_codecs::codec::h264::parser::{Level, Profile as H264Profile}; use cros_codecs::decoder::stateless::h264::H264; +use cros_codecs::decoder::stateless::vp9::Vp9; use cros_codecs::decoder::stateless::{DecodeError, StatelessDecoder, StatelessVideoDecoder}; use cros_codecs::decoder::{BlockingMode, DecodedHandle, DecoderEvent, StreamInfo}; use cros_codecs::encoder::h264::EncoderConfig as H264Config; @@ -36,12 +38,36 @@ use cros_codecs::video_frame::{UV_PLANE, Y_PLANE}; use cros_codecs::{Fourcc, FrameLayout, PlaneLayout, Resolution}; use gbm::{BufferObjectFlags, Format as GbmFormat}; -use engine::demux::Demuxer; +use engine::demux::{Codec, Demuxer}; use engine::hw::{VhFrame, VhMeta}; type PooledFrame = PooledVideoFrame; -type Decoder = StatelessDecoder>; -type Handle = ::Handle; +type Dec = StatelessDecoder>; +type Handle = as StatelessVideoDecoder>::Handle; + +/// One decoder per codec the demuxer can hand us. Both share the VA-API backend +/// and therefore the same [`Handle`], so everything past `decode` is common; +/// which one exists is decided by the container, never by the caller -- which is +/// why the plugin's C ABI is unchanged and an older `libengine_hw.so` still +/// loads and still decodes H.264 (it simply refuses VP9 files at `Demuxer`). +/// +/// ponytail: VP9 profile 0 (8-bit 4:2:0) only. Profile 2 decodes 10-bit, which +/// the NV12 pool and the `vaGetImage` read-back here cannot carry; the upgrade +/// path is a P010 pool selected from the stream info. +enum Decoder { + H264(Dec), + Vp9(Dec), +} + +impl Decoder { + fn get(&mut self) -> &mut dyn StatelessVideoDecoder { + match self { + Self::H264(d) => d, + Self::Vp9(d) => d, + } + } +} + type Encoder = StatelessEncoder< GenericDmaVideoFrame, VaapiEncBackend>, @@ -148,7 +174,14 @@ impl Session { .ok()? .into_iter() .find(|f| f.fourcc == VA_FOURCC_NV12)?; - let decoder = Decoder::new_vaapi(display, BlockingMode::Blocking).ok()?; + let decoder = match meta.codec { + Codec::H264 => { + Decoder::H264(Dec::::new_vaapi(display, BlockingMode::Blocking).ok()?) + } + Codec::Vp9 => { + Decoder::Vp9(Dec::::new_vaapi(display, BlockingMode::Blocking).ok()?) + } + }; let pool = FramePool::new(move |info: &StreamInfo| { alloc_nv12(&gbm, info.coded_resolution).expect("output frame allocation failed") }); @@ -191,11 +224,12 @@ impl Session { // Stop draining as soon as we have a picture: every handle we hold // keeps a pool buffer out of circulation. while self.ready.is_empty() { - match self.decoder.next_event() { + match self.decoder.get().next_event() { Some(DecoderEvent::FrameReady(handle)) => self.ready.push_back(handle), Some(DecoderEvent::FormatChanged) => { let info = self .decoder + .get() .stream_info() .ok_or("format changed without stream info")? .clone(); @@ -222,7 +256,7 @@ impl Session { match self.demuxer.next_access_unit() { Ok(Some(au)) => self.pending = au, Ok(None) => { - self.decoder.flush().map_err(|e| e.to_string())?; + self.decoder.get().flush().map_err(|e| e.to_string())?; self.flushed = true; continue; } @@ -237,7 +271,10 @@ impl Session { timestamp, .. } = self; - match decoder.decode(*timestamp, pending, &mut || pool.alloc()) { + match decoder + .get() + .decode(*timestamp, pending, &mut || pool.alloc()) + { Ok(0) => return Err("decoder consumed no input".into()), Ok(n) => { pending.drain(..n.min(pending.len())); diff --git a/crates/engine/src/decode.rs b/crates/engine/src/decode.rs index d354878..af03f20 100644 --- a/crates/engine/src/decode.rs +++ b/crates/engine/src/decode.rs @@ -10,7 +10,7 @@ use std::thread; use rusty_h264::Decoder; use crate::convert::i420_to_bgra; -use crate::demux::{Demuxer, VideoMeta}; +use crate::demux::{Codec, Demuxer, VideoMeta}; use crate::hw::HwSession; /// One decoded picture, ready to hand to a renderer. @@ -181,6 +181,14 @@ impl DecodeSession { ) -> crate::Result<(VideoMeta, FrameStream)> { let path = path.as_ref().to_path_buf(); let (meta, demuxer) = Demuxer::open(&path)?; + // No software VP9 decoder exists, so a VP9 file the plugin will not take + // is refused *here*, where the caller still has somewhere to show it -- + // a worker that opened and then produced nothing is a black screen with + // no explanation. The probe session is opened and dropped: it costs one + // extra VA-API init (~90 ms) and only on the VP9 path. + if meta.codec != Codec::H264 && open_hw(&path, start_frame).is_none() { + return Err(crate::demux::VP9_NEEDS_PLUGIN.into()); + } let end_frame = end_frame.min(meta.frame_count); // Small bound: a 720p BGRA frame is ~3.5 MB, so we must not let the // decoder run ahead of the display without limit. @@ -227,6 +235,12 @@ impl DecodeSession { // still a fallback case, not a dead session. eprintln!("hardware decode failed before any frame, falling back to software"); } + // ...except where there is nothing to fall back to. Feeding VP9 + // bytes to `rusty_h264` would be garbage, not a fallback. + if meta.codec != Codec::H264 { + eprintln!("{}", crate::demux::VP9_NEEDS_PLUGIN); + return; + } eprintln!("decode backend: software (rusty_h264)"); run(demuxer, tx, start_frame, end_frame, &worker_cancel) })?; diff --git a/crates/engine/src/demux.rs b/crates/engine/src/demux.rs index 1d22864..6555f5a 100644 --- a/crates/engine/src/demux.rs +++ b/crates/engine/src/demux.rs @@ -1,4 +1,6 @@ -//! MP4 demux: pulls the H.264 track out as Annex-B access units. +//! MP4 demux: pulls the video track out as access units the decoders take -- +//! Annex-B for H.264, the sample bytes untouched for VP9 (an mp4 VP9 sample is +//! a self-contained superframe already). use std::fs::File; use std::io::BufReader; @@ -8,19 +10,47 @@ use mp4::{MediaType, Mp4Reader}; const START_CODE: [u8; 4] = [0, 0, 0, 1]; +/// What the video track is coded with. Not a decoder choice by itself: VP9 has +/// no software decoder at all, which is what [`VP9_NEEDS_PLUGIN`] says. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Codec { + H264, + Vp9, +} + +impl Codec { + /// How a refusal names it, and how a mismatch reads to a user. + pub fn name(self) -> &'static str { + match self { + Self::H264 => "H.264", + Self::Vp9 => "VP9", + } + } +} + +/// Why a VP9 file can be refused outright: `rusty_h264` is the only software +/// decoder in the project and there is no pure-Rust VP9 one to fall back to, so +/// without the plugin there is nothing to decode with. Shared so playback and +/// export refuse in the same words. +pub const VP9_NEEDS_PLUGIN: &str = + "VP9 needs the VA-API plugin (libengine_hw.so) — there is no software VP9 decoder"; + #[derive(Debug, Clone, Copy, PartialEq)] pub struct VideoMeta { pub width: u32, pub height: u32, pub frame_rate: f64, pub frame_count: u32, + pub codec: Codec, } pub struct Demuxer { reader: Mp4Reader>, track_id: u32, sample_count: u32, - /// Annex-B SPS+PPS, re-injected ahead of every sync sample. + codec: Codec, + /// Annex-B SPS+PPS, re-injected ahead of every sync sample. Empty for VP9, + /// which carries no out-of-band parameter sets. parameter_sets: Vec, /// `stss` entries, ascending 1-based sample ids. Empty means no `stss` box /// at all, i.e. every sample is a sync sample. @@ -37,8 +67,13 @@ impl Demuxer { let track = reader .tracks() .values() - .find(|t| matches!(t.media_type(), Ok(MediaType::H264))) - .ok_or("no H.264 video track in file")?; + .find_map(|t| match t.media_type() { + Ok(MediaType::H264) => Some((t, Codec::H264)), + Ok(MediaType::VP9) => Some((t, Codec::Vp9)), + _ => None, + }) + .ok_or("no H.264 or VP9 video track in file")?; + let (track, codec) = track; let track_id = track.track_id(); let meta = VideoMeta { @@ -46,12 +81,15 @@ impl Demuxer { height: track.height() as u32, frame_rate: track.frame_rate(), frame_count: 0, + codec, }; let mut parameter_sets = Vec::new(); - parameter_sets.extend_from_slice(&START_CODE); - parameter_sets.extend_from_slice(track.sequence_parameter_set()?); - parameter_sets.extend_from_slice(&START_CODE); - parameter_sets.extend_from_slice(track.picture_parameter_set()?); + if codec == Codec::H264 { + parameter_sets.extend_from_slice(&START_CODE); + parameter_sets.extend_from_slice(track.sequence_parameter_set()?); + parameter_sets.extend_from_slice(&START_CODE); + parameter_sets.extend_from_slice(track.picture_parameter_set()?); + } let sync_samples = track .trak .mdia @@ -72,6 +110,7 @@ impl Demuxer { reader, track_id, sample_count, + codec, parameter_sets, sync_samples, next_sample: 1, // sample ids are 1-based @@ -79,7 +118,8 @@ impl Demuxer { )) } - /// Next access unit in decode order, Annex-B framed. `None` at end of track. + /// Next access unit in decode order: Annex-B framed for H.264, the mp4 + /// sample verbatim for VP9. `None` at end of track. pub fn next_access_unit(&mut self) -> crate::Result>> { if self.next_sample > self.sample_count { return Ok(None); @@ -89,6 +129,11 @@ impl Demuxer { let Some(sample) = sample else { return Ok(None); }; + // A VP9 mp4 sample is one (super)frame the decoder parses on its own: + // no length prefixes to strip, no parameter sets to re-inject. + if self.codec == Codec::Vp9 { + return Ok(Some(sample.bytes.to_vec())); + } let mut au = Vec::with_capacity(self.parameter_sets.len() + sample.bytes.len() + 16); if sample.is_sync { diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 42bdcc4..a46f232 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -466,7 +466,13 @@ struct SwDecoder { impl SwDecoder { fn open(path: &Path, start_frame: u32) -> crate::Result { - let (_, mut demuxer) = Demuxer::open(path)?; + let (meta, mut demuxer) = Demuxer::open(path)?; + // The software decoder is H.264-only; a VP9 source that got this far + // means the plugin refused it, and the export says so instead of + // handing VP9 bytes to `rusty_h264`. + if meta.codec != crate::demux::Codec::H264 { + return Err(crate::demux::VP9_NEEDS_PLUGIN.into()); + } // Decoding restarts at a sync sample, so pictures between it and the in // point are decoded (the target references them) and then dropped. // Sample ids are 1-based, frame indices 0-based. @@ -513,6 +519,7 @@ mod tests { height, frame_rate, frame_count: 1, + codec: crate::demux::Codec::H264, }; // 1280 * 720 * 30 * 0.1 assert_eq!(bitrate_for(&meta(1280, 720, 30.0)), 2_764_800); diff --git a/crates/engine/src/hw.rs b/crates/engine/src/hw.rs index dff2d34..edd808d 100644 --- a/crates/engine/src/hw.rs +++ b/crates/engine/src/hw.rs @@ -8,6 +8,12 @@ //! Decode and encode resolve their symbols into *separate* tables on purpose: a //! plugin built before the encode entry points existed must still decode, so a //! missing `vh_enc_*` may only cost us [`HwEncoder`], never [`HwSession`]. +//! +//! The codec is *not* part of this ABI and adding VP9 did not change it: the +//! plugin demuxes the file it is given and picks its decoder from the container, +//! so a plugin older than VP9 support simply returns null for a VP9 path -- the +//! same "no" it gives for an unsupported profile, and the caller's honest +//! [`crate::demux::VP9_NEEDS_PLUGIN`] refusal covers both. use std::ffi::{CString, c_char, c_void}; use std::path::{Path, PathBuf}; diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index aae94c3..a17899c 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -17,7 +17,7 @@ pub mod waveform; pub use audio::{AacPacket, AacTrackParams, AudioChunk, AudioMeta, AudioProbe, AudioSession}; pub use clock::PlaybackClock; pub use decode::{DecodeSession, Frame}; -pub use demux::VideoMeta; +pub use demux::{Codec, VideoMeta}; pub use export::ExportHandle; pub use mux::{AudioParams, Mp4Muxer, VideoParams}; pub use playback::PlaybackSession; diff --git a/crates/engine/src/playback.rs b/crates/engine/src/playback.rs index 79cc2f3..9d3ea6f 100644 --- a/crates/engine/src/playback.rs +++ b/crates/engine/src/playback.rs @@ -716,6 +716,18 @@ fn matches_timeline( timeline: &VideoMeta, first: &Option, ) -> crate::Result<()> { + // Codec first: one timeline is one kind of source. Mixing them would decode + // (every clip opens its own decoder) but on a machine without the VA-API + // plugin the VP9 half would be black frames with the refusal only on + // stderr, which is exactly what a front-end cannot show. + if meta.codec != timeline.codec { + return Err(format!( + "{} does not match the timeline's {}", + meta.codec.name(), + timeline.codec.name() + ) + .into()); + } if (meta.width, meta.height) != (timeline.width, timeline.height) { return Err(format!( "{}x{} does not match the timeline's {}x{}", diff --git a/crates/engine/tests/vp9.rs b/crates/engine/tests/vp9.rs new file mode 100644 index 0000000..def51b8 --- /dev/null +++ b/crates/engine/tests/vp9.rs @@ -0,0 +1,146 @@ +//! VP9 import: the first source codec that is not H.264. +//! +//! The container and refusal checks need nothing installed. The decode and +//! export twins need a built `libengine_hw.so` and a VA-API driver with a VP9 +//! decode entrypoint (`vainfo | grep VP9`), so they are `#[ignore]`d: +//! +//! ```text +//! cargo build -p engine -p engine-hw --release +//! LD_LIBRARY_PATH=target/release \ +//! cargo test -p engine --release --test vp9 -- --include-ignored --nocapture --test-threads=1 +//! ``` +//! +//! `VE_SW` is process-wide, hence `--test-threads=1`: the refusal test sets it +//! and puts it back so the hardware twins below really are hardware. + +use std::path::PathBuf; +use std::time::{Duration, Instant}; + +use engine::demux::{Codec, Demuxer}; +use engine::export::ExportSettings; +use engine::{AudioSession, DecodeSession, PlaybackSession, Project}; + +/// 1280x720@30, 2 s -- see `scripts/gen_fixtures.sh`. +const FRAMES: u32 = 60; + +fn asset(name: &str) -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("../../assets") + .join(name) +} + +/// The container half: a vp09 track is found, described and named as VP9, and +/// its AAC track is read exactly as any other file's -- the audio path knows +/// nothing about the video codec and this is what says so. +#[test] +fn the_demuxer_reports_a_vp9_track() { + let (meta, _) = Demuxer::open(&asset("test_vp9.mp4")).expect("open test_vp9.mp4"); + assert_eq!(meta.codec, Codec::Vp9); + assert_eq!((meta.width, meta.height), (1280, 720)); + assert!((meta.frame_rate - 30.0).abs() < 0.01, "{}", meta.frame_rate); + assert_eq!(meta.frame_count, FRAMES); + + let probe = AudioSession::probe(asset("test_vp9.mp4")) + .expect("probe") + .expect("the fixture has an AAC track"); + assert_eq!( + (probe.params.sample_rate, probe.channels), + (44_100, 2), + "audio is read the same whatever the picture is coded with" + ); + + // The invariant, stated as an assert: H.264 files still say H.264. + let (h264, _) = Demuxer::open(&asset("test_baseline.mp4")).expect("open test_baseline.mp4"); + assert_eq!(h264.codec, Codec::H264); +} + +/// There is no software VP9 decoder, so the software path must refuse by name +/// rather than feed VP9 bytes to `rusty_h264` -- and it must refuse where a +/// caller can still show it, i.e. out of `open`, not from inside the worker. +#[test] +fn the_software_path_refuses_vp9_by_name() { + // SAFETY: the suite is documented to run with --test-threads=1. + unsafe { std::env::set_var("VE_SW", "1") }; + let refused = + DecodeSession::open(asset("test_vp9.mp4")).expect_err("software must not accept VP9"); + let refused = refused.to_string(); + // Restored immediately: the hardware tests in this binary share the process. + unsafe { std::env::remove_var("VE_SW") }; + + assert!(refused.contains("VP9"), "{refused}"); + assert!(refused.contains("plugin"), "{refused}"); + // H.264 is untouched by all of this. + unsafe { std::env::set_var("VE_SW", "1") }; + let h264 = DecodeSession::open(asset("test_baseline.mp4")).is_ok(); + unsafe { std::env::remove_var("VE_SW") }; + assert!(h264, "software H.264 decode still opens"); +} + +/// A VP9 timeline is refused a source coded differently, in the same words a +/// resolution mismatch is refused in: a front-end shows the string as it is. +#[test] +fn a_timeline_refuses_the_other_codec() { + let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open test_av.mp4"); + let refused = session + .import(&asset("test_vp9.mp4")) + .expect_err("VP9 must not join an H.264 timeline") + .to_string(); + assert!(refused.contains("VP9"), "{refused}"); + assert!(refused.contains("H.264"), "{refused}"); +} + +/// The end-to-end user path: opening the file yields pictures, all of them, +/// through the plugin. +#[test] +#[ignore = "needs libengine_hw.so and a VA-API driver with VP9 decode"] +fn the_plugin_decodes_every_vp9_frame() { + let start = Instant::now(); + let (meta, frames) = DecodeSession::open(asset("test_vp9.mp4")).expect("open test_vp9.mp4"); + assert_eq!(meta.codec, Codec::Vp9); + let frames: Vec<_> = frames.into_iter().collect(); + eprintln!( + "test_vp9.mp4: {} frames in {:?}", + frames.len(), + start.elapsed() + ); + + assert_eq!(frames.len() as u32, FRAMES, "every sample decoded"); + for (i, frame) in frames.iter().enumerate() { + assert_eq!((frame.width, frame.height), (1280, 720), "frame {i} dims"); + assert_eq!(frame.index, i as u32, "frames arrive in display order"); + assert_eq!(frame.bgra.len(), 1280 * 720 * 4, "frame {i} size"); + } + // A picture, not a flat surface: a driver handing back an untouched buffer + // would satisfy every count above. + let first = &frames[0].bgra; + assert!( + first.chunks_exact(4).any(|px| px != &first[..4]), + "frame 0 is a single colour -- no picture was decoded" + ); +} + +/// Export re-encodes to H.264 whatever the source was coded with: the packet +/// copy path is audio-only, so no VP9 byte can reach an `avc1` track. +#[test] +#[ignore = "needs libengine_hw.so and a VA-API driver with VP9 decode"] +fn a_vp9_source_exports_as_h264() { + let session = PlaybackSession::open(asset("test_vp9.mp4")).expect("open test_vp9.mp4"); + let meta = *session.meta(); + let project = Project::single(asset("test_vp9.mp4"), meta.frame_count); + let out = std::env::temp_dir().join(format!("ve_export_vp9_{}.mp4", std::process::id())); + let _ = std::fs::remove_file(&out); + + let handle = engine::export::start(project, meta, &out, &ExportSettings::default()); + let started = Instant::now(); + while !handle.is_finished() { + assert!(started.elapsed() < Duration::from_secs(120), "export hung"); + std::thread::sleep(Duration::from_millis(20)); + } + handle.result().expect("outcome").expect("export"); + + let (written, _) = Demuxer::open(&out).expect("reopen the export"); + assert_eq!(written.codec, Codec::H264, "exports are always H.264"); + assert_eq!(written.frame_count, FRAMES, "every timeline frame written"); + assert_eq!((written.width, written.height), (1280, 720)); + let _ = std::fs::remove_file(&out); +} diff --git a/scripts/gen_fixtures.sh b/scripts/gen_fixtures.sh index c1255d3..1571f7a 100755 --- a/scripts/gen_fixtures.sh +++ b/scripts/gen_fixtures.sh @@ -25,6 +25,15 @@ ffmpeg -y -f lavfi -i testsrc=size=1280x720:rate=30:duration=4 \ -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \ -map 0:v -map "[a]" -c:v libx264 -profile:v baseline -pix_fmt yuv420p \ -c:a aac -b:a 128k assets/test_av2.mp4 +# VP9 fixture: the same A/V shape as test_av.mp4 (1280x720@30, AAC-LC 44.1k +# stereo) with a VP9 picture, so what the tests measure is the codec and +# nothing else. 2 s, because VP9 only ever decodes on the hardware path. +ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \ + -f lavfi -i "sine=frequency=440:duration=2" \ + -f lavfi -i "sine=frequency=880:duration=2" \ + -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \ + -map 0:v -map "[a]" -c:v libvpx-vp9 -b:v 2M -pix_fmt yuv420p \ + -c:a aac -b:a 128k assets/test_vp9.mp4 # Mismatch fixture: different resolution and no audio track at all, so import # has something concrete to refuse. ffmpeg -y -f lavfi -i testsrc2=size=640x360:rate=30:duration=2 \