<p>As Jim Mack has correctly pointed out MKV (Matroska) and AVI are containers, and are both able to store many of the same streams without any change to the streams themselves, and thus the remuxing should be lossless.</p>

<p>But there is one time where data is lost when remuxing from AVI to MKV. The thing is that some poor encoders in the day of AVI have created technically playable AVI files which had some garbage data in one of the streams for part of the time. They used that rather than setting up timestamp offset.</p>

<p>Most AVI-to-MKV remuxers (like mkvtools) will take such garbage data and assume that it can be converted into the offset, when such garbage happens in the beginning. However, in some rare cases this may not work, for example when the bitrate of the stream with garbage in it is variable. This causes timestamps to be badly shifted.</p>

<p>If the garbage occurs only in the beginning, the problem is easily resolved by editing the header of Matroska file, and changing the offset manually until the streams match. However, if the garbage occurs several times, then remuxer will just dump the garbage and the timestamps cannot be fixed that easily any longer.</p>

<p>Now, this doesn't happen for most files, but some "old school" Whatever-to-AVI may produce such thing. And it is important to know, since even losing "garbage" is by definition lossy when it translates to metadata change.</p>

CC BY-SA 3.0
2014-07-18T13:26:00.667Z
2014-07-18T17:49:15.353Z
2014-07-18T17:49:15.353Z
v010dya
<p>AVI and MKV are both containers, so in theory it should be possible to transfer your contents with no further loss. I can't say for certain if MKV can wrap xvid4, but it's very likely. You shouldn't need to decode / re-encode to transfer the contents, just demux / remux.</p>

CC BY-SA 3.0
2014-07-16T15:48:46.633Z
I used mkvmerge for the muxing. Thanks. seems like the audio and video quality are still the same.
Davlog
CC BY-SA 3.0
2014-07-16T15:27:48.607Z
2014-07-16T15:27:48.607Z
Jim Mack
<p>I have a lot of *.avi files with either 1 audio track or several. All of them are mp3 encoded. The video codec is xvid4. </p>

<p>However, when I play these avi files I can choose between the audio tracks (if there is more than 1 audio track) but they are named "audio track 1", "audio track 2" and so on. </p>

<p>That's why I want to convert them into mkv files since they support audio track names. </p>

<p>Would I loose any quality if I convert them?</p>

<video><audio>
Will I lose quality when converting avi to mkv?
Davlog
# Will I lose quality when converting avi to mkv?

(Asked by: username_0 on 2014-07-16)

I have a lot of \*.avi files with either 1 audio track or several. All of them are mp3 encoded. The video codec is xvid4.

However, when I play these avi files I can choose between the audio tracks (if there is more than 1 audio track) but they are named "audio track 1", "audio track 2" and so on.

That's why I want to convert them into mkv files since they support audio track names.

Would I loose any quality if I convert them?

**Tags:** video, audio


---

## 2 answers

### Answer by username_2 on 2014-07-16. Score: 4 | Accepted answer

AVI and MKV are both containers, so in theory it should be possible to transfer your contents with no further loss. I can't say for certain if MKV can wrap xvid4, but it's very likely. You shouldn't need to decode / re-encode to transfer the contents, just demux / remux.

> **Comments:**
> **username_0**: I used mkvmerge for the muxing. Thanks. seems like the audio and video quality are still the same.  

---

### Answer by username_1 on 2014-07-18. Score: 4

As username_2 has correctly pointed out MKV (Matroska) and AVI are containers, and are both able to store many of the same streams without any change to the streams themselves, and thus the remuxing should be lossless.

But there is one time where data is lost when remuxing from AVI to MKV. The thing is that some poor encoders in the day of AVI have created technically playable AVI files which had some garbage data in one of the streams for part of the time. They used that rather than setting up timestamp offset.

Most AVI-to-MKV remuxers (like mkvtools) will take such garbage data and assume that it can be converted into the offset, when such garbage happens in the beginning. However, in some rare cases this may not work, for example when the bitrate of the stream with garbage in it is variable. This causes timestamps to be badly shifted.

If the garbage occurs only in the beginning, the problem is easily resolved by editing the header of Matroska file, and changing the offset manually until the streams match. However, if the garbage occurs several times, then remuxer will just dump the garbage and the timestamps cannot be fixed that easily any longer.

Now, this doesn't happen for most files, but some "old school" Whatever-to-AVI may produce such thing. And it is important to know, since even losing "garbage" is by definition lossy when it translates to metadata change.


---

