1

This was all written in Jupyter Notebook online. What supposed to happen, is the first line of the code is a command that converts some file in the folder labeled "capstone" into an mp4. This works fine, however the problem I'm running into is a "FileNotFoundError", and I'm not sure why this is happening, as I check to see if the file is there, it is in fact there.

!ffmpeg -i recording1.mov -q:v 0 output.mp4

import librosa
audio_path = '/home/gentry/capstone/output1.mp4'
x , sr = librosa.load(audio_path)
print(type(x), type(sr))

import matplotlib.pyplot as plt
import librosa.display
plt.figure(figsize=(14, 5))

librosa.display.waveplot(x, sr=sr)

X = librosa.stft(x)
Xdb = librosa.amplitude_to_db(abs(X))
plt.figure(figsize=(14, 5))

librosa.display.specshow(Xdb, sr=sr, x_axis='time', y_axis='hz') 

librosa.display.specshow(Xdb, sr=sr, x_axis='time', y_axis='log')

The output should be a visualized waveform of a sound, and two subsequent Fourier transform graphs. I can provide additional details as requested

Lofton Gentry
  • 189
  • 1
  • 13
  • could you run this command in one of your cells ```ls``` , aslo I noticed ffmpeg output is named ```output.mp4``` while your audio path contains ```ouptut1.mp4``` – kareem_emad Apr 06 '20 at 00:59
  • @kareem_emad that's a typo on my part, `output1.mp4` should be there, but even when it is, it still does not work properly. Also what does this `ls` do? I've tried executing it and it didn't work. I'm still new to Jupyter Notebook, but not coding in general. – Lofton Gentry Apr 06 '20 at 02:02
  • sorry for late response -different time zones-, the command !ls should show you the available files in the current directory, the output file should one of them – kareem_emad Apr 06 '20 at 13:18

2 Answers2

2

Ok, I will just make small modifications to your code to make all paths relative so the error may not be for wrong manual string path you wrote.

First I ran this command as is:

!ffmpeg -i recording1.mov -q:v 0 output.mp4

then to make sure that I have the output right

!ls | grep output

that should give you

output.mp4

Then as I know that the file is in the same directory as my notebook, I will make the load command as follows

import librosa
audio_path = './output.mp4'
x , sr = librosa.load(audio_path)
print(type(x), type(sr))

That works perfectly and loads the audio component, my figs maybe totally different than yours as I'm using some random video not your input one as it's not provided

enter image description here

kareem_emad
  • 1,123
  • 1
  • 7
  • 12
  • This does help explain what you are doing better, but I found out that my pathway is different, because this code was provided to me by my professor I'm working with. As stupid as it sounds (and as I am), `audio_path = '/home/gentry/capstone/output1.mp4` should actually just be `audio_path = ./output1.mp4` in my case. Simple mistake on my part, but thank you for helping – Lofton Gentry Apr 06 '20 at 15:09
0

It is actually just a simple mistake of pathways being different, as this was provided to me by a professor, so audio_path = '/home/gentry/capstone/output1.mp4' should actually just be audio_path = './output1.mp4'

Lofton Gentry
  • 189
  • 1
  • 13