When you convert a WMV file to another WMV file using ffmpeg, the default behavior is to re-encode the video, even if you specify the same codec (wmv2) for the output. This is because ffmpeg doesn't just copy the encoded bitstream (the compressed video data) by default; instead, it:
- Decodes the input video (WMV2) to raw, uncompressed frames (YUV420p in this case).
- Re-encodes those raw frames using the specified output codec (again, WMV2).
This process is called decoding + re-encoding or transcoding. It's like:
Original WMV2 (encoded) → Decode → Raw YUV frames → Re-encode → New WMV2 (encoded)
Why does this happen?
ffmpeg assumes you want to:
- Change encoding settings (e.g., bitrate, quality, profile).
- Apply filters (e.g., scaling, cropping, deinterlacing).
- Use a different codec configuration (even if the codec name is the same).
Since wmv2 is a lossy codec, every re-encode generation loses quality (a bit like JPEG re-compression). Even if you use the same codec, settings, and bitrate, the decode/re-encode cycle introduces:
- Rounding errors in the pixel values.
- DCT (Discrete Cosine Transform) re-compression artifacts.
- Potential macroblock (MB) or motion vector re-quantization differences.
These losses are usually small, but they accumulate if you re-encode multiple times.
How to avoid re-encoding (copy the bitstream)?
If your goal is to only change the container (e.g., from .wmv to .avi or .mkv) or apply a filter that doesn't require pixel data modification (rare for filters!), you can use:
ffmpeg -i input.wmv -c:v copy output.mkv
The -c:v copy option tells ffmpeg:
"Hey, don't touch the video! Just copy the encoded bitstream (the compressed packets) as-is into the new container."
In this case:
ffmpeg reads the input WMV file's packetized (encoded, compressed) video stream.
- It into the new container (, , whatever) .