View Full Version : AVI vs MKV
zerowalker
24th May 2015, 23:31
Okay i have been wondering, which container is to be preferred for the use with Avisynth if both can be used (Format wise)?
I myself have always used AVI for many reasons.
First off, Avisource, very simple and works with both audio and video.
Secondly it just seems to be the most efficient made container when it comes to reading it as it's extremely simply made, some interleaving here and there etc.
But as i have no idea how MKV rly works, and have no clue if what AVI is actually has a real world benefit i just decided to ask here.
Thanks!
creaothceann
25th May 2015, 00:28
As an intermediary format while editing it doesn't really matter - unless you use e.g. x264vfw in VirtualDub(Mod) to put an h.264 video stream into an AVI file. IIRC, when using AVISource to open that file the first frame will be black.
AFAIK, AVI can't store a VBR MP3 stream either.
MysteryX
25th May 2015, 00:39
I (almost) always convert to AVI first because it avoids all kinds of issues that can happen with various videos.
MKV, however is a container, not a video format. MKV is useful because it has no restriction as to which video formats it contain.
So, I'm processing MPEG videos from old VCDs, converting them to AVI, opening with AviSource, re-encoding with x264, then I merge the MP4 output with the original MP2 audio into a MKV container. If I try to use a MP4 container for a x264 video format and a MP2 audio, some media players don't read it properly. With MKV, since there are no restrictions, I can keep the original audio untouched.
zerowalker
25th May 2015, 03:08
I know AVI and MKV are containers, wrote that. Just mentioned Formats in the way that x264 in AVI isn't that great (as creaothceann said).
But hows the difference performance wise, i mean there must be something right?
One uses Avisource, which i guess uses some internal Splitter?
The other is Directshow or LAV/FFMPEG, DDS2 and audiodub stuff.
MKV seems to have so much "roundabout" ways to do what Avisource does.
I am not even sure if Avisource or Directhow etc follows Audio Delay things correctly (like some Audio/Video don't always start at the same time and needs a Delay to be in sync).
MysteryX
25th May 2015, 04:31
Converting to AVI takes time, and AVI format has much more data to process, so it for sure is slower. But with AviSynth, the time to read the video file compared to running the operations is usually less than 1% (depending what script you run).
With AVI, utvideo provides better performance but requires this additional codec
http://www.digital-digest.com/software/Ut_Video_Codec_Suite.html
I convert videos like this
ffmpeg -i "source" -vcodec utvideo -an "destination"
zerowalker
25th May 2015, 14:53
So you are saying, if i had AVI and MKV with, let's say PCM / UTVideo.
The difference reading the containers and the file will be pretty much identical, even though one has to use DSS2 with AudioDub or something?;O
(I am not talking about converting from AVI to MKV here, just wondering the performance of reading and decoding from both containers (decoding should be identical as it's the same format though)).
creaothceann
25th May 2015, 16:26
The performance difference is probably the same as moving the mouse cursor rapidly over the screen...
zerowalker
25th May 2015, 19:57
Interesting and good news a guess:).
How is the accuracy for A/V syncing.
the things i stated before, like at times A/V don't start at the same time, so audio perhaps has like +127ms delay.
I am guessing Avisource take that into account at AVI has that built in.
MKV also has it of course, but i don't know if DSS2 with AudioDub DS will use that, as you use to separate methods for Video and Audio.
creaothceann
25th May 2015, 21:14
Just try it with files like that.
foxyshadis
25th May 2015, 22:11
For sync, it depends on which of the many bodged-in AVI extensions you've used, but generally AVI has no delay (you can zero-fill with padding frames to simulate it) and no sync (you drop a frame and you're just out of luck). If anything, DirectShowSource is significantly worse! But native ffms2 and LSMASH are much better for mkv, barring the occasional small bug.
If you want to more easily keep delay or detect corruption, using MKV is a better option. AVI is nice when it just works with everything out there, but if you use nothing but AviSynth then that doesn't matter. For lossless, the overhead difference is minuscule.
Sparktank
25th May 2015, 22:51
The only input I've found that works for me is that for AVC/MPEG2/VC1, I use MKV and index with DGdecNV.
Otherwise, for somethign like UtVC (or any lossless intermediate), I use Avi (via VirtualDub; mostly likely indexed from MKV with DGdecNV).
I don't really use any other formats.
Tbh, the only formats I initially work with are from bluray/dvd sources.
I don't do much in the way of video recording (cell phone, digital camera, etc).
And I don't really do any screencaptures, either (Fraps, etc).
My workflow is also different.
The only time I use AudioDub() is when I want to watch a movie downscaled to 720p in MPC-HC & SVP (ffdshow).
For instance, DGdecNV + AudioDub:
SetMemoryMax(512)
LoadPlugin("C:\AVS\dgdecnv2049\DGDecodeNV.dll")
v=DGSource("E:\MakeMKV\Dracula.dgi", crop_t=20, crop_b=28, crop_l=24, crop_r=24)
a=DirectShowSource("E:\MakeMKV\Bram Stoker's Dracula.mkv", audio=true, video=false)
v=v.Spline36Resize(1280, 720)
a=a.Dmix6Stereo()
AudioDub(v, a)
That plays fine in MPC-HC and when I turn on SVP to interpolate to 60fps while watching.
That aside, I do everything separately. Video first and then audio once I'm satisfied, I'll work on the audio last and then mux them altogether.
For indexing, DGdecNV, it's recently implemented indexing from MKV's.
If I ever want to use FFMS2, I remux to MKV and index with that.
I think I only ever use AVI for lossless intermediates.
creaothceann
25th May 2015, 23:37
Why index when you can just use DSS2?
zerowalker
26th May 2015, 04:20
For sync, it depends on which of the many bodged-in AVI extensions you've used, but generally AVI has no delay (you can zero-fill with padding frames to simulate it) and no sync (you drop a frame and you're just out of luck). If anything, DirectShowSource is significantly worse! But native ffms2 and LSMASH are much better for mkv, barring the occasional small bug.
If you want to more easily keep delay or detect corruption, using MKV is a better option. AVI is nice when it just works with everything out there, but if you use nothing but AviSynth then that doesn't matter. For lossless, the overhead difference is minuscule.
Ah well then AVI is in my favor then just for the simplicity with Audio/Video (No dubbing and keeping track of stuff).
Great to have this cleared up, was pretty much as i assumed though, but it's always better to get a more technical explanation from ppl instead of grasping at straws:)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.