Zero1
15th February 2009, 11:21
Hey guys
I'm having a slight problem with a video I am trying to encode.
The source is a lossless screen capture of Street Fighter 3 - 3rd Strike. It was captured in RGB and then fed to x264 in YV12 via AVISynth. The original capture is pixel perfect and is at the games native resolution. For those of you not familiar with Street Fighter, it features a more or less static background that pans while the 2 sprites move around.
The problem that I am coming across is that some frames look inconsistant, almost like the texture has shifted or changed, where in the source the images are identical. Here is a little example encoded with the default x264 settings except I specified -q 18. As you can see, all frames are pretty consistant, except for when the I-frame was inserted. You should be able to open these in tabs and see the difference by switching, although it would be easier if you zoom. It is most noticable in the detail on the hut above the characters heads, or on the tree.
http://xs136.xs.to/xs136/09070/1436228.png
http://xs136.xs.to/xs136/09070/1437427.png
http://xs136.xs.to/xs136/09070/1438400.png
http://xs136.xs.to/xs136/09070/1439965.png
The first thing you might notice as well as the change happening on the I-frame, is that the I-frame has a different quantizer, so to try and make it a fair test, I set --ipratio 1.0. As you can see, it didn't help much, and probably made the overall quality lower.
http://xs536.xs.to/xs536/09070/1436ip424.png
http://xs536.xs.to/xs536/09070/1437ip652.png
http://xs536.xs.to/xs536/09070/1438ip528.png
http://xs536.xs.to/xs536/09070/1439ip459.png
After digging a little more, I notice that I get the same problem with an I-frame at frame 1688 and again at 1938, which is of course 250 frames more than the previous. Obviously what is happening is that the scene is not changing enough to warrant a scene change and instead is inserting an I-frame at the maximum GOP size specified in the encoding settings (which 250 is the default). In my tests, I ended up setting the maximum GOP size to a frame count higher than the number of frames in the source and the result was that it was a little more consistant with I-frames being placed at what would be considered real scene changes.
Although setting a huge GOP size seemed to work, I feel as though it may be a suboptimal solution. I'm also concerned about the quality gradually decreasing with the lack of I-frames. Seeing how the P-frame directly after the I-frame was very similar, but the P-frame before the I-frame wasn't as similar, could this be in part due to accumulated errors through motion compensation etc, or is it just the nature of P-frames that they will decrease in quality and an I-frame is needed every so often to "freshen" things up?
So for now, I'm just wondering if anyone can anyone offer any pointers. Would some simpler settings actually work better, or is setting a large GOP the only way round this? Also, if a large GOP is the only way round this, would there be any use for an option in x264 for some kind of intelligent GOP size, or an auto maximum? I'm sure this issue won't affect most people, but it might crop up in other types of capture (eg GUI screen caps or anime/CG).
Thanks for your time guys. If you need any samples uploading or options testing just let me know. Fortunately since it is low res, testing is not too bad :)
I'm having a slight problem with a video I am trying to encode.
The source is a lossless screen capture of Street Fighter 3 - 3rd Strike. It was captured in RGB and then fed to x264 in YV12 via AVISynth. The original capture is pixel perfect and is at the games native resolution. For those of you not familiar with Street Fighter, it features a more or less static background that pans while the 2 sprites move around.
The problem that I am coming across is that some frames look inconsistant, almost like the texture has shifted or changed, where in the source the images are identical. Here is a little example encoded with the default x264 settings except I specified -q 18. As you can see, all frames are pretty consistant, except for when the I-frame was inserted. You should be able to open these in tabs and see the difference by switching, although it would be easier if you zoom. It is most noticable in the detail on the hut above the characters heads, or on the tree.
http://xs136.xs.to/xs136/09070/1436228.png
http://xs136.xs.to/xs136/09070/1437427.png
http://xs136.xs.to/xs136/09070/1438400.png
http://xs136.xs.to/xs136/09070/1439965.png
The first thing you might notice as well as the change happening on the I-frame, is that the I-frame has a different quantizer, so to try and make it a fair test, I set --ipratio 1.0. As you can see, it didn't help much, and probably made the overall quality lower.
http://xs536.xs.to/xs536/09070/1436ip424.png
http://xs536.xs.to/xs536/09070/1437ip652.png
http://xs536.xs.to/xs536/09070/1438ip528.png
http://xs536.xs.to/xs536/09070/1439ip459.png
After digging a little more, I notice that I get the same problem with an I-frame at frame 1688 and again at 1938, which is of course 250 frames more than the previous. Obviously what is happening is that the scene is not changing enough to warrant a scene change and instead is inserting an I-frame at the maximum GOP size specified in the encoding settings (which 250 is the default). In my tests, I ended up setting the maximum GOP size to a frame count higher than the number of frames in the source and the result was that it was a little more consistant with I-frames being placed at what would be considered real scene changes.
Although setting a huge GOP size seemed to work, I feel as though it may be a suboptimal solution. I'm also concerned about the quality gradually decreasing with the lack of I-frames. Seeing how the P-frame directly after the I-frame was very similar, but the P-frame before the I-frame wasn't as similar, could this be in part due to accumulated errors through motion compensation etc, or is it just the nature of P-frames that they will decrease in quality and an I-frame is needed every so often to "freshen" things up?
So for now, I'm just wondering if anyone can anyone offer any pointers. Would some simpler settings actually work better, or is setting a large GOP the only way round this? Also, if a large GOP is the only way round this, would there be any use for an option in x264 for some kind of intelligent GOP size, or an auto maximum? I'm sure this issue won't affect most people, but it might crop up in other types of capture (eg GUI screen caps or anime/CG).
Thanks for your time guys. If you need any samples uploading or options testing just let me know. Fortunately since it is low res, testing is not too bad :)