VideoHelp Forum
+ Reply to Thread
Results 1 to 21 of 21
Thread
  1. I have found, on a certain P2P network, represented by a certain animal from the head of which hang jewels and binoculars, according to a certain Bob Dylan, six different versions of a (non-commercial AFAIK) 1978 concert footage from AC/DC in Glasgow, with the exact same size (465405952 bytes, in Divx 4 video format + mono PCM audio in AVI container). I'm trying to find out which ones are corrupted, and in what ways, and which one is the original file. I examined three of them completed thus far with WinHex : they only differ by a few bytes at seemingly random spots (26 different bytes at most), so none of them has a completely missing chunk, and any playback discrepancy will be tiny at best. So now I'm trying to examine them more thoroughly as media streams, trying to find if there are glitches somewhere. What are the available tools and methods to do so ?

    What I already did : I exported the mono audio from those three files with VirtualDub, converted it to stereo WAV with foobar2000, then used the “Compare WAVs” feature in ExactAudioCopy (it's the only tool I know which can compare two audio files at the sample level and output a list of all differences found, but it only accepts 44.1kHz stereo WAV format ; and if the mono to stereo conversion is done with Audacity, EAC considers the resulting files as totally different from the beginning to the end – perhaps that's due to the internal 32-bit float conversion ? but isn't foobar2000 supposed to work in 32-bit float too ?). And then, opening each WAV file and examining one of the listed spots with near maximum magnification, I can indeed see some glitches in some files which are not present in some other(s). But that's quite tedious, and I don't know of a way to do such a thorough comparison for the video stream.

    I have also made a rough estimation based on the position of a given discrepancy, converted to a percentage of the total size, then applying that percentage to the total playback time, then opening each file in VirtualDub2 and scrubbing the footage around that spot : that way I found a video glitch at 3min52s on two of them while the third one is correct (it doesn't mean that it's the original file, as it could be corrupted elsewhere, but so far that one seems to be the most likely candidate). Again, it's too tedious and haphazard.

    As a side question, what can cause that kind of minute corruption over time ? Usually HDD corruption results in whole sectors (512 bytes in a row) or clusters (usually 4096 bytes in a row) becoming empty or ending up with garbage data. And normally each downloaded file is thoroughly verified during the download and again at the end before the download is considered complete to ensure that the data was not altered, so a single altered byte should result in the corresponding 9500KB segment being discarded and downloaded again. (The temporary metadata files associated with each partial download contain a list of checksums for each 9500KB segment of the complete file, so by comparing those metadata files I managed to pinpoint the approximate location of those discrepancies, even for the files which are not finished downloading.)

    Thanks.


    EDIT : By the way, I also posted this new thread in the “Camcorders” section which seems much less populated (and it's a much more urgent issue).
    https://forum.videohelp.com/threads/394496-Camcorder-fell-trying-to-properly-import-MT...thout-metadata
    Last edited by abolibibelot; 29th Sep 2019 at 12:06.
    Quote Quote  
  2. Originally Posted by abolibibelot View Post
    I can proceed by elimination, in fact I'm pretty sure of which one is the good one, I just want to be sure and do a thorough comparison.
    I already did a binary compare, with the results I mentioned. Could you elaborate on how to this kind of overlay analysis with Avisynth ? And which tool(s) can do a global per frame PSNR measurement and report only the discrepancies ?
    (Perhaps it'd be best to continue in the other thread, didn't mean to hijack this one...)
    reply from other thread -

    The clips have to be aligned , same frame count
    Code:
    Overlay(clip1, clip2, mode="Difference", pc_range=true)
    Levels(127, 1, 129, 0, 255, false)
    or

    Code:
    Subtract(clip1, clip2).Levels(127, 1, 129, 0, 255)
    It will be grey if they are exactly the same

    But there can be other differences, e.g. compression . If one uses xvid, one uses xvid different settings, or avc etc...


    ffmpeg per frame PSNR . Every frame will be checked, it will be easy to see if there are differences. Infinity means bit identical. You won't get that if you have compression differences. Numbering starts at "1" not zero for this

    Code:
    ffmpeg -i test.ext -vcodec rawvideo -vf "movie=orig.ext,setpts=PTS-STARTPTS[main];[main][ref]psnr="stats_file=log.log" [out]" -f rawvideo -y /NUL
    Quote Quote  
  3. But there can be other differences, e.g. compression . If one uses xvid, one uses xvid different settings, or avc etc...
    In this case they should be strictly identical (only a few bytes are different for the whole file, as per the binary comparison, and all files have the exact same size).
    But with this method it's necessary to scrub the whole footage to detect any glitch, isn't it ?

    I tried the ffmpeg command but I get this :
    Code:
    [mpeg4 @ 00000000004f5d80] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
    Guessed Channel Layout for Input Stream #0.1 : mono
    Input #0, avi, from 'K:\ACDC - 1978 Concert Glasgow.avi':
      Duration: 00:36:19.20, start: 0.000000, bitrate: 1708 kb/s
        Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 312x222, 995 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
        Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
    [NULL @ 00000000029055c0] Unable to find a suitable output format for 'pipe:'
    pipe:: Invalid argument
    Quote Quote  
  4. Yes, it scans and compares frame by frame . You will see if there are differences in the log. Each frame will have a line in the log

    Try it this way
    Code:
    "ffmpeg" -i "test.ext" -i "reference.ext" -filter_complex "[0:v][1:v]psnr="stats_file=psnr.log" [out]" -map [out] -f rawvideo -y /NUL
    Quote Quote  
  5. This way it works :
    Code:
    ffmpeg version N-92266-gbf324359be Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 8.2.1 (GCC) 20181017
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --
    enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine -
    -enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enab
    le-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc -
    -enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va -
    -enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
      libavutil      56. 20.100 / 56. 20.100
      libavcodec     58. 33.102 / 58. 33.102
      libavformat    58. 19.102 / 58. 19.102
      libavdevice    58.  4.106 / 58.  4.106
      libavfilter     7. 37.100 /  7. 37.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    [mpeg4 @ 0000000000195800] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
    Guessed Channel Layout for Input Stream #0.1 : mono
    Input #0, avi, from 'K:\ACDC - 1978 Concert Glasgow.avi':
      Duration: 00:36:19.20, start: 0.000000, bitrate: 1708 kb/s
        Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 312x222, 995 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
        Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
    [mpeg4 @ 0000000002935540] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
    Guessed Channel Layout for Input Stream #1.1 : mono
    Input #1, avi, from 'K:\ACDC - 1978 Concert Glasgow.avi':
      Duration: 00:36:19.20, start: 0.000000, bitrate: 1708 kb/s
        Stream #1:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 312x222, 995 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
        Stream #1:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
    Stream mapping:
      Stream #0:0 (mpeg4) -> psnr:main
      Stream #1:0 (mpeg4) -> psnr:reference
      psnr -> Stream #0:0 (rawvideo)
    Press [q] to stop, [?] for help
    [mpeg4 @ 0000000000180ac0] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
    [mpeg4 @ 00000000001c8280] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
    Output #0, rawvideo, to '/NUL':
      Metadata:
        encoder         : Lavf58.19.102
        Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 312x222, q=2-31, 20779 kb/s, 25 fps, 25 tbn, 25 tbc (default)
        Metadata:
          encoder         : Lavc58.33.102 rawvideo
    [mpeg4 @ 00000000001c6280] I cbpy damaged at 4 900:03:10.12 bitrate=20770.8kbits/s dup=2 drop=0 speed= 380x
    [mpeg4 @ 00000000001c6280] Error at MB: 193
    [mpeg4 @ 00000000001c8b80] I cbpy damaged at 4 9
    [mpeg4 @ 00000000001c8b80] Error at MB: 193
    [mpeg4 @ 00000000001c6280] concealing 145 DC, 145 AC, 145 MV errors in I frame
    [mpeg4 @ 00000000001c8b80] concealing 145 DC, 145 AC, 145 MV errors in I frame
    [mpeg4 @ 0000000000180ac0] ac-tex damaged at 13 12
    [mpeg4 @ 0000000000180ac0] Error at MB: 265
    [mpeg4 @ 00000000001c8280] ac-tex damaged at 13 12
    [mpeg4 @ 00000000001c8280] Error at MB: 265
    [mpeg4 @ 0000000000180ac0] concealing 78 DC, 78 AC, 78 MV errors in P frame
    [mpeg4 @ 00000000001c8280] concealing 78 DC, 78 AC, 78 MV errors in P frame
    [mpeg4 @ 00000000001c7940] ac-tex damaged at 16 2
    [mpeg4 @ 00000000001c7940] Error at MB: 58
    [mpeg4 @ 0000000002f65340] ac-tex damaged at 16 2
    [mpeg4 @ 0000000002f65340] Error at MB: 58
    [mpeg4 @ 00000000001c7940] concealing 273 DC, 273 AC, 273 MV errors in P frame
    [mpeg4 @ 0000000002f65340] concealing 273 DC, 273 AC, 273 MV errors in P frame
    [mpeg4 @ 00000000001c74c0] Error at MB: 288 time=00:13:11.52 bitrate=20777.6kbits/s dup=4 drop=0 speed= 396x
    [mpeg4 @ 0000000002f64ec0] Error at MB: 288
    [mpeg4 @ 00000000001c74c0] concealing 54 DC, 54 AC, 54 MV errors in P frame
    [mpeg4 @ 0000000002f64ec0] concealing 54 DC, 54 AC, 54 MV errors in P frame
    [mpeg4 @ 0000000000180ac0] 1. marker bit missing in 3. esc.88 bitrate=20778.7kbits/s dup=8 drop=0 speed=400x
    [mpeg4 @ 0000000000180ac0] Error at MB: 208
    [mpeg4 @ 00000000001c8280] 1. marker bit missing in 3. esc
    [mpeg4 @ 00000000001c8280] Error at MB: 208
    [mpeg4 @ 0000000000180ac0] concealing 131 DC, 131 AC, 131 MV errors in P frame
    [mpeg4 @ 00000000001c8280] concealing 131 DC, 131 AC, 131 MV errors in P frame
    [mpeg4 @ 0000000002fda940] ac-tex damaged at 9 12=00:26:40.64 bitrate=20778.4kbits/s dup=9 drop=0 speed=400x
    [mpeg4 @ 0000000002fda940] Error at MB: 261
    [mpeg4 @ 00000000001c6280] P cbpy damaged at 7 1
    [mpeg4 @ 00000000001c6280] Error at MB: 28
    [mpeg4 @ 00000000001c8b80] P cbpy damaged at 7 1
    [mpeg4 @ 00000000001c8b80] Error at MB: 28
    [mpeg4 @ 00000000001c8700] ac-tex damaged at 9 12
    [mpeg4 @ 00000000001c8700] Error at MB: 261
    [mpeg4 @ 00000000001c8700] concealing 81 DC, 81 AC, 81 MV errors in P frame
    [mpeg4 @ 00000000001c8b80] concealing 280 DC, 280 AC, 280 MV errors in P frame
    [mpeg4 @ 00000000001c6280] concealing 280 DC, 280 AC, 280 MV errors in P frame
    [mpeg4 @ 0000000002fda940] concealing 81 DC, 81 AC, 81 MV errors in P frame
    frame=54480 fps=10044 q=-0.0 Lsize= 5527592kB time=00:36:19.20 bitrate=20779.2kbits/s dup=13 drop=0 speed= 402x
    video:5527592kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
    [Parsed_psnr_0 @ 0000000002acff00] PSNR y:inf u:inf v:inf average:inf min:inf max:inf
    But if open the 54468 lines log file with Notepad2, remove all the lines containing “psnr_avg:inf psnr_y:inf psnr_u:inf psnr_v:inf” (using the regular expression search to remove the lines numbers as well : \d\d\d\d and so on), then remove blank lines, there's nothing left... In the command output I can see that errors were found, but “concealed”, so it's of little use in a case like this apparently, as I understand it, it only proceeds to analyse “legitimate” frames, with no encoding errors.
    [Scratch that, I made a mistake in the command, see below.]

    (By the way, small detail, but why is “ffmpeg” in quotation marks in your command example ?)

    Also the locations of those errors don't seem consistent with the differences found by WinHex between these two files :
    Code:
     49709269:	FA	FF
     49709781:	C5	C0
     52267301:	76	72
     52267557:	A2	A6
     60902301:	05	01
     60902557:	FA	FE
     72985925:	1A	1B
     72986181:	55	54
     77829269:	14	10
     78189773:	C1	C0
     78190029:	CE	CF
    110620733:	E7	F7
    110620781:	EC	FC
    110620861:	78	F8
    110620941:	7F	FF
    110621341:	76	F6
    110621485:	79	F9
    110621501:	E4	F4
    110621517:	71	F1
    110621933:	7B	FB
    110621965:	E9	F9
    110622061:	EB	FB
    110622173:	EC	FC
    110622317:	E9	F9
    110622349:	E9	F9
    110622365:	7C	FC
    110622397:	E0	F0
    110622413:	7C	FC
    110622429:	ED	FD
    110622445:	76	F6
    110622493:	73	F3
    110622541:	7B	FB
    166384047:	15	11
    166384559:	02	06
    174143007:	D4	D0
    174143775:	4A	4E
    174701967:	03	07
    174702479:	64	60
    320870247:	9A	9E
    320870503:	84	80
    373940255:	FA	FE
    373941023:	75	71
    
    42 difference(s) found.
    Yes, it scans and compares frame by frame . You will see if there are differences in the log. Each frame will have a line in the log
    You mean for the Avisynth method or the ffmpeg method ? I don't see any log with Avisynth.

    If I go to timecode 3m52s720, to display a frame which I already identified as corrupted on one of these files (before it was finished downloading, by looking at the partial hashes in the metadata files and seeing that for the corresponding part it had the same hash as another file for which I had already identified a corruption at that spot), I can indeed see a garbled picture :
    Click image for larger version

Name:	ACDC Glasgow 1978 Avisynth Subtract f5818.png
Views:	174
Size:	55.8 KB
ID:	50359
    But the glitch is obvious enough in the video parsed directly that such an enhancement method is not necessary to spot it :
    Click image for larger version

Name:	ACDC Glasgow 1978 - 2878 - VD - 3m52s720 glitch vidéo.png
Views:	178
Size:	207.8 KB
ID:	50358
    What I'm looking for is a convenient way to get a list of the affected frames, so as to avoid having to painstakingly look for them in six 36min video files.

    ---------------

    EDIT : My bad, for the second ffmpeg command I put the same file name as “test” and “reference”, after correction it works as intended, once edited as described above with Notepad2 the log file shows the following lines with detected discrepancies :
    Code:
    n:5817 mse_avg:371.71 mse_y:551.46 mse_u:6.00 mse_v:18.41 psnr_avg:22.43 psnr_y:20.72 psnr_u:40.35 psnr_v:35.48 
    n:5818 mse_avg:315.46 mse_y:468.00 mse_u:4.50 mse_v:16.26 psnr_avg:23.14 psnr_y:21.43 psnr_u:41.60 psnr_v:36.02 
    n:5819 mse_avg:311.36 mse_y:462.39 mse_u:4.30 mse_v:14.32 psnr_avg:23.20 psnr_y:21.48 psnr_u:41.79 psnr_v:36.57 
    n:5820 mse_avg:276.73 mse_y:410.82 mse_u:3.87 mse_v:13.24 psnr_avg:23.71 psnr_y:21.99 psnr_u:42.25 psnr_v:36.91 
    n:5821 mse_avg:216.86 mse_y:321.86 mse_u:3.19 mse_v:10.51 psnr_avg:24.77 psnr_y:23.05 psnr_u:43.09 psnr_v:37.91 
    n:5822 mse_avg:125.97 mse_y:186.24 mse_u:2.46 mse_v:8.39 psnr_avg:27.13 psnr_y:25.43 psnr_u:44.21 psnr_v:38.89 
    n:5823 mse_avg:100.92 mse_y:149.73 mse_u:1.77 mse_v:4.86 psnr_avg:28.09 psnr_y:26.38 psnr_u:45.66 psnr_v:41.27 
    n:5824 mse_avg:87.48 mse_y:129.76 mse_u:1.67 mse_v:4.14 psnr_avg:28.71 psnr_y:27.00 psnr_u:45.91 psnr_v:41.96 
    n:5825 mse_avg:78.54 mse_y:116.39 mse_u:1.55 mse_v:4.15 psnr_avg:29.18 psnr_y:27.47 psnr_u:46.24 psnr_v:41.95 
    n:5826 mse_avg:71.32 mse_y:105.23 mse_u:1.82 mse_v:5.21 psnr_avg:29.60 psnr_y:27.91 psnr_u:45.53 psnr_v:40.97 
    n:6112 mse_avg:110.58 mse_y:164.76 mse_u:2.99 mse_v:1.47 psnr_avg:27.69 psnr_y:25.96 psnr_u:43.38 psnr_v:46.46 
    n:6113 mse_avg:89.31 mse_y:133.15 mse_u:2.15 mse_v:1.10 psnr_avg:28.62 psnr_y:26.89 psnr_u:44.81 psnr_v:47.71 
    n:6114 mse_avg:94.05 mse_y:140.35 mse_u:1.84 mse_v:1.04 psnr_avg:28.40 psnr_y:26.66 psnr_u:45.48 psnr_v:47.96 
    n:6115 mse_avg:99.47 mse_y:148.51 mse_u:1.73 mse_v:1.02 psnr_avg:28.15 psnr_y:26.41 psnr_u:45.76 psnr_v:48.04 
    n:6116 mse_avg:89.82 mse_y:134.16 mse_u:1.50 mse_v:0.77 psnr_avg:28.60 psnr_y:26.85 psnr_u:46.37 psnr_v:49.27 
    n:6117 mse_avg:81.78 mse_y:122.16 mse_u:1.39 mse_v:0.65 psnr_avg:29.00 psnr_y:27.26 psnr_u:46.71 psnr_v:50.03 
    n:6118 mse_avg:75.32 mse_y:112.57 mse_u:1.12 mse_v:0.50 psnr_avg:29.36 psnr_y:27.62 psnr_u:47.63 psnr_v:51.18 
    n:6119 mse_avg:66.90 mse_y:100.03 mse_u:0.93 mse_v:0.33 psnr_avg:29.88 psnr_y:28.13 psnr_u:48.43 psnr_v:52.89 
    n:8571 mse_avg:0.11 mse_y:0.16 mse_u:0.00 mse_v:0.00 psnr_avg:57.82 psnr_y:56.06 psnr_u:inf psnr_v:inf 
    n:8572 mse_avg:0.12 mse_y:0.19 mse_u:0.00 mse_v:0.00 psnr_avg:57.20 psnr_y:55.44 psnr_u:inf psnr_v:inf 
    n:8573 mse_avg:0.12 mse_y:0.18 mse_u:0.00 mse_v:0.00 psnr_avg:57.35 psnr_y:55.59 psnr_u:inf psnr_v:inf 
    n:8574 mse_avg:0.11 mse_y:0.16 mse_u:0.00 mse_v:0.00 psnr_avg:57.78 psnr_y:56.02 psnr_u:inf psnr_v:inf 
    n:8575 mse_avg:0.10 mse_y:0.15 mse_u:0.00 mse_v:0.00 psnr_avg:58.08 psnr_y:56.32 psnr_u:inf psnr_v:inf 
    n:8576 mse_avg:0.09 mse_y:0.14 mse_u:0.00 mse_v:0.00 psnr_avg:58.40 psnr_y:56.64 psnr_u:inf psnr_v:inf 
    n:8577 mse_avg:0.09 mse_y:0.14 mse_u:0.00 mse_v:0.00 psnr_avg:58.44 psnr_y:56.67 psnr_u:inf psnr_v:inf 
    n:9179 mse_avg:41.73 mse_y:61.13 mse_u:3.92 mse_v:1.95 psnr_avg:31.93 psnr_y:30.27 psnr_u:42.19 psnr_v:45.23 
    n:9180 mse_avg:38.14 mse_y:55.97 mse_u:3.30 mse_v:1.69 psnr_avg:32.32 psnr_y:30.65 psnr_u:42.95 psnr_v:45.84 
    n:9181 mse_avg:36.93 mse_y:54.19 mse_u:3.18 mse_v:1.61 psnr_avg:32.46 psnr_y:30.79 psnr_u:43.10 psnr_v:46.06 
    n:9182 mse_avg:36.54 mse_y:53.64 mse_u:3.10 mse_v:1.59 psnr_avg:32.50 psnr_y:30.84 psnr_u:43.21 psnr_v:46.10 
    n:9183 mse_avg:35.79 mse_y:52.52 mse_u:3.07 mse_v:1.58 psnr_avg:32.59 psnr_y:30.93 psnr_u:43.26 psnr_v:46.14 
    n:9184 mse_avg:34.38 mse_y:50.44 mse_u:2.96 mse_v:1.53 psnr_avg:32.77 psnr_y:31.10 psnr_u:43.41 psnr_v:46.28 
    n:17304 mse_avg:40.43 mse_y:58.77 mse_u:4.08 mse_v:3.43 psnr_avg:32.06 psnr_y:30.44 psnr_u:42.02 psnr_v:42.78 
    n:17305 mse_avg:73.48 mse_y:107.39 mse_u:5.73 mse_v:5.60 psnr_avg:29.47 psnr_y:27.82 psnr_u:40.55 psnr_v:40.65 
    n:17306 mse_avg:73.65 mse_y:107.75 mse_u:5.48 mse_v:5.42 psnr_avg:29.46 psnr_y:27.81 psnr_u:40.74 psnr_v:40.79 
    n:20452 mse_avg:0.40 mse_y:0.56 mse_u:0.08 mse_v:0.05 psnr_avg:52.13 psnr_y:50.62 psnr_u:59.16 psnr_v:61.03 
    n:20453 mse_avg:0.41 mse_y:0.58 mse_u:0.07 mse_v:0.04 psnr_avg:52.03 psnr_y:50.47 psnr_u:59.75 psnr_v:61.88 
    n:20454 mse_avg:0.40 mse_y:0.58 mse_u:0.06 mse_v:0.04 psnr_avg:52.11 psnr_y:50.52 psnr_u:60.46 psnr_v:62.66 
    n:20455 mse_avg:0.39 mse_y:0.56 mse_u:0.06 mse_v:0.03 psnr_avg:52.22 psnr_y:50.63 psnr_u:60.70 psnr_v:62.98 
    n:20456 mse_avg:0.39 mse_y:0.56 mse_u:0.05 mse_v:0.03 psnr_avg:52.22 psnr_y:50.61 psnr_u:60.88 psnr_v:63.18 
    n:20457 mse_avg:0.37 mse_y:0.53 mse_u:0.05 mse_v:0.03 psnr_avg:52.50 psnr_y:50.90 psnr_u:61.06 psnr_v:63.30 
    n:20458 mse_avg:0.34 mse_y:0.49 mse_u:0.05 mse_v:0.03 psnr_avg:52.80 psnr_y:51.21 psnr_u:61.11 psnr_v:63.94 
    n:20459 mse_avg:0.19 mse_y:0.27 mse_u:0.05 mse_v:0.02 psnr_avg:55.29 psnr_y:53.78 psnr_u:61.42 psnr_v:65.59 
    n:20460 mse_avg:0.19 mse_y:0.27 mse_u:0.05 mse_v:0.02 psnr_avg:55.28 psnr_y:53.77 psnr_u:61.32 psnr_v:65.64 
    n:20518 mse_avg:518.30 mse_y:770.03 mse_u:17.52 mse_v:12.21 psnr_avg:20.98 psnr_y:19.27 psnr_u:35.70 psnr_v:37.27 
    n:20519 mse_avg:487.29 mse_y:723.57 mse_u:16.34 mse_v:13.10 psnr_avg:21.25 psnr_y:19.54 psnr_u:36.00 psnr_v:36.96 
    n:20520 mse_avg:418.95 mse_y:622.36 mse_u:13.28 mse_v:10.95 psnr_avg:21.91 psnr_y:20.19 psnr_u:36.90 psnr_v:37.74 
    n:37684 mse_avg:255.94 mse_y:378.73 mse_u:11.15 mse_v:9.54 psnr_avg:24.05 psnr_y:22.35 psnr_u:37.66 psnr_v:38.34 
    n:37685 mse_avg:233.74 mse_y:346.02 mse_u:9.92 mse_v:8.41 psnr_avg:24.44 psnr_y:22.74 psnr_u:38.17 psnr_v:38.88 
    n:37686 mse_avg:227.06 mse_y:336.39 mse_u:9.12 mse_v:7.70 psnr_avg:24.57 psnr_y:22.86 psnr_u:38.53 psnr_v:39.27 
    n:37687 mse_avg:210.65 mse_y:312.09 mse_u:8.40 mse_v:7.13 psnr_avg:24.90 psnr_y:23.19 psnr_u:38.89 psnr_v:39.60 
    n:37688 mse_avg:204.91 mse_y:303.62 mse_u:8.09 mse_v:6.91 psnr_avg:25.02 psnr_y:23.31 psnr_u:39.05 psnr_v:39.74 
    n:43904 mse_avg:44.60 mse_y:66.34 mse_u:1.39 mse_v:0.83 psnr_avg:31.64 psnr_y:29.91 psnr_u:46.71 psnr_v:48.92 
    n:43905 mse_avg:202.12 mse_y:300.68 mse_u:5.18 mse_v:4.86 psnr_avg:25.07 psnr_y:23.35 psnr_u:40.99 psnr_v:41.26 
    n:43906 mse_avg:189.70 mse_y:282.31 mse_u:4.60 mse_v:4.37 psnr_avg:25.35 psnr_y:23.62 psnr_u:41.50 psnr_v:41.73 
    n:43907 mse_avg:176.78 mse_y:263.16 mse_u:4.23 mse_v:3.78 psnr_avg:25.66 psnr_y:23.93 psnr_u:41.87 psnr_v:42.35 
    n:43908 mse_avg:157.47 mse_y:234.39 mse_u:3.92 mse_v:3.31 psnr_avg:26.16 psnr_y:24.43 psnr_u:42.20 psnr_v:42.94 
    n:43909 mse_avg:122.06 mse_y:181.44 mse_u:3.62 mse_v:3.00 psnr_avg:27.27 psnr_y:25.54 psnr_u:42.55 psnr_v:43.37 
    n:43910 mse_avg:96.79 mse_y:143.72 mse_u:3.26 mse_v:2.60 psnr_avg:28.27 psnr_y:26.56 psnr_u:42.99 psnr_v:43.98 
    n:43911 mse_avg:84.87 mse_y:125.99 mse_u:2.78 mse_v:2.48 psnr_avg:28.84 psnr_y:27.13 psnr_u:43.69 psnr_v:44.18
    If I then check those frames on the file already identified as corrupted, I can see that they are indeed garbled ; in most instances it's much less obvious than on the example shown above (it could pass as encoding artifacts and would be quite difficult to spot, well, on the spot). For the last ones, starting from 43904, it's slightly shifted : in VirtualDub looking at the original footage or in AVSPMod looking at the “Subtract” output, I can see defects but starting from 43913.
    Last edited by abolibibelot; 30th Sep 2019 at 09:45.
    Quote Quote  
  6. Now, beyond ExactAudioCopy, what are the available tools and methods to do the same kind of comparison for the audio ? Preferably without having to first extract / convert the audio track. I have seen in a recent thread screenshots of what appears like an audio wave comparison made with Audacity, but I can't find any such function in the version I have installed, which is, hem, from 2015... So has it been implemented recently ? Would it work for such a task (providing a list of differences found, or allowing to quickly jump to the next) or are there better suited methods ?
    Quote Quote  
  7. Audacity: Load two tracks, invert one, merge two tracks into one, amplify. If they're identical the result will be silence.
    Quote Quote  
  8. Originally Posted by abolibibelot View Post

    (By the way, small detail, but why is “ffmpeg” in quotation marks in your command example ?)
    Enclose in quotations marks when you have spaces in the path

    Yes, it scans and compares frame by frame . You will see if there are differences in the log. Each frame will have a line in the log
    You mean for the Avisynth method or the ffmpeg method ? I don't see any log with Avisynth.
    Yes ffmpeg method. That avisynth method is for visual comparison, to see where there are changes on frames spatially. But you could make a script that parses and only prints a text file with frame numbers if certain conditions that you specify are met, such as WriteFileIf()

    Eitherway for any similar method - frames have to be aligned for valid comparisons; otherwise you are comparing different frames and get false positives. e.g. if you had a glitch that causes a timecode error, dropped frame, it might not be aligned after that point
    Quote Quote  
  9. Audacity: Load two tracks, invert one, merge two tracks into one, amplify. If they're identical the result will be silence.
    Works indeed (most confusing part is how to select one complete track), even with native mono audio. In this case one glitch is strong enough that it results in a very obvious 100% peak.
    Click image for larger version

Name:	068 ~ 2985 audio Audacity (mono).png
Views:	134
Size:	67.9 KB
ID:	50362
    After a 30dB amplification for most of the track (the maximum would have been 30.1dB), and a -0.5dB amplification for that one spot, four peaks are clearly visible :
    Click image for larger version

Name:	068 ~ 2985 audio Audacity (mono, après amplification +30dB et -0.5dB au niveau du pic Ă* 100%).png
Views:	120
Size:	68.1 KB
ID:	50363
    Here the one on the left would have been very difficult to spot by comparing the original waveforms (while the one on the right is more obvious) :
    Click image for larger version

Name:	068 ~ 2985 audio Audacity (mono, après amplification +30dB et -0.5dB au niveau du pic Ă* 100%) .png
Views:	126
Size:	69.6 KB
ID:	50364

    So there is no commonly available tool which can analyse two video files and report all discrepancies for video frames as well as audio samples in a single operation ?
    Quote Quote  
  10. Enclose in quotations marks when you have spaces in the path
    Alright (it would be clearer with something like "path to ffmpeg\ffmpeg.exe") ; in case someone reads this later and is confused : it works with ffmpeg alone and without quotation marks if the path where the ffmpeg.exe executable is located is already set in the command prompt (using CD), or if that location has been added to the general Windows system PATH.

    That avisynth method is for visual comparison, to see where there are changes on frames spatially. But you could make a script that parses and only prints a text file with frame numbers if certain conditions that you specify are met, such as WriteFileIf()
    What could be those conditions in such a situation ?
    And could Avisynth similarly compare the audio, using the same kind of trick described above with Audacity, or is it too limited for audio editing to perform such a task ?

    Eitherway for any similar method - frames have to be aligned for valid comparisons; otherwise you are comparing different frames and get false positives. e.g. if you had a glitch that causes a timecode error, dropped frame, it might not be aligned after that point
    In this case the errors don't seem to affect more than a few frames / audio samples. As you can see above those differences are few and far between (42 bytes is the most I've seen so far).

    I'm still wondering what could have caused that kind of very limited corruption, and repeated several times in slightly different ways... (That file must have been circulating for about two decades – I had already downloaded it in 2007 ! I had stored it on a CD, but after re-compressing the audio, so it's not the original. But, looking at a backup made then, I can see that the checksum for that file downloaded then is the same as the one for the file I have identified as most probably the good, glitch-free one, which seems to confirm that finding.)
    Last edited by abolibibelot; 30th Sep 2019 at 11:33.
    Quote Quote  
  11. You can get a text file with a list of different frames from AviSynth using WriteFile().




    Code:
    ##########################################################################
    #
    # Abs(v1-v2)
    #
    # diffs of Y, U, V channels returned in Y only, UtoY() and VtoY() stacked
    # works for YUY2 and YV12 only
    #
    ##########################################################################
    
    function AbsSubtract(clip v1, clip v2)
    {
        Subtract(v1, v2).ColorYUV(off_y=2)
        IsYUY2() ? StackHorizontal(last.GreyScale(), UtoY(), VtoY()) : last
        IsYV12() ? StackHorizontal(last.GreyScale(), StackVertical(UtoY(), VtoY())) : last
        Overlay(last.ColorYUV(off_y=-128), last.Invert().ColorYUV(off_y=-127), mode="add")
    }
    
    ##########################################################################
    
    # open v1 and v2, the two videos to compare.  We're going to create videos with ColorBars() here:
    v1 = ColorBars().Trim(0,150).ConvertToYUY2() # or YV12
    
    # Create v2 from v1 with a small error in the blue bar in frame 101:
    v2 = v1.Trim(0,100) + v1.Trim(101,101).ColorYUV(off_u=60).ColorYUV(off_u=-60) + v1.Trim(102,0)
    # Add a small error in the bright white patch in frame 51:
    v2 = v2.Trim(0,50) + v2.Trim(51,51).ColorYUV(off_y=40).ColorYUV(off_y=-40) + v2.Trim(52,0)
    
    # subtract/abs the two clips
    AbsSubtract(v1,v2)
    
    WriteFile requires planar color format
    ConvertToYV12()
    
    # create a file called diffs.txt with a list of only frames that are different
    WriteFileIf("diffs.txt", "AverageLuma>0.0", "current_frame", flush=true)
    
    # create a file called avgluma.txt that shows the average luma of all frames
    colon = ": "
    WriteFile("avgluma.txt", "current_frame", "colon", "AverageLuma")
    
    
    # increase the brightness so we can see the differences
    ColorYUV(gain_y=4000)
    Open the script in an editor or encoder and run through it. For example, VirtualDubs' File -> Run Video Analysis Pass.

    diffs.txt:
    Code:
    51
    101
    avgluma.txt:
    Code:
    0: 0.000000
    0: 0.000000
    1: 0.000000
    2: 0.000000
    3: 0.000000
    4: 0.000000
    5: 0.000000
    6: 0.000000
    7: 0.000000
    8: 0.000000
    9: 0.000000
    10: 0.000000
    11: 0.000000
    12: 0.000000
    13: 0.000000
    14: 0.000000
    15: 0.000000
    16: 0.000000
    17: 0.000000
    18: 0.000000
    19: 0.000000
    20: 0.000000
    21: 0.000000
    22: 0.000000
    23: 0.000000
    24: 0.000000
    25: 0.000000
    26: 0.000000
    27: 0.000000
    28: 0.000000
    29: 0.000000
    30: 0.000000
    31: 0.000000
    32: 0.000000
    33: 0.000000
    34: 0.000000
    35: 0.000000
    36: 0.000000
    37: 0.000000
    38: 0.000000
    39: 0.000000
    40: 0.000000
    41: 0.000000
    42: 0.000000
    43: 0.000000
    44: 0.000000
    45: 0.000000
    46: 0.000000
    47: 0.000000
    48: 0.000000
    49: 0.000000
    50: 0.000000
    51: 0.067383
    52: 0.000000
    53: 0.000000
    54: 0.000000
    55: 0.000000
    56: 0.000000
    57: 0.000000
    58: 0.000000
    59: 0.000000
    60: 0.000000
    61: 0.000000
    62: 0.000000
    63: 0.000000
    64: 0.000000
    65: 0.000000
    66: 0.000000
    67: 0.000000
    68: 0.000000
    69: 0.000000
    70: 0.000000
    71: 0.000000
    72: 0.000000
    73: 0.000000
    74: 0.000000
    75: 0.000000
    76: 0.000000
    77: 0.000000
    78: 0.000000
    79: 0.000000
    80: 0.000000
    81: 0.000000
    82: 0.000000
    83: 0.000000
    84: 0.000000
    85: 0.000000
    86: 0.000000
    87: 0.000000
    88: 0.000000
    89: 0.000000
    90: 0.000000
    91: 0.000000
    92: 0.000000
    93: 0.000000
    94: 0.000000
    95: 0.000000
    96: 0.000000
    97: 0.000000
    98: 0.000000
    99: 0.000000
    100: 0.000000
    101: 0.131836
    102: 0.000000
    103: 0.000000
    104: 0.000000
    105: 0.000000
    ...
    Quote Quote  
  12. Originally Posted by abolibibelot View Post

    That avisynth method is for visual comparison, to see where there are changes on frames spatially. But you could make a script that parses and only prints a text file with frame numbers if certain conditions that you specify are met, such as WriteFileIf()
    What could be those conditions in such a situation

    In your case, maybe LumaDifference(clip1, clip2)

    It could be as simple as

    Code:
    clip1 = whateversource(a)
    clip2 = whateversource(b)
    
    clip1
    WriteFileIf(last, "log.txt", "LumaDifference(clip1, clip2) > 0.1", "current_frame")
    Same thing, run vdub2 run analysis pass, or run it through ffmpeg null pass, or avsr

    And it will write only framenumbers for frames that are different, so you don't have to "cull" them with a text editor later . (And don't forget avisynth frame numbering starts at zero, unlike the ffmpeg psnr/ssim logs)
    Quote Quote  
  13. @poisondeathray
    It could be as simple as
    Code:
    clip1 = whateversource(a)
    clip2 = whateversource(b)
    
    clip1
    WriteFileIf(last, "log.txt", "LumaDifference(clip1, clip2) > 0.1", "current_frame")
    Result :
    Code:
    5818
    5819
    5820
    5821
    5822
    5823
    5824
    5825
    5826
    5827
    6114
    6115
    6116
    6117
    6118
    6119
    6120
    6121
    9181
    9182
    9183
    9184
    9185
    9186
    17307
    17308
    17309
    20521
    20522
    20523
    37691
    37692
    37693
    37694
    37695
    43913
    43914
    43915
    43916
    43917
    43918
    43919
    43920
    Strangely the values are shifted forward by 1 (at the beginning) to 9 (at the end) instead of being shifted backward by 1 throughout as I expected based on what you wrote.
    Also some intervals are missing : 8571-8577, 20452-20460.
    I tried again with “> 0.0” based on “jagabo”'s script suggestion, those missing ranges are there this time (with the same shifts as before – but as I indicated above the values reported by ffmpeg seem a bit off by the end) :
    Code:
    5818
    5819
    5820
    5821
    5822
    5823
    5824
    5825
    5826
    5827
    6114
    6115
    6116
    6117
    6118
    6119
    6120
    6121
    8573
    8574
    8575
    8576
    8577
    8578
    8579
    9181
    9182
    9183
    9184
    9185
    9186
    17307
    17308
    17309
    20455
    20456
    20457
    20458
    20459
    20460
    20461
    20462
    20463
    20521
    20522
    20523
    37691
    37692
    37693
    37694
    37695
    43913
    43914
    43915
    43916
    43917
    43918
    43919
    43920
    Same thing, run vdub2 run analysis pass, or run it through ffmpeg null pass, or avsr
    How do you do a null pass ? (Only two instances of “null” in the 798KB dump of ffmpeg's full help, neither is relevant.)
    And what is “avsr” ?
    Last edited by abolibibelot; 30th Sep 2019 at 15:01.
    Quote Quote  
  14. Originally Posted by abolibibelot View Post
    Strangely the values are shifted forward by 1 (at the beginning) to 9 (at the end) instead of being shifted backward by 1 throughout as I expected based on what you wrote.
    Also some intervals are missing : 8571-8577, 20452-20460.
    I tried again with “> 0.0” based on “jagabo”'s script suggestion, those missing ranges are there this time
    Right, if on some frames, the differences are "tiny" below the 0.1 threshold, they might not be picked up . Often you want some "wiggle room" to account for compression differences, but in your case you don't , so >0 is better




    How do you do a null pass ? (Only two instances of “null” in the 798KB dump of ffmpeg's full help, neither is relevant.)
    And what is “avsr” ?
    It's just running the script with no ffmpeg output, analogous to vdub analysis pass .

    Code:
    ffmpeg -i input.avs -an -f null NUL
    avsr is commandline tool made by groucho, same author as avsmeter. Same idea as the other two - it runs an input script with no output. (So things like writefile, or imagewriter, etc... can be run in the script)
    Quote Quote  
  15. Note that LumaDifference only detects differences in the luma. A color video and a greyscale version of the same video will show no differences. So you may also want to check ChromaUDifference and ChromaVDifference.
    Quote Quote  
  16. avsr is commandline tool made by groucho, same author as avsmeter.
    Any reason why it's not on Videohelp's software section ?

    Note that LumaDifference only detects differences in the luma. A color video and a greyscale version of the same video will show no differences. So you may also want to check ChromaUDifference and ChromaVDifference.
    In this case I would guess that if a one byte error is enough to generate a visible glitch on several frames in a row, it's going to affect all aspects of the picture, considering that lossy encoders like Xvid process everything simultaneously so as to reach the highest possible compression ratio. Ain't that so ?
    Also, isn't a “greyscale version” precisely a luma only rendition ?
    Quote Quote  
  17. Originally Posted by abolibibelot View Post
    avsr is commandline tool made by groucho, same author as avsmeter.
    Any reason why it's not on Videohelp's software section ?
    I don't know how tools get listed or updated here


    Note that LumaDifference only detects differences in the luma. A color video and a greyscale version of the same video will show no differences. So you may also want to check ChromaUDifference and ChromaVDifference.
    In this case I would guess that if a one byte error is enough to generate a visible glitch on several frames in a row, it's going to affect all aspects of the picture, considering that lossy encoders like Xvid process everything simultaneously so as to reach the highest possible compression ratio. Ain't that so ?
    Also, isn't a “greyscale version” precisely a luma only rendition ?


    If "the whatever defect cause" only affected one of the color channels(U, V) , you'd miss an error if you only looked at the Y channel

    If you wanted to, you can modify your condition to include those

    It takes logic operators like AND, NOT , OR, EQUALTO etc... "OR" uses "||" notation and might be appropriate for this situation, so if there is a diff in any of the 3 channels it will print

    "LumaDifference(clip1, clip2) > 0 || ChromaUDifference(clip1, clip2) > 0 || ChromaUDifference(clip1, clip2) > 0 "
    Quote Quote  
  18. Another way to compare audio might be to use AudioGraph() in AviSynth. That filter draws the audio waveform onto the video. Graph the audio of the two files on black backgrounds and compare the videos with the above techniques.

    Image
    [Attachment 50377 - Click to enlarge]


    Getting the audio sync'd perfectly may be hard.

    I haven't seen a 64 bit version of AudioGraph(). There's a 64 bit filter called Spectograph(). As the name implies it draws spectograms rather than waveforms but it should work for finding audio differences too.
    Quote Quote  
  19. Member
    Join Date
    Apr 2018
    Location
    Croatia
    Search Comp PM
    Originally Posted by jagabo View Post
    Audacity: Load two tracks, invert one, merge two tracks into one, amplify. If they're identical the result will be silence.
    Same can be done with ffmpeg.
    Quote Quote  
  20. Originally Posted by poisondeathray View Post
    Thanks for that. I checked it out and verified one could detect small audio differences with it.

    Code:
    a1 = WavSource("audio1.wav").ConvertAudioToFloat() # 38 second wav file
    a2 = WavSource("audio2.wav").ConvertAudioToFloat() # same wav with small changes
    
    v1 = AudioDub(BlankClip(width=1280, height=720, length=38*24, pixel_type="YV12"), a1).WaveForm(Window=0, height=1.0, zoom=3.0)
    v2 = AudioDub(BlankClip(width=1280, height=720, length=38*24, pixel_type="YV12"), a2).WaveForm(Window=0, height=1.0, zoom=3.0)
    
    WriteFileIf(Subtract(v1,v2).Levels(127,1,129,0,255), "log.txt", "LumaDifference(v1, v2) > 0.0", "current_frame")
    You have to be careful with the Zoom option of WaveForm(). It apparently doesn't bound check writing the graph to the video frame and may attempt to write outside the frame when zoom is too high, crashing the filter/program. The wav file I was using had a fairly low volume so I set Zoom to 3. At 4 or more the filter would crash. Maybe one should amplify the audio rather than zoom the waveform graph.

    This technique may miss some small differences because of the limited video resolution.
    Last edited by jagabo; 2nd Oct 2019 at 10:30.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!