yorukot/superfile · error
error generating video thumbnail, outputPath: %s : %w
Error message
error generating video thumbnail, outputPath: %s : %w
What it means
This error is returned when the ffmpeg child process exits non-zero while extracting a video frame thumbnail to outputPath. It wraps ffmpeg's stderr output so the developer can see why frame extraction failed. It indicates the video thumbnail generation step failed, not the previewer itself.
Source
Thrown at src/pkg/file_preview/thumbnail_generator.go:61
ffmpeg := exec.CommandContext(ctx, "ffmpeg",
"-v", "warning", // set log level to warning
"-an", // disable Audio stream
"-sn", // disable Subtitle stream
"-dn", // disable data stream
"-t", "180", // process maximum 180s of the video (the first 3 min)
"-hwaccel", "auto", // Use Hardware Acceleration if available
"-skip_frame", "nokey", // skip non-key frames
"-i", inputPath, // set input file
"-vf", "thumbnail", // use ffmpeg default thumbnail filter
"-frames:v", "1", // output only one frame (one image)
"-f", "image2", // set format to image2
"-fs", maxVideoFileSizeForThumb, // limit the max file size to match image previewer limit
"-y", outputPath, // set the outputFile and overwrite it without confirmation if already exists
)
err := ffmpeg.Run()
if err != nil {
return "", fmt.Errorf("error generating video thumbnail, outputPath: %s : %w", outputPath, err)
}
return outputPath, nil
}
type pdfGenerator struct{}
func newPdfGenerator() (*pdfGenerator, error) {
if !isPopplerInstalled() {
return nil, errors.New("poppler is not installed")
}
return &pdfGenerator{}, nil
}
func (g *pdfGenerator) supportsExt(ext string) bool {
return strings.ToLower(ext) == ".pdf"
}View on GitHub (pinned to b72f550bc6)
Solutions
- Run the exact ffmpeg command manually (copy args from the error/log) to see the raw stderr.
- Check ffmpeg is installed and on PATH: `which ffmpeg`; install it if absent.
- Verify the input video is playable (`ffprobe <file>`) and not truncated/corrupt.
- Reduce or remove the -ss seek timestamp if it's past the end of the video.
- Check the output directory exists and is writable for outputPath.
Example fix
// before
thumb, err := gen.generateThumbnail(videoPath)
// after
thumb, err := gen.generateThumbnail(videoPath)
if err != nil {
log.Warnf("video thumbnail failed: %v", err)
thumb = defaultVideoIconPath // fallback placeholder
} Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := exec.LookPath("ffmpeg"); err != nil { return errors.New("ffmpeg not installed") }
if fi, err := os.Stat(videoPath); err != nil || fi.Size() == 0 { return errors.New("video missing or empty") } Try / catch
thumb, err := gen.generateThumbnail(videoPath)
if err != nil {
log.Warnf("thumbnail generation failed: %v", err)
thumb = "" // caller shows generic video icon
} Prevention
- Check for ffmpeg in PATH at startup and disable video thumbnails if missing.
- Validate/ffprobe media files before thumbnailing.
- Keep the seek timestamp within the video duration.
- Cache failures to avoid re-running ffmpeg on every preview.
When it happens
Trigger: generateThumbnail invoking ffmpeg with args like -ss, -fs maxVideoFileSizeForThumb, -y outputPath when ffmpeg is missing from PATH, the video file is corrupt/unsupported codec, the seek position exceeds the video duration, or the input file is unreadable.
Common situations: ffmpeg not installed in minimal/container deployments; videos with codecs ffmpeg wasn't built against; zero-byte or truncated downloads; file larger than maxVideoFileSizeForThumb causing early truncation at -fs; paths containing characters that break the command construction.
Related errors
- error generating pdf thumbnail, outputPath: %s : %w
- error generating ps thumbnail, outputPath: %s : %w
AI-assisted analysis of yorukot/superfile@b72f550bc6 (2026-09-01).
Data as JSON: /api/errors/4e538efe794109e2.
Report an issue: GitHub.