You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
video: MP4 with the moov atom at the end fails to decode (ffmpeg reads the container from pipe:0) #239
video_decode_ffmpeg can't decode an MP4 whose moov atom is at the end (ffmpeg's default layout, and what most recorders write).
The decoder streams the container to ffmpeg on stdin (-i pipe:0). An MP4 whose moov index comes after mdat can't be demuxed from a non-seekable pipe, so ffmpeg writes nothing and the request fails with a 400:
Video decode error: decoding an MP4/MOV container: decoder failed: Conversion failed!
Repro (static ffmpeg 7.0.2, aarch64, GB10). It's the same command shape run_ffmpeg builds:
ffmpeg -f lavfi -i testsrc2=size=640x360:rate=10 -t 4 -c:v libx264 -pix_fmt yuv420p clip.mp4 # moov at the end (default)
ffmpeg -v error -nostdin -i pipe:0 -vf "select=1,showinfo,scale=320:-2" -frames:v 40 -fps_mode passthrough \
-f image2pipe -vcodec png pipe:1 < clip.mp4 | wc -c
# 0 ("Nothing was written into output file ... received no packets")
ffmpeg -i clip.mp4 -c copy -movflags +faststart clip-fs.mp4 # moov first
ffmpeg ... < clip-fs.mp4 | wc -c
# 848733
Live, a video_url data-URI request with the default-layout clip got that 400 on two TP2 servers built from the SparkQwen-port stack (#233 and #237 heads). Both carry main's pipe:0 input unchanged, so this isn't from those PRs. Enntity's tree (92dd5435) also uses pipe:0, so SparkQwen likely has the same limitation (cc @data-angel). The pipe input has been in crates/spark-model/src/video_decode_ffmpeg.rs since the file landed in da56736dc (cc @tbraun96).
Possible fixes:
Write MP4/MOV input to a private temp file and pass its path, so ffmpeg can seek. That keeps -nostdin, and the file is deleted after decode.
Or retry through a temp file only when the pipe attempt yields zero frames.
A fragment-aware remux in Rust would be more work.
Receipts: reiner ~/code/night1027/out/stacktop-b4d2a6541/v4-{T,P}.json (the video cell) and the by-hand repro above. Tracking: #220.
Fixed in #286, the port of data-angel's a3ed7d2a0: ffmpeg and ffprobe now read a private, seekable 0600 temp file instead of pipe:0. Checked on the pair: an MP4 with moov at the end returns 200, the same as the faststart one, and a unit test covers both. This closes when #286 merges.
Activity
spark-model: seekable probe input + moov-at-end MP4 probe/decode test…
AzeezIsh commentedon Oct 31, 2026
Fixed in #286, the port of data-angel's
a3ed7d2a0: ffmpeg and ffprobe now read a private, seekable 0600 temp file instead ofpipe:0. Checked on the pair: an MP4 with moov at the end returns 200, the same as the faststart one, and a unit test covers both. This closes when #286 merges.Merge Atlas-Inf#286: vision: SparkQwen 0.4.0 vision/video path (fixes A…