Commit 2cd338a
authored
fix(encode): order ffmpeg inputs ahead of output options (#143)
* fix(encode): order ffmpeg inputs ahead of output options
FFmpeg parses argv positionally: an option applies to the next `-i` that
follows it. The audio input was emitted after the codec block, so `-c:v`,
`-crf`, `-profile:v` and `-pix_fmt` were read as *input* options for
audio.raw and ffmpeg refused to start with "Option profile:v cannot be
applied to input url". Every scenario carrying an audio track — or an
embedded video with a soundtrack — failed to encode, on all four codecs,
through the default path.
Move the audio input next to the video input and keep `-c:a`/`-b:a` with
the output description. The argv assembly moves into `ffmpeg_args`, a pure
function, so the ordering invariant is unit-testable without an ffmpeg
binary on the machine.
A broken pipe here almost always means ffmpeg already died on its own
arguments, so `FfmpegWrite` now carries the tail of ffmpeg's stderr. It
used to be printed only outside `--quiet`, which left the diagnosis of
this very bug reading "Failed to write to FFmpeg pipe: Broken pipe".
* style(encode): apply rustfmt to the ffmpeg argv builder1 parent e442799 commit 2cd338a
2 files changed
Lines changed: 241 additions & 117 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
166 | 172 | | |
167 | 173 | | |
168 | 174 | | |
| |||
0 commit comments