Python - audiodiff can't find file that exists

532 views Asked by At

I'm comparing wav files, this script worked fine until I switched to LMDE Betsy. The function that is giving me my error is:

def already_valid (arg_wav):
    for w in wavs:
         size_arg = getsize(arg_wav.src_path)
         size_w = getsize(w.src_path)
         if 0 < size_w == size_arg and w.src_path != arg_wav.src_path:
             print arg_wav.src_path, "::", w.src_path
             if audiodiff.audio_equal(arg_wav.src_path, w.src_path):
                 return True
    return False

My first thought was that it was trying to open the same file twice, but w.src_path != arg_wav.src_path should account for that. I am getting this output:

From my function:

/home/will/Desktop/soundfiles/TITAN Recordings/6648/hold1_por.wav :: /home/will/Desktop/soundfiles/TITAN Recordings/6677/hold1_por.wav

Traceback:

Traceback (most recent call last):
  File "call_diff.py", line 145, in <module>
    verified += handle_wav(p)
  File "call_diff.py", line 73, in handle_wav
    if already_valid(curr_wav):
  File "call_diff.py", line 96, in already_valid
    if audiodiff.audio_equal(arg_wav.src_path, w.src_path):
  File "/usr/local/lib/python2.7/dist-packages/audiodiff/__init__.py", line 51, in audio_equal
    return checksum(name1, ffmpeg_bin) == checksum(name2, ffmpeg_bin)
  File "/usr/local/lib/python2.7/dist-packages/audiodiff/__init__.py", line 86, in checksum
    stderr=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

What's so odd is that it worked yesterday on Linux Mint 17.1 and on Windows 7. Is this some weird Debian convention I don't know about? Yes, I double-checked and both files exist in the path described.

1

There are 1 answers

0
JoshRomRock On BEST ANSWER

If you look at the source code of audiodiff, you'll see that you need to have ffmpeg installed and perhaps to have the path to ffmpeg binary set into FFMPEG_BIN environment variable.

https://github.com/clee704/audiodiff/blob/master/audiodiff/init.py