VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 24 of 24
Thread
  1. Hey, is there a possibility too find corrupted frames in my encode (h264, 10-bit)?
    Frames like this: https://vgy.me/Tiw4WX.png

    Regards
    Quote Quote  
  2. It's difficult. You may remux using ffmpeg, mkvmerge or mkvalidator and see if any errors appear. But it is not guaranteed to find all errors.

    Are you sure your streams are actually corrupted? Similar artifacts can be seen when trying to decode 10 bit video with an 8 bit video decoder. Try a different decoder like LAV Video or latest VLC. Upload a sample if you are not sure.
    Quote Quote  
  3. Originally Posted by sneaker View Post
    Are you sure your streams are actually corrupted? Similar artifacts can be seen when trying to decode 10 bit video with an 8 bit video decoder. Try a different decoder like LAV Video or latest VLC. Upload a sample if you are not sure.
    Yes, Iím sure. I have load the video with FFVideoSource in AviSynth/Avspmod and itís the same corruption. Can I check the video with ffprobe?
    Quote Quote  
  4. Originally Posted by sneaker View Post
    It's difficult. You may remux using ffmpeg, mkvmerge or mkvalidator and see if any errors appear. But it is not guaranteed to find all errors.
    FFmpeg or MKVtoolnix donít show me any error :/
    Quote Quote  
  5. Try ffmpeg -i "input.mkv" -f rawvideo -y NUL
    Quote Quote  
  6. Originally Posted by sneaker View Post
    Try ffmpeg -i "input.mkv" -f rawvideo -y NUL
    Nope, nothing :/

    Here is a segment from the video with the corrupted frames: https://a.desu.sh/bleeeb.rar
    Quote Quote  
  7. Upload a sample. Maybe the file isn't broken or it is just a muxing/demuxing problem.
    Quote Quote  
  8. Originally Posted by sneaker View Post
    Upload a sample. Maybe the file isn't broken or it is just a muxing/demuxing problem.
    https://a.desu.sh/bleeeb.rar

    The original file is not remuxed, it's directly from x264. I have this in some other encodes too.
    Quote Quote  
  9. So that is the re-encode? Maybe the error is probably not in libx264 encoding but somehow in the source or the demuxing/decoding process of the source. Do you have a sample of the source? If you re-encode it twice is the error exactly the same (same position etc.)?

    Do you also happen to not only have a source sample but also a sample with the error within the first 2 seconds?
    Quote Quote  
  10. Originally Posted by sneaker View Post
    So that is the re-encode? Maybe the error is probably not in libx264 encoding but somehow in the source or the demuxing/decoding process of the source. Do you have a sample of the source? If you re-encode it twice is the error exactly the same (same position etc.)?

    Do you also happen to not only have a source sample but also a sample with the error within the first 2 seconds?
    The source is the original m2ts from the BDMV. In the BDMV this scene looks good. The scene looks in avspmod good too (I have loaded the file with LwlibavVideoSource). I have this problem in few other encodes too. I have tested already the RAM and HDD of errors but both works great.
    Quote Quote  
  11. And if you re-do an encode from the m2ts the error appears in the exact same spot? If you run the same script through a different encoder (e.g. x265 --preset ultrafast) the error is also in the exact same spot? Only with 4:4:4 predictive or also other profiles?
    You will need to narrow it down further until you find the culprit. If you find it make bug report to x264 or ffmpeg. Which x264 binary are you using? Same error with newest binary from Videolan?
    Quote Quote  
  12. Originally Posted by sneaker View Post
    And if you re-do an encode from the m2ts the error appears in the exact same spot? If you run the same script through a different encoder (e.g. x265 --preset ultrafast) the error is also in the exact same spot? Only with 4:4:4 predictive or also other profiles?
    You will need to narrow it down further until you find the culprit. If you find it make bug report to x264 or ffmpeg. Which x264 binary are you using? Same error with newest binary from Videolan?
    No, when I encode the same file again, the corrupted frame(s) donít appear on the same place.
    Quote Quote  
  13. That is strange. H.264 decoding as well as x264 encoding should be deterministic (except when using --non-deterministic). This would lead me to assume it is not an x264 error and the sample of the re-encoded file isn't useful.

    - Test the hardware again. HDD, RAM. Also run Intel burn test.
    - You only tried LwlibavVideoSource on the source m2ts? Same problem with threads=1? Latest revision?
    - Same problem with ffvideosource, DGDecNV or ffmpeg?

    I know it's difficult to test when you have to manually look for errors but I don't see any way around. Well, I guess that's exactly why you opened this thread...

    Maybe for these tests it can be automated to some extend. As I said encoding is deterministic so if you encode multiple times we "just" have to look at which point the files aren't identical anymore. The question is how to do it in a convenient way.
    Quote Quote  
  14. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    To automate testing, you could use a runtime function like RGBDifference in Avisynth and save frame numbers that are above a certain threshold with WriteFile.
    Quote Quote  
  15. It's likely the problem is in the decoding of the source. The encoder may be reading frames out of order which may cause the decoder to screw up. In such case there are no errors in your encoded video -- it correctly encoded what it got. The only way to detect this kind of problem would be to compare the source the encoded video. Frame-to-frame RGBDifference on just the encoded file will give too many false positives, especially with animated material.

    Although, I have seen encoders screw up like this now and then when the CPU is overheating. Check your CPU temps while encoding -- especially if you are using a laptop.
    Last edited by jagabo; 11th Dec 2016 at 08:59.
    Quote Quote  
  16. I have some AVISynth code that I created to find individual bad frames which don't match either of the adjacent frames. I wrote it to find photographer flashes so I could replace the frame with a motion estimated frame created from the two adjacent frames. I could post this if it would be useful.
    Quote Quote  
  17. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    My suggestion is to compare frames between versions. A threshold value will have to be found experimentally, but won't be too hard considering the blatant character of the artifact.
    Quote Quote  
  18. Originally Posted by johnmeyer View Post
    I have some AVISynth code that I created to find individual bad frames which don't match either of the adjacent frames. I wrote it to find photographer flashes so I could replace the frame with a motion estimated frame created from the two adjacent frames. I could post this if it would be useful.
    That would be nice
    Quote Quote  
  19. Another method might be to use per frame PSNR or SSIM (e.g. with ffmpeg) testing encode vs. source, then excel/spreadsheet or notepad++ to filter out values less than some threshold number

    The assumption is that your computer is working properly other wise ffmpeg decoding might decode source (or encode) with errors.
    Quote Quote  
  20. My code is nothing special: YDifferenceNext and YDifferencePrevious are the main functions. I keep a moving average of these values and, when I find a frame where both the YDifferenceNext and the YDifferencePrevious values change dramatically compared to the moving average, that means the current frame is dramatically different from both adjacent frames.

    It works really well for photographer flashes, blank frames, and any situation where the frame gets really garbled. However, if you have 2-3 frames in a row that have become corrupted, then this won't work.

    So, if you truly just have single frame glitches, let me know and I'll post the code.
    Quote Quote  
  21. It may not help the OP whose video has bursts of several frames with bad frames (thumbnails of 16 consecutive frames, top left to bottom right):

    Image
    [Attachment 39881 - Click to enlarge]


    It also has single frames that are significantly different from surrounding frames but are not errors:

    Image
    [Attachment 39882 - Click to enlarge]


    But I'd like to see your "flash detecting" script.
    Quote Quote  
  22. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    What about comparing the MP4 to the M2TS?
    Code:
    # Choose a value that reliably picks up the error
    threshold = 50
    orig = MPEG2Source("myvid.d2v")
    recode = DirectShowSource("myvid.mp4")
    WriteFileIf("bad_frame.log", "RGBDifference(orig, recode) > threshold" , "current_frame")
    Quote Quote  
  23. In post #16 above, I mentioned that I have some code which will find bad frames. I updated it so that it will not only find them, but will optionally either output the frame numbers (to a text file) of all bad frames found, or will automatically replace all bad frames with new frames synthesized (using motion estimation) from adjacent good frames. Here is a link to the thread where I posted the script:

    Finding individual "bad" frames in video and save frame number, or repair
    Quote Quote  
  24. Thanks for that, johnmeyer.
    Quote Quote  



Similar Threads