[-BUG- FIXED in 1.0.9.1] Track length discrepancies again

Discussion in 'AnyStream' started by 0x0x0x0x0, Jan 10, 2021.

  1. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member

    So I've gotten the last season of "How to get away with murder" from 'flix, and 9/15 episodes had A-V track discrepancies >15s. Are we anywhere closer to closing in on this bug? Sounds like the last MPD entry for the track is not getting downloaded?


    Edit: it's the video tracks that are shorter than the audio ones in this case.
     
    Last edited: Jan 11, 2021
  2. Prospere

    Prospere RedFox Development Team

    Thanks for signalling this!
    Luckily, I do have that in my region. Which episodes are the problematic ones? As well, what resolution/language+bitrate did you select (just that I have the same source for further investigation)
     
  3. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member

    Code:
    ! How to Get Away With Murder_S06E04_I Hate the World.mp4 |v @ 1920x1080|=43:33.0945 |a E-AC-3 @640000 (en)|=43:49.0280 (15.335 s)
    ! How to Get Away With Murder_S06E04_I Hate the World.ru.mp4 |v @ 1920x1080|=43:33.0945 |a E-AC-3 @640000 (ru)|=43:49.0280 (15.335 s)
    ! How to Get Away With Murder_S06E05_We're All Gonna Die.mp4 |v @ 1920x1080|=43:27.0396 |a E-AC-3 @640000 (en)|=43:45.0440 (18.044 s)
    ! How to Get Away With Murder_S06E05_We're All Gonna Die.ru.mp4 |v @ 1920x1080|=43:27.0396 |a E-AC-3 @640000 (ru)|=43:45.0440 (18.044 s)
    ! How to Get Away With Murder_S06E06_Family Sucks.mp4 |v @ 1920x1080|=43:20.0807 |a E-AC-3 @640000 (en)|=43:43.0136 (22.329 s)
    ! How to Get Away With Murder_S06E06_Family Sucks.ru.mp4 |v @ 1920x1080|=43:20.0807 |a E-AC-3 @640000 (ru)|=43:43.0136 (22.329 s)
    ! How to Get Away With Murder_S06E07_I'm the Murderer.mp4 |v @ 1920x1080|=42:40.0850 |a E-AC-3 @640000 (en)|=42:59.0360 (18.51 s)
    ! How to Get Away With Murder_S06E07_I'm the Murderer.ru.mp4 |v @ 1920x1080|=42:40.0850 |a E-AC-3 @640000 (ru)|=42:59.0360 (18.51 s)
    ! How to Get Away With Murder_S06E08_I Want to Be Free.mp4 |v @ 1920x1080|=43:27.0396 |a E-AC-3 @640000 (en)|=43:45.0440 (18.044 s)
    ! How to Get Away With Murder_S06E08_I Want to Be Free.ru.mp4 |v @ 1920x1080|=43:27.0396 |a E-AC-3 @640000 (ru)|=43:45.0440 (18.044 s)
    ! How to Get Away With Murder_S06E09_Are You the Mole.mp4 |v @ 1920x1080|=43:12.0381 |a E-AC-3 @640000 (en)|=43:27.0392 (15.011 s)
    ! How to Get Away With Murder_S06E09_Are You the Mole.ru.mp4 |v @ 1920x1080|=43:12.0381 |a E-AC-3 @640000 (ru)|=43:27.0392 (15.011 s)
    ! How to Get Away With Murder_S06E10_We're Not Getting Away With It.mp4 |v @ 1920x1080|=43:37.0907 |a E-AC-3 @640000 (en)|=43:57.0344 (19.437 s)
    ! How to Get Away With Murder_S06E10_We're Not Getting Away With It.ru.mp4 |v @ 1920x1080|=43:37.0907 |a E-AC-3 @640000 (ru)|=43:57.0344 (19.437 s)
    ! How to Get Away With Murder_S06E12_Let's Hurt Him.mp4 |v @ 1920x1080|=42:47.0231 |a E-AC-3 @640000 (en)|=43:17.0408 (30.177 s)
    ! How to Get Away With Murder_S06E12_Let's Hurt Him.ru.mp4 |v @ 1920x1080|=42:47.0231 |a E-AC-3 @640000 (ru)|=43:17.0408 (30.177 s)
    ! How to Get Away With Murder_S06E15_Stay.mp4 |v @ 1920x1080|=44:35.0464 |a E-AC-3 @640000 (en)|=44:55.0328 (19.864 s)
    ! How to Get Away With Murder_S06E15_Stay.ru.mp4 |v @ 1920x1080|=44:35.0464 |a E-AC-3 @640000 (ru)|=44:55.0328 (19.864 s)
    
    Let me know if you need anything else :)
     
  4. Xander

    Xander Well-Known Member

    0x0x0x0x0 is that a script? if so can you share it?
     
  5. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member

    Yup, but all you really need is a recent version of MediaInfo and the right argument string, here's the relevant part of it (perl):

    Code:
    use constant MEDIAINFO_BIN => "/usr/bin/mediainfo";
    use constant MEDIAINFO_ARGS => "--Inform=General;%Duration% \nVideo;%Duration% %Width% %Height% \nAudio;%Duration% %Format% %BitRate% %Language%";
    use constant DISCR_THRESH => 15;
    
    
    sub chk_mp4_duration($$) {
      my ($path, $thresh) = (shift, shift);
    
      open(MEDIAINFO, "-|", MEDIAINFO_BIN, MEDIAINFO_ARGS, $path) or die;
      chomp(my $line = <MEDIAINFO>);
      close(MEDIAINFO);
    
      if($line !~ m/^(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s([^\s]+)\s(\d+)\s(\w+)$/) {
        print "! Can't get duriations for $path ($line)\n";
        return -1;
      }
      my ($c, $v, $w, $h, $a, $f, $r, $l) = ($1, $2, $3, $4, $5, $6, $7, $8);
    
      my $discrepancy = abs($v - $a) / 1000;
    
      print "! $path |v @ " . $w . "x" . $h . "|=" . fmt_millis($v)
            . " |a ". $f . " @". $r . " (" . $l . ")|=" . fmt_millis($a)
            . " ($discrepancy s)\n" if $discrepancy > $thresh;
    
      return $c;
    }
    
    ...
    
    chk_mp4_duration($src, DISCR_THRESH);
    
    ...
    
    

    It had a bit of a feature creep since Prospere asked for extra details, I could tidy it up and post it, but I'm hoping @Prospere will make it obsolete faster than I tidy it up ;-)
     
    Last edited: Jan 12, 2021
  6. Prospere

    Prospere RedFox Development Team

    Thanks :)
    Hope so too
     
  7. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member

    I threw together a dirty hack meanwhile (somehow it seemed easier than tidying up a script that does more than just work out track lengths):

    Let's be imaginative and call the script... 'script' (it relies on `bash-isms' as mediainfo needs \n to be expanded into newline chars):-
    Code:
    $ cat ~/script
    
    #!/bin/bash
    
    mediainfo $'--Inform=Video;%Duration% \nAudio;%Duration%' "$1" | awk -F' ' '{d=$1 - $2; d=(d < 0 ? -d : d); exit (d <= 15000);}';
    
    invoke it with:-

    Code:
    find <path to mp4 dir> -type f -name '*.mp4' -exec ~/script "{}" \; -print
    
    That will print filenames where the difference between the video and the audio tracks is more than 15000 milliseconds.

    NB: single vs double quotes matter, don't interchange them.

    Edit: inverted the logic => fewer things to type ;-)

    Edit 2: now that caffeine's kicked in, even simpler without scripts:-

    Code:
    for f in <path to mp4s>/*.mp4; do mediainfo $'--Inform=Video;%Duration% \nAudio;%Duration%' "$f" | awk -F' ' '{d=$1 - $2; d=(d < 0 ? -d : d); exit (d > 15000);}' ||  echo "$f"; done
    

    Edit 3: if you're stuck with Windows only, but have MediaInfo CLI[1] installed in C:\MediaInfo\MediaInfo.exe, for example, here's a bit of PowerShell for you:

    Code:
    gci <path to mp4s> -Filter '*.mp4' | %{ $name=$_.FullName; C:\MediaInfo\MediaInfo.exe "--Inform=Video;%Duration% `nAudio;%Duration%" $name | %{ $l=$_.Split(' '); $d=[math]::abs($l[0] - $l[1]); if($d -gt 15000){ $d/=1000; "$name |v|=" + $l[0] + " |a|=" + $l[1] + " ($d s)"};}}
    
    Code:
    
    1: https://mediaarea.net/download/binary/mediainfo/20.09/MediaInfo_CLI_20.09_Windows_x64.zip
    
    

    Bet there's something you don't hear every day: "I hope your work obsoletes my work!" ;-)
     
    Last edited: Jan 12, 2021
  8. Prospere

    Prospere RedFox Development Team

    So it is, sir.
     
  9. primal

    primal Member

    I have had to do a manual fix for this (video shorter than audio). I have noticed when I download with DD+ track this happens with the following episodes...

    BSG Mini-series ep01 (AP-CA)

    Picard s01e03 (AP-UK)

    Smallville s03e07 (AP-CA)

    TNG s02e12 & s05e20 (AP-US)


    I decided to download the same episodes with the AAC track, the video is perfect...so I just remuxed the "Video" from AAC track file with "Audio" from the DD+ file and got a perfect file each time.

    I used MKVToolNix for remuxing.

    It is kinda a pain to download the same episode twice, but this issue is more rare than common. I hope this helps someone who needs a interim fix.
     
    0x0x0x0x0 likes this.
  10. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member



    I never would've even thought to try that! As the saying goes: money see---monkey do; so I did, and seems to have worked for two episodes that I tried, kudos @primal !

    @Prospere, given that AS fetches the same video track regardless of the audio selection, perhaps it's a muxing problem? Is it too early to refresh my [REQ] for a ticky in the settings to keep the tracks separate? :p
     
  11. Xander

    Xander Well-Known Member

    will need to try that windows version cli :)
     
  12. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member


    try this one instead, it's better because I'm lazy and if I can get a computer to do things instead of myself, I would (the letter after the 'bang' will tell you what track is short, the difference is always V-A):

    Code:
    $thresh=15000; gci <path to mp4s> -Filter '*.mp4' | %{ $name=$_.FullName; C:\MediaInfo\MediaInfo.exe "--Inform=Video;%Duration% `nAudio;%Duration%" $name | %{ $l=$_.Split(' '); $d=$l[0] - $l[1];if([math]::abs($d) -gt $thresh){ $d/=1000; "!" + (&{if($d -lt 0){"V "}else{"A "}}) + $name + " |v|=" + $l[0] + " |a|=" + $l[1] + " ($d s)"};}}
    
    Edit: cleanup

    PS: setting $thresh to be less than 1000 is meaningless (even raw encrypted streams differ within 1000ms of each other for some titles)
     
    Last edited: Jan 13, 2021
  13. Prospere

    Prospere RedFox Development Team

    My apologies for you having to go through this sort of pain in the neck. I am working on a solution
     
    primal and 0x0x0x0x0 like this.
  14. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member

  15. Greg Alex

    Greg Alex Well-Known Member

    i know this is a little off topic but can someone confirm what is the recommended course of action on installing the new version?

    I'm currently using the old version, should i uninstall it from my pc and install the new one, or simple just download the new version and allow it to update itself?
     
  16. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member

    just install it over the old one, that's all, it's tried and tested!
     
    Last edited: Feb 4, 2021
  17. Greg Alex

    Greg Alex Well-Known Member

    Ok, thanks!
     
  18. primal

    primal Member

  19. NutFlush920

    NutFlush920 Well-Known Member

    How are you able to get Picard? I thought it was only on the CBS app unless I purchase on Amazon.
     
  20. 0x0x0x0x0

    0x0x0x0x0 Well-Known Member