0

So I'm trying to merge audio and video using ffmpeg-python but it keeps telling me one error

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

Here's the code that im trying

def videoAudio():
    input_video = ffmpeg.input('./ONLYVIDEO.mp4')
    input_audio = ffmpeg.input('./ONLYAUDIO.webm')
    ffmpeg.concat(input_video, input_audio, v=1, a=1).output('./complete.mp4').run()

Any ideas of what's wrong?

  • What is the absolute path to the video and audio, what is your working directory, and what does `videoName` and `audioName` contain ? – TheEagle May 15 '21 at 16:31
  • Look again at the code i tried another thing at it gives the same error but much cleaner code – angelord2k6 May 15 '21 at 16:45
  • We still need the path to the folder where your script was executed from, and the absolute path to both the audio and video files – TheEagle May 15 '21 at 17:13
  • C:\Users\angel\Desktop\python, they are in the same folder C:\Users\angel\Desktop\python\mergeFiles.py C:\Users\angel\Desktop\python\ONLYAUDIO.webm C:\Users\angel\Desktop\python\ONLYVIDEO.mp4 – angelord2k6 May 15 '21 at 17:18
  • ... Please add a `import os; print(os,getcwd())` to your code … – TheEagle May 15 '21 at 17:26
  • C:\Users\angel\Desktop\python – angelord2k6 May 15 '21 at 18:06
  • And im on windows 10 in visual studio code – angelord2k6 May 15 '21 at 18:06
  • Weird … What happens if you use the complete paths ? (`C:\Users\angel\Desktop\python\ONLYVIDEO.mp4`, `C:\Users\angel\Desktop\python\ONLYAUDIO.webm`) – TheEagle May 15 '21 at 20:03
  • def videoAudio(): input_video = ffmpeg.input('C:\Users\angel\Desktop\python\ONLYVIDEO.mp4') input_audio = ffmpeg.input('C:\Users\angel\Desktop\python\ONLYAUDIO.webm') ffmpeg.concat(input_video, input_audio, v=1, a=1).output('C:\Users\angel\Desktop\python\complete.mp4').run() So like ther¡s a problem doing this because the path contains "\a" and pyhton interprets that like unicode and give me error:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape – angelord2k6 May 15 '21 at 20:17
  • The system cannot find `ffmpeg.exe` (command line tool). See: [Python ffmpeg won't accept path, why?](https://stackoverflow.com/questions/65836756/python-ffmpeg-wont-accept-path-why). – Rotem May 15 '21 at 20:31
  • It works, I installed ffmpeg, put it in the path folder of windows and put ffmpeg.exe in the python folder and it works, thanks bro you saved me – angelord2k6 May 15 '21 at 21:16
  • Ahh, that was a good point @Rotem, without you we would have continued to check on the files location and eventually ended up without a solution ! – TheEagle May 15 '21 at 22:12

1 Answers1

0

Enter here to download ffmpeg.exe, you have to have it where you're executing the script. Python ffmpeg won't accept path, why?

Look UP at the comments section of the question to see more information