Skip to content

Multiple video processing fixes#697

Merged
davidmz merged 4 commits intostablefrom
fix-video-process
Feb 6, 2026
Merged

Multiple video processing fixes#697
davidmz merged 4 commits intostablefrom
fix-video-process

Conversation

@davidmz
Copy link
Member

@davidmz davidmz commented Feb 5, 2026

Fixed

  • Fixed video attachment processing issues:
    • Original file is no longer lost when video processing fails.
    • Video attachments that fail processing now fall back to 'general' type with
      correct file extension (e.g., .mp4) instead of .tmp
    • Fixed WebP encoder errors when extracting still frames from videos - still
      frame is now extracted in a separate ffmpeg command with explicit static
      WebP codec.
    • Fixed video previews being created from embedded cover art instead of actual
      video content - ffmpeg now correctly selects the main video stream,
      excluding attached_pic streams.

When video processing failed (e.g., WebP encoder error on still frame),
the original file could be lost, resulting in missing attachments.

Root cause:
- processVideo() deleted the original file immediately after ffmpeg conversion
- If subsequent processImage() failed on still frame, the original was gone
- finalizeCreation() error handler couldn't fall back to 'general' type

Changes:
- Removed premature unlink() from processVideo in process.ts
- Added safe cleanup of original file in finalizeCreation after successful
  _placeFiles() in both success and error paths
- Original file now persists through entire processing pipeline until
  all files are safely uploaded to storage

This ensures the original file remains available for fallback processing
if any step fails, preventing the "file was lost" scenario.
Some video files (e.g., MP4s with embedded album art) have attached_pic streams that can interfere with filter graph processing. Changed to:
- Use V:0 stream specifier instead of v:0 to select first real video stream
- Extract still frame with separate ffmpeg command after main conversion
- Remove 'still' from split filter variants to avoid mapping conflicts
- Simplify split filter logic when only one variant is needed
@davidmz davidmz merged commit 2d68bb1 into stable Feb 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant