Joined: 3/14/2005
Posts: 43
System Specs Athlon 64 3000+ 1GB DDR 3200 RAM Windows 2000 Streamlined (No IE) x264 core:94 r1564 Source: MaTo's Shadow of the Beast run 11:56.9, frames 18695-22295. (exactly one minute duration) Script: x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint 300 --ref 15 --no-fast-pskip --mbtree --direct auto --subme 10 --trellis 2 --partitions all --me umh --merange ? --8x8dct --no-dct-decimate --output "E:\S\encoded.mp4" I thought there should be more raw data available here, for newbie encoders that want to interpret data and choose what functions they want for themselves. (and which tradeoffs are worthwhile) I also decided to pick this segment of the run because one, there's been discussion on how difficult it is to encode, and two, there's both fast moving and slow moving objects during the scene. I'm testing strictly size vs time, hence the crf=0. Quality will come at a later time. After merange 160 you really start hitting the point of diminishing returns. Sure, you start getting more efficient scanning (due to the range hitting the bounds of the video resolution, but the benefit is miniscule. ----5/26/2010 Update Script:x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint ? --ref 15 --no-fast-pskip --mbtree --direct auto --subme 10 --trellis 2 --partitions all --me umh --merange 96 --8x8dct --no-dct-decimate --output "E:\shadow\encoded?.mp4" Size benefit with little to no encoding time hit? Sign me up! Its interesting to note that the benefit starts to trail after about keyint 900...I'm suspecting that that's simply the source material being used, and that its a particular scene that's causing a new keyint to be drawn. So, I'm sure you could raise this value to as high as you could possibly want and see real size benefits with little encode time hit..HOWEVER, the higher this value, the messier it might get seeking to random spots in the movie (or if the decoder's smart, time to seek increases). You don't want to set this value to, say, 3600, and have the viewer try seeking to a spot and potentially having him/her watch up to 60 seconds worth of garbled picture (or wait 5-10 seconds as the player seeks) because he/she missed the keyint point, do you? Anyway, the general rule I've read on other boards is Keyint=FPS*10..so it would be a max of <10 seconds if they seeked to a point and happened to get garbled picture before they start to see things properly again. (on average, 5 seconds)...I think I could say you could stretch it to FPS*15, squeeze 1/2% of size, and be done with it. Should also note that some of these, like keyint 800 and 1400, are a lot slower. I think my computer hiccuped during those encodes so the values are off. I don't feel like doing a 2nd test set for these, since you can see the general line of time vs size. (maybe I should make a scatter plot graph?) ----5/27/2010 Update Script: x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint 900 --ref 15 --no-fast-pskip --mbtree --direct auto --subme ? --trellis 2 --partitions all --me umh --merange 64 --8x8dct --no-dct-decimate --output "E:\shadow\encoded subme?.mp4" This appears to have the largest factor on size so far. As such, subme 1 & 2 are NOT recommended in any scenario. Subme 5 is the best performer here, saving ~30 seconds over the higher subme while still (somehow) being smaller than the rest. But, if you were to pick a higher value, subme 10 would be the best bet with little time loss over 6 & 7, while still being in the same bracket as 8 & 9, also while potentially increasing the quality (if it wasn't lossless) over other subme...but that's for another article. Note: Looking at the MeWiki I realize the brackets exist because subme 7 & 9 also scan for B frames...since they're nonexistent, you get the same size/encoding time. ----Update: More charts! Source: x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint 900 --me ? --subme 5 --merange 16/64 --ref 8 --trellis 2 --partitions all --8x8dct --no-dct-decimate --mbtree --no-fast-pskip --direct auto --output "E:\shadow\encoded ?.mp4" DIA/HEX/UMH/ESA/TESA Comparing vs all the different types of motion sensing. merange had to be lowered to 16 due to dia and hex being capped at that value (for better comparison). Hex is only slightly slower and has better compression, so it should always be used over dia. Esa/Tesa is nearly 4x slower than umh, but even so I've gotten curious because of the total amount of time spent..so in the next charts I started comparing umh vs tesa with ref values. Source: x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint 900 --ref ? --no-fast-pskip --mbtree --direct auto --subme 5 --trellis 2 --partitions all --me umh --merange 64 --8x8dct --no-dct-decimate --output "E:\shadow\encoded ref?.mp4" Merange 64 UMH Tesa at merange 16 vs UMH at merange 64 has roughly the same time for encode, yet tesa is smaller..interesting..so I did UMH vs tesa at merange 16 with ref values as well. Source: x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint 900 --me umh –subme 5 --merange 16 --ref ? --trellis 2 --partitions all --8x8dct --no-dct-decimate --mbtree --no-fast-pskip --direct auto --output "E:\shadow\encoded ref?.mp4" Merange 16 UMH Source: x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint 900 --me tesa --subme 5 --merange 16 --ref ? --trellis 2 --partitions all --8x8dct --no-dct-decimate --mbtree --no-fast-pskip --direct auto --output "E:\shadow\encoded ref?.mp4" Merange 16 TESA Even at ref 15 UMH filesize can't go under tesa's size at ref 3..one of the many deciding points for me to switch to tesa. Source:x264 "D:\Anime\Shadow 18695-22295.avi" --crf 0 --keyint 900 --me tesa --subme ? --ref 5 --merange 16 --trellis 2 --partitions all --8x8dct --no-dct-decimate --mbtree --no-fast-pskip --direct auto --output "E:\shadow\encoded ref55.mp4" Retest: Subme 5 vs 10 using TESA Well, subme 5 being a smaller encode was mostly a fluke..since subme 10 is not much slower, I'll stick with that value. Aside from the merange 64 tesa encodes, 16464055 is the smallest file size I've reached (while still being very efficient with encoding)
Joined: 11/4/2007
Posts: 1772
Location: Australia, Victoria
Thank you, thank you, thank you! I just cannot thank you enough for making these tests! I fully admit being too lazy to make them myself, and... well... thank you! Just a question, what exact section are you testing this on, a running section with the parallax scrolling? I'd check so myself... but, well, I actually lack a Shadow of the Beast encode on me, and lack of any decent net access isn't helping me. Also, uploading the raw to somewhere like Mediafire will be extremely helpful test material for other encoders to use with other scripts. I really can't thank you enough for this, seriously. Also, we want you in the IRC channel, seriously, you're amazing, I love your Mario Paint works, I love your encoding works, and you're generally too awesome to not be in the TASVideos IRC channel.
Joined: 3/14/2005
Posts: 43
Flygon wrote:
Thank you, thank you, thank you! I just cannot thank you enough for making these tests! I fully admit being too lazy to make them myself, and... well... thank you! Just a question, what exact section are you testing this on, a running section with the parallax scrolling? I'd check so myself... but, well, I actually lack a Shadow of the Beast encode on me, and lack of any decent net access isn't helping me. Also, uploading the raw to somewhere like Mediafire will be extremely helpful test material for other encoders to use with other scripts. I really can't thank you enough for this, seriously.
The Raw is 226MB. Sorry, but its not happening. :/ It is a running section..the second one, starting at the beginning of the long batch of trees, and ending at the giant hand coming out of the ground. There's eyeballs, running enemies, and stuff scrolling in the background so I thought it was varied enough to test with.
Joined: 11/4/2007
Posts: 1772
Location: Australia, Victoria
This might sound odd, but can I actually suggest compressing the raw to inside of a highly compressed 7z file, without the audio stream inside it? Assuming it is an uncompressed raw, I'm reasonably sure it'll compress to a manageable size that'll fit in Mediafire's restrictions.
Joined: 3/14/2005
Posts: 43
Flygon wrote:
This might sound odd, but can I actually suggest compressing the raw to inside of a highly compressed 7z file, without the audio stream inside it? Assuming it is an uncompressed raw, I'm reasonably sure it'll compress to a manageable size that'll fit in Mediafire's restrictions.
It only compresses to 212MB, with the stream without the audio being 218MB. (I used FFV1 for capture..a true uncompressed would be in the range of GBs) It really is more efficient for encoders just to record off the movie file itself. I gave the frame ranges so its easy enough to edit to that section for comparison.
Joined: 11/4/2007
Posts: 1772
Location: Australia, Victoria
Hm... perhaps a losslessly compressed H.264 file should be supplied and an encoder decompresses it on his or her own end? It's not the most efficient method, but at least it makes sense, filesize wise.
Joined: 3/14/2005
Posts: 43
Flygon wrote:
Hm... perhaps a losslessly compressed H.264 file should be supplied and an encoder decompresses it on his or her own end? It's not the most efficient method, but at least it makes sense, filesize wise.
But I'm making tests with lossless! Plus I like to think that YV12 conversion will interfere with equal comparison. Any recommended IRC chat clients? I never really got into using it, and the last time was years and years ago. -edit- n/m..I was sure Trilian had it..just found the option.
Joined: 11/4/2007
Posts: 1772
Location: Australia, Victoria
If you don't want to use a personal client, you can just use online Webchat client. Some more information regarding the IRC channel can be found here.
Senior Moderator
Joined: 8/4/2005
Posts: 5770
Location: Away
So I took the same segment and tried to make a RGB32 capture, but ran into a problem with colors. So I made a YV12 capture instead. FFV1: http://www.mediafire.com/?noziymmdjjz (AVI, 147 MB) H.264 lossless: http://www.mediafire.com/?0yymim2ynhz (MKV, 17 MB) Going to run a few tests on it as well.
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Publisher
Joined: 4/23/2009
Posts: 1283
Great job, but I think you should also mention what x264 version you are using as each version may have different changes/features that affect the size/speed/(and quality if it wasn't lossless).
Senior Moderator
Joined: 8/4/2005
Posts: 5770
Location: Away
Test system spec: Intel Core i5-750 (4 cores @2.67 GHz, everything on defaults); 4 GB dual-channel DDR-1333 (not that it really matters); Windows 7 64-bit; x264 rev. 1602 64-bit from http://x264.nl/ with threads=auto. Sample length: 3600 frames. The Gritty Details, vol. 1: me=esa vs. me=tesa vs. me=umh. (Bitrate in kbps, size in bytes, speed in fps.) Conclusion #1. The quality/size difference between esa and tesa is absolutely negligible. While the speed hit is fixed regardless of the search range (~15%), improvements in size are within at most 0.3%, and they happen only at the point where the whole thing is slow as hell anyways. Meaning this time is better spent elsewhere. Conclusion #2. Uneven multi-hexagon search at high range outperforms exhaustive in quality/speed ratio until a certain threshold, where motion estimation quality stops rising (see conclusion #3). Exhaustive search can still improve quality in this case, but at an incredible performance hit: up to ~4% reduction in bitrate at up to 10x lower encoding speed. The value is limited by the video's resolution (320 for Genesis). Conclusion #3. The sweet spot for umh is ~192, increasing it past this point doesn't hurt speed much, but doesn't return any benefits either. For (t)esa, efficiency drops rapidly after ~160, while setting it to over 200 equals to torture.
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Joined: 3/14/2005
Posts: 43
moozooh wrote:
Test system spec: Intel Core i5-750 (4 cores @2.67 GHz, everything on defaults); 4 GB dual-channel DDR-1333 (not that it really matters); Windows 7 64-bit; x264 rev. 1602 64-bit from http://x264.nl/ with threads=auto. Sample length: 3600 frames. The Gritty Details, vol. 1: me=esa vs. me=tesa. (Going to update it shortly with some missing values. Also, the rightmost column should read "speed", not "time".) Conclusion #1: the quality/size difference between esa and tesa is absolutely negligible. While the speed hit is fixed regardless of the search range (~15%), improvements in size are within at most 0.3% and they happen only at the point where the whole thing is slow as hell anyways. Meaning that the time is better spent elsewhere. Conclusion #2: me_range=320 is absurd, NEVER AGAIN am I going to use this setting for anything.
haha, you have a much much faster system than mine..I'm sure you got this data a lot faster than me. I went and did other things when I got to the 160 merange. Also, I probably should organize my data much like this, as to save space. hmm...how did you do the quality measurements? subjective analysis? And what settings did you use for encode?
Senior Moderator
Joined: 8/4/2005
Posts: 5770
Location: Away
I'm going to update the post in a few minutes, there will be interesting details.
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Joined: 3/14/2005
Posts: 43
moozooh, something about your mkv encode I noticed, the very first frame is stamped with "seeking to frame 22295". It would make a miniscule difference I'm sure, but I thought I'd point that out. ^^; (last frame is stamped too)
Senior Moderator
Joined: 8/4/2005
Posts: 5770
Location: Away
Oh well, thankfully that won't make a significant difference (less than a kilobyte I'm sure). Besides, my testing is still internally consistent, and if other people will use the encode I provided it will be consistent with their results as well. I've updated the post above with new data. [EDIT] Alright, done with motion estimation testing. Short summary: never use SATD Exhaustive (me=tesa); use uneven multi-hexagon at high range if you want a lot more speed at very little cost.
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Publisher
Joined: 4/23/2009
Posts: 1283
Good work moozooh! I do have a problem with your conclusions though. I think testing one clip is not enough to make conclusions. I think it would be better to test a variety of clips with different types of motion before making a conclusion. Basically, who is to say that the clip you used has a ton of motion to x264, and not a ton of different textures instead? It's a great start, but I think more testing is needed before a conclusion.
Joined: 3/14/2005
Posts: 43
Nice work! Thanks to your help I can skip testing UMH/Esa/Tesa and do something else. I think I'll work on either subme or keyint ranges..were you planning on doing anything next in particular, moozooh? Also, I finished my ranges with merange..I'll plug my data into a spreadsheet and update soon. Also, Aktan, have any suggestions for clip tests?
Publisher
Joined: 4/23/2009
Posts: 1283
Not really. Just stuff with diff motion, no motion, slow motion, turning motion. All stuff like that XD.
sgrunt
He/Him
Emulator Coder, Former player
Joined: 10/28/2007
Posts: 1360
Location: The dark horror in the back of your mind
You might seek out some of the runs that did not encode very well at the time of publication. Mega Turrican and Gunstar Heroes come to mind. 3D runs would also be worth investigating (Crash Bandicoot 2, anyone?).
Publisher
Joined: 4/23/2009
Posts: 1283
Runs that did not encode very well does not mean it has a lot of motion. In fact, to me, it may mean the opposite. The changes in the texture was so great that x264 counted it as a new texture and not motion, hence why it grew so big (mostly texture info and not much motion info and I think we can agree that texture info is a lot bigger than motion info).
sgrunt
He/Him
Emulator Coder, Former player
Joined: 10/28/2007
Posts: 1360
Location: The dark horror in the back of your mind
I'm not solely concerned with motion; I'm concerned with clips that have proven to be codec-poisonous for testing purposes. Larger file sizes will mean there is more room for seeing the effect of tuning any particular option, and we will be able to better see the relative impact of any changes that are made.
Joined: 3/14/2005
Posts: 43
just updated with Keyint values. Maybe I'll work on subme next.
Senior Moderator
Joined: 8/4/2005
Posts: 5770
Location: Away
Large keyint values should be able to provide a lot more benefit on less complex scenes. Also, you should keep in mind that this setting determines the maximum amount of frames encoded without a keyframe, not minimum. Besides, modern decoders are able to use non-keyframes as a reference as well. Thus, in practice one never needs to wait for a minute during seeking even with abnormally high values when using an up-to-date decoder. If it isn't up-to-date, or is hardware-based (iPod), or not easily updateable (consoles), problems may occur.
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Joined: 11/4/2007
Posts: 1772
Location: Australia, Victoria
I'd personally suggest never putting the keyint above 600, I use VLC as my testbed for video encoding... and I even get some minor issues with that amount, depending on the game. Anything higher and I'm very certain that the risk of seeking issues in that player heighten significantly. I know VLC is terrible, but unfortunately, other people use it for some obscene reason, so I end up using it myself.
Joined: 3/14/2005
Posts: 43
moozooh wrote:
Large keyint values should be able to provide a lot more benefit on less complex scenes. Also, you should keep in mind that this setting determines the maximum amount of frames encoded without a keyframe, not minimum. Besides, modern decoders are able to use non-keyframes as a reference as well. Thus, in practice one never needs to wait for a minute during seeking even with abnormally high values when using an up-to-date decoder. If it isn't up-to-date, or is hardware-based (iPod), or not easily updateable (consoles), problems may occur.
Well, by default, the min is set to keyint/10, so it scales automatically. I threw in those theoretical scenarios because, with ffdshow, it took a few extra seconds for me on the higher keyint clips to seek than the low keyint...and I remember a few years back (or maybe months? I don't really remember) having garbled video in the past...could've just been a different codec though..not really sure. But thanks for the info.
Flygon wrote:
I'd personally suggest never putting the keyint above 600, I use VLC as my testbed for video encoding... and I even get some minor issues with that amount, depending on the game. Anything higher and I'm very certain that the risk of seeking issues in that player heighten significantly. I know VLC is terrible, but unfortunately, other people use it for some obscene reason, so I end up using it myself.
years ago when I was comparing VLC to MPlayer, the video quality was a lot better in VLC (with DVD material) vs MPlayer...of course, those issues might have been fixed with Mplayer by now. Anyway, that's my reason for using VLC (the interface/drop down menus annoy the hell out of me though)