群晖NAS(DSM6.1.5监控套件)FFmpeg转延时视频报错排查
Hey there, let's dig into why you're hitting that frustrating encoder error when trying to create a timelapse with FFmpeg on your Synology setup. This error usually boils down to mismatched parameters or environment-specific quirks with your older DSM version and Surveillance Station footage. Here are the most likely fixes:
Mismatched resolution or frame rate parameters
Surveillance Station cameras often record with non-standard resolutions or aspect ratios (think oddball 1280x712 instead of 1280x720). If you're forcing an output resolution that doesn't align with the input's aspect ratio, or setting a frame rate that's too extreme (like 0fps or 100fps), the encoder will choke.
Fix: First runffmpeg -i your_surveillance_video.mp4to check the input's exact specs. Then either match the output resolution to the input's aspect ratio, or use a scaling filter that preserves it:-vf scale=1920:1080:force_original_aspect_ratio=decrease. For timelapses, stick to 10-30fps—those are safe values for most encoders.Unsupported bitrate settings
If you manually set a bitrate (like-b:v 500kor-b:v 10M), your chosen encoder (usually libx264 by default) might not support that value on Synology's limited CPU, or the gap between input and output bitrate is too large.
Fix: Ditch the fixed bitrate and use a constant quality parameter instead:-crf 23(values 20-28 work well for timelapses—lower = higher quality). If you must use a bitrate, start with a moderate value like-b:v 2000kand adjust slowly.Outdated FFmpeg with missing/incompatible encoders
DSM 6.1.5 is pretty old, and the stock FFmpeg that comes with it is likely several versions behind. Surveillance Station might encode footage with H.264 variants that the old FFmpeg can't handle properly when re-encoding for your timelapse.
Fix: Install a newer FFmpeg version via Docker (DSM 6.1.5 supports Docker, so this is your best bet) or use a third-party package source like SynoCommunity. When running the command, explicitly specify the encoder to avoid defaults:-c:v libx264.Permission issues blocking encoder operations
Synology's file permissions are strict. If the user running FFmpeg doesn't have write access to the output directory, or the encoder can't access temporary files (like in/tmp), it might throw a misleading "parameter error" instead of a permission error.
Fix: Double-check that your user has read/write permissions for both the input video's folder and the output folder. Try saving the timelapse to your home directory first (e.g.,/volume1/homes/your_username/timelapse.mp4) to rule out permission problems.Non-standard video packaging from Surveillance Station
Synology's surveillance footage sometimes includes extra metadata or uses a non-standard MP4 wrapper that confuses FFmpeg's encoder. Even if the video plays fine, the underlying stream data might be wonky.
Fix: First transcode the footage to a clean, standard MP4:ffmpeg -i surveillance_input.mp4 -c:v copy -c:a copy cleaned_video.mp4Then use
cleaned_video.mp4as your input for the timelapse command. This strips out any weird wrapper data that's tripping up the encoder.
内容的提问来源于stack exchange,提问作者Max

