How do I get number of frames from the m4a file?

189 Views Asked by At

I want to open the m4a audio file for analysis but I am getting this error.

  File "E:\audio stego\code.py", line 5, in <module>
    song = AudioSegment.from_file('E:\\audio stego\\03 VALNDALUM UMMODU.m4a')

  File "C:\ProgramData\Anaconda3\lib\site-packages\pydub\audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)

  File "C:\ProgramData\Anaconda3\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in __init__
    super(SubprocessPopen, self).__init__(*args, **kwargs)

  File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1311, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

FileNotFoundError: [WinError 2] The system cannot find the file specified
1

There are 1 best solutions below

0
On BEST ANSWER

The problem is that you haven't avconv installed or in your PATH. To install it, you can follow these steps: https://github.com/jiaaro/pydub#getting-ffmpeg-set-up

If you're on windows, there are a few steps to add the folder to your PATH:

  1. Download the latest version of Libav here: http://builds.libav.org/windows/release-gpl/ (don't pick the mingw versions if you don't know what they do)
  2. Extract everything from the archive (you can use a free tool like WinRar or PeaZip)
  3. Move the folder to your user one:
    • Right-click on the extracted libav folder
    • Click Cut
    • Press your windows key and your R key at the same time
    • Type in %userprofile%. Another window will open
    • Right click on an empty space and press Paste
  4. Search with the search bar environ and click on Edit system variables.
  5. Click on Environment variables.... You find two panels: one with User Variables for [user] and one with System Variables.
  6. In the User Variables panel, find the Path variable and double-click it.
  7. Click on New and enter %USERPROFILE%\libav\bin.
  8. Press Ok on every window to close them.
  9. Log out and log in back adn you're done!