Certainly! To scale your video to 640x640 while preserving as much quality as possible, you should:
- Use a high-quality video codec (e.g.,
libx264 for H.264).
- Set a high bitrate or use a high-quality CRF value.
- Use a good scaling algorithm (the default is fine, but you can specify
-sws_flags lanczos for even better quality).
- Pad the video if you want to avoid stretching (since your source is 640x480, scaling directly to 640x640 will distort the aspect ratio unless you pad).
Here’s a recommended ffmpeg command:
ffmpeg -i input.wmv \
-vf "scale=640:640:force_original_aspect_ratio=decrease,pad=640:640:(ow-iw)/2:(oh-ih)/2" \
-c:v libx264 -crf 18 -preset slow \
-c:a copy \
output.mp4
Explanation:
-vf "scale=640:640:force_original_aspect_ratio=decrease,pad=640:640:(ow-iw)/2:(oh-ih)/2":
- Scales the video to fit within 640x640, preserving aspect ratio.
- Pads the video to exactly 640x640 with black bars as needed.
-c:v libx264: Use H.264 video codec.
-crf 18: High quality (lower is better, 18 is visually lossless for most content).
-preset slow: Better compression efficiency.
-c:a copy: Copy the original audio stream without re-encoding.
If you want to keep the original WMV2 codec (not recommended for quality, but possible):
ffmpeg -i input.wmv \
-vf "scale=640:640:force_original_aspect_ratio=decrease,pad=640:640:(ow-iw)/2:(oh-ih)/2" \
-c:v wmv2 -b:v 386k \
-c:a copy \
output.wmv
But for best compatibility and quality, the first command (H.264/MP4) is recommended.