Exactly every 1 second the picture glitches....encoding issue

Discussion in 'Issues and Bugs' started by Sirius76, Jun 10, 2019.

  1. Sirius76

    Sirius76 Member

    It is clear the encoder is kind of resetting its data every one second for the picture to do that. Obviously, this would only be apparent on parts of the picture that remain mostly unchanged for a few seconds. What is causing this exactly and is there a way to stop it? Also for movies already encoded, is there some sort of filter to mask this effect?

    I'm talking about the 264 encoding at highest quality settings with the latest version. I don't think it's a new problem but it is quite noticeable quite often when viewing on the PC at least.
  2. Sirius76

    Sirius76 Member

    Actually, it's possibly some setting with Nvidia CUDA acceleration. Even at highest quality settings it only takes about 12-15minutes to extract a movie with 5.1 sound from a blu-ray backup with 980GTX (I have two SLI but not sure how many are being used). All I know is that every one second you can notice the picture changing on any static sections.
  3. Pete

    Pete Forum Admin Staff Member

    I've never heard of such an issue, so I can't tell you what is causing it.

    Without details on the transcoding process (log file?) it's very hard to tell, what you are doing. "viewing on the PC" can mean so many different things.
    What player are you using? Maybe it's an issue with the player software?

    12-15 minutes is a bit fast for a 980, are you sure, nVidia is even used or are you maybe just making lossless copies?

    Also: what if you disable nVidia acceleration in CloneBD? Same outcome?
    (SLI is irrelevant, btw, that only affects gaming - video encoding does not benefit from it - only one of the cards is used)
  4. Sirius76

    Sirius76 Member

    Thanks for the reply. It is not something a lot of people will notice but it is quite noticeable and I noticed it quite quickly. If you look on a small area in the background of a movie scene that isn't moving, you can see the image changing subtly and I put my clock against it and is exactly every second and never goes out of sync so is very regular. It is probably some setting in the hardware encoder and probably won't happen with software encoding (not tried yet). It isn't a player issue and it is noticeable in all players and even when displaying on a projector you can see the issue. I did notice that the fast setting quality was quite bad compared to the highest quality and I found that the quality was very good apart from this issue.

    It seems to finish in under 15 minutes if the backup is already on the disk (not lossless for either video or audio and the compression amount doesn't seem to affect the speed much) but reading straight from a blu ray media it takes over an hour which is probably due to the speed it can read it. From checking on forums some people seem to do it faster than that so don't think it's particularly fast.

    I'm wondering how the quality settings in CloneBD affect the encoding as it must be an issue with that which causes the obvious change every 1 second - I just checked a lower quality encode (I think the standard setting) and the change is faster than 1 second but is still there (just at a bit faster rate - BTW this might have been from an earlier version of CloneBD though so not certain it's the quality setting). Not checked on any other encoding software yet.
  5. Sirius76

    Sirius76 Member

    It isn't really a glitch but the way the encoder stops encoding parts of the picture if it isn't moving much. So those areas remain static mostly but every one second they change slightly again. If the encoder used the same bit rate for that frame reference (or whatever it is doing) every second, then it would probably look the same and not like an obvious change.

    Thinking about it, maybe that's how often CloneBD changes the bitrate??
  6. tectpro

    tectpro Translator (ms_MY)

    Still the log file is missing which is needed by the developers from Elby so @Reto could have a look at it.
  7. Sirius76

    Sirius76 Member

    Did a small software encode sample and noticed a bit better quality in general (less soft and a bit more detailed). The problem is still there but is very hard to spot and is almost invisible. Some movies that are always moving are never easy to see the issue, anyway.

    Does something happen with the encoding at regular second or so intervals ? Maybe the bitrate is only changed every second? I noticed the software encoding seems to track objects a bit better (a blue sky for example, is more detailed and moves properly during screen pans whereas with hardware encoding it's mainly just splodges of colour that don't move and also has some blocking visible sometimes and this makes the issue more obvious if you can see blocks of colour changing every second).

    I'm only encoding video at average 5-6Mbps (although it obviously goes to 10+ Mbps sometimes during some scenes) but that seems good enough even with hardware encoding. I just noticed this issue with the image changing slightly at regular intervals mostly only visible in more static areas.

    Found the perfect example of this on youtube....watch this video at 240p resolution FULL SCREEN and watch the playstation logo (red green and blue blurry thing where it says PlayStation Classic on the purple header)....here it changes every 5 seconds (rather than one second with cloneBD). I'm not sure what setting this is in the encoders as I don't know anything about it.. hope you realise what I mean now. It makes areas on the picture change slightly at regular intervals, whatever it is.

    It would be much better if it was every 5 seconds as it would be less offputting than changing every second or less. In fact, even making it less regular might improve it too as it would seem like a more natural part of the picture (I mean even in a forest background, you can see tree branches changing exactly every second which is weird but if they changed at random intervals it would look more normal).
    Last edited by a moderator: Jun 11, 2019
  8. Reto

    Reto Elaborate Bytes AG

    Well, the "1 second" is explained easily: that's the typical interval for key frames with Blu-ray discs (and it's pretty common in many video formats). And CloneBD encodes with that same key frame interval.
    What you get with AVC is - a bit simplified: 1 key frame, which is a complete encoding of a picture, much like a jpeg.
    Then the next 23 frames are encoded in reference to that key frame (and partly to each-other).
    Roughly 24 frames per second, so that's that one second.

    It's clear, that the further you go away from the key frame, the more the picture will degrade - until the next key frame arrives.
    But that is usually only perceptible at very low bit rates. With higher bit rates, that degrading effect is very minimal.

    No, CloneBD doesn't change the bitrate during transcoding.

    Yes, I can see it, but really only at very low bit rate/resolution and that's normal and to be expected.
    I can not see it on any video encoded by CloneBD with nVidia, though.

    Since you say, you're encoding at 5-6mbps, there's your cause.
    That really is low for 1080p - it's fine for watching, if your expectations aren't too high, but if that didn't have any drawbacks, there would be no point in encoding at higher bit rates, would there? ;)

    Anyway: CloneBD can't do anything about this, it's entirely out of its hands.
    If software encoding does it better at the same rate, then hats off to the developers of x264 - then again, x264 is known to be pretty good.
  9. Reto

    Reto Elaborate Bytes AG

    Unfortunately, it would be much more noticeable after 5 seconds, though.
  10. Sirius76

    Sirius76 Member

    Yes, the problem must be to do with this key frame you mentioned but looking at some older encodes, I think you used to make them even faster than 1 second? Even on highest quality encodes with a slightly older CloneBD version it wasn't at the same speed as it is now (it is not much faster but noticeably faster than once per second). EDIT: Actually probably due to 30fps videos compared to 24fps ??

    The degrading of the picture is not really the problem as I didn't notice that. The problem is the keyframe is noticeably different to the previous few frames for areas that haven't really moved or changed but I think it is mostly due to the regularity. The image quality is mostly as good as higher encodes so I think it's worth it as you can fit most films on DVD5 (even 4.5MBit is usually really good and almost the same when viewing on a large screen) - some grain gets removed but not much detail is really lost. I think to make it almost invisible the interval could vary instead of making it the same all the time. It's only a bit noticeable because it happens so regularly so maybe do an extra keyframe sometimes to break up the rhythm.

    Actually, if they are less noticeable the faster they are maybe try it at half a second or allow people to choose the interval.
    Last edited: Jun 11, 2019
  11. Sirius76

    Sirius76 Member

    Another point, is that the example I gave is noticeable even though the logo never moves at all. Wouldn't it be more logical if the keyframes are all the same bitrate (I'm assuming the bitrate must change for the logo to look different - otherwise it should look the same if it hasn't moved or at least those areas of least change should all have the same bitrate??).

    Does it add a keyframe for scene changes too as I heard that happens for better quality usually? A lot of people seem to think half a second is good too but not read much into it.

    hmmm looking more into it it seems that higher numbers might be alright, especially as I never notice any image degradation: https://forum.videohelp.com/threads/382698-keyframe-interval-recommended-for-h264-video-at-50-fps (this seems to suggest 500 frames and I presume CloneBD always adds one when a scene changes but then again maybe it doesn't as never notice any irregularities against a clock - I definitely don't notice any consideration to the frame rate as it always seems to be after 24 frames even for 30fps videos so you haven't exactly used the blu ray standard either??)

    Yes, looking on that thread it seems that having higher values doesn't reduce the quality at all! Maybe set it to 10 seconds?

    Also: https://en.wikibooks.org/wiki/MeGUI/x264_Settings#keyint

    Higher settings can theoretically improve compression (reducing the number of forced IDR frames which would otherwise be smaller P or B frames), as well as reducing the appearance of fluctuating quality if the average quantizers are high (since I frames share no similarity in terms of artifacts with their neighbours the artifacts are more noticeable). Lower settings can reduce the time needed to seek to a certain frame.

    Recommendation: Default, or 10x whatever your framerate is. On HD encodes which will be CPU challenging you may want to use smaller values (say 2x - 5x fps)."
    Last edited: Jun 11, 2019
  12. Sirius76

    Sirius76 Member

    Just to add, that my bitrate isn't really that low and comparable or higher than Netflix etc (although obviously they have more encoding tricks) and is generally a bit higher than your DVD5 setting (which is a preset on your program) even when just storing the main movie only although I create a mkv and don't use those settings. Therefore, I think having a longer interval than 24 frames is beneficial as it should also increase quality for the same bitrate by about 12% -15% going by the figures I saw. The difference isn't very noticeable when the keyframe is used, only that it happens so regularly that it is noticeable if you look carefully in certain areas etc.

    even the x264 recommends 10 seconds too:

    GOP Size (Min/Max):

    Description: This option sets the minimum and maximum number of frames before a key frame has to be inserted by x264. For example, a minimum setting that is the same as the framerate of the video (eg. 24/25/30) will prevent the encoded video from having two subsequent key frames within a second of each other, which only aims to increase file size without any noticeable quality improvements.

    Similarly, a maximum setting ensures that a key frame is inserted at least every X number of frames. A video without key frames will have lower quality and there will be problem with seeking (if you try to skip to a part of the video without a key frame, there won't be any video until the next key frame is reached, also known as "seeking lag"). A recommend setting, as with DivX/XviD encoding, is to set this as 10 times the framerate, which equates to 10 seconds of video between key frames (ensures "seeking lag" is at most 10 seconds). "
    Last edited: Jun 11, 2019
  13. Sirius76

    Sirius76 Member

    Avidemux recommendation:

    "As a rule of thumb, the IDR frame interval shouldn't be lower than the framerate of the video multiplied with a factor of 10. For example a 25 fps video should use at least a value of 250, a 29.97 fps video should use at least a value of 300 and so on. Using even higher values will improve the compression at the cost of some seeking performance. Of course martial with many “long takes” and long “tracking shots” will benefit much more from long GOP's than martial which mainly consists of very short scenes. Please note that long GOP's will hurt error resilience, which may be a problem for steaming media (and also for Blu-Ray authoring)"
  14. Sirius76

    Sirius76 Member

  15. Pete

    Pete Forum Admin Staff Member

    The "degrading" is the cause for the next keyframe being different, that's what Reto tried to explain. Even if you don't perceive it as degrading - the point is, that the picture changes slightly over time with only differential (P and B) Frames.
    Whether the areas moved or not is irrelevant. Not in theory, but in practice - a still area is not really still - there is image noise, so there are slight changes from picture to picture and these need to be encoded - if your bit rate setting is low, this will eventually cause the process to gradually move away from the key frame. It's the encoder's choice (nVidia chip on your card) how it's done.

    CloneBD uses the value required by the Blu-ray disc specification, which demands 24 frames per GOP - it's not a choice.
    That also has to do with seeking. If you have 240 frames per GOP, you can only seek at a granularity of 10 seconds. All timing structures on the BD are built around this 1 second base.

    If you're unhappy with the nVidia output, you'll have to either take the discussion to nVidia or use software transcoding.
  16. Sirius76

    Sirius76 Member

    I have some BBC blu rays which have different frame rates and CloneBD seems to always use 24 which can't be right. So you are saying there is no way to edit the value at all?
  17. Sirius76

    Sirius76 Member


    I've now confirmed this is only a CloneBD problem. It is for all types of sources and sizes. I have started to use the nVidia NVENC in handbrake for DVDs and found 2000kbps constant is more than enough for very good quality (not exactly transparent as it seems to reduce any over-sharpness in the source but minimal artefacts) and even 720p at the same bitrate looks just as good but obviously better due to the resolution so I can probably get away with less bitrate at SD even using NVENC (maybe it performs better at lower bitrates). At 1080p I've used 5000kbps but not tried lower. For older SD sources I easily use 1000kpbs. The advantage of using a constant bitrate is you can easily estimate how much time you can fit for each size and vice versa. Obviously, using 980GTX this is done in minutes (about 5 minutes for DVD and 15 minutes for Blu-ray even read from disk) and as handbrake doesn't have the 'regular pulsating blocks' issue in CloneBD, I'm more than happy with the result considering that it almost takes no time to back up the source. There is still some blocking in shadowy areas sometimes but it is hardly noticeable and most importantly doesn't regularly 'pulsate'.

    Another thing I noticed is that despite using the highest quality HVENC settings for both, whereas in handbrake shadowy or blocky areas tend to be constantly changing with some static sometimes, CloneBD tends to create big blocks that hardly move. This is separate to the main problem which is the pulsating blocks at regular 24 frame intervals. This is for every source I use CloneBD on including SD. Obviously, software encoding isn't a problem but the NVENC implementation is inferior to handbrake's by far I would say, especially as nobody has really taken what I've said seriously or I might not be as emphatic about it.