0

I'm currently trying top download some clips and then merge them into one video. However, for some reason im getting the following error:

Traceback (most recent call last):
  File "F:\tarkovYoutubeAutomation\main.py", line 223, in <module>
    download_concatinate()
  File "F:\tarkovYoutubeAutomation\main.py", line 68, in download_concatinate
    output = subprocess.check_output(cmd).decode("utf-8").strip()
  File "C:\Users\myalt\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\myalt\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\myalt\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\myalt\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

The filepath (as seen below) is correct.

F:\tarkovYoutubeAutomation\clips\New to Tarkov and my 3 seasoned friends had to spectate this.mp4

enter image description here

If anybody could explain why im recieving this error, it would be greatly appriciated.

            count += 1
            video_url = f'{p.url}'

            ydl_opts = {'outtmpl': f"./clips/{p.title}"}

            with youtube_dl.YoutubeDL(ydl_opts) as ydl:
                ydl.download([video_url])

            input_video = f"F:\\tarkovYoutubeAutomation\\clips\\{p.title}.mp4"
            print(input_video)
            cmd = ["ffprobe", "-i", input_video, "-show_entries", "format=duration",
                   "-v", "quiet", "-sexagesimal", "-of", "csv=p=0"]
            output = subprocess.check_output(cmd).decode("utf-8").strip()

            total_seconds = 0
            hour, minutes, seconds = output.split('.')[0].split(':')
            total_seconds += int(hour) * 3600
            total_seconds += int(minutes) * 60
            total_seconds += int(seconds)

            if total_seconds >= 100:
                print(f'{total_seconds} longer than 60 seconds.')
                os.remove(f'./clips/{p.title}.mp4')
                urls.insert_one({'url': p.url})
            else:
                print(f' {total_seconds} not longer than 60 seconds')
                urls.insert_one({'url': p.url})```
lolnoob lolnooa
  • 59
  • 1
  • 3
  • 8
  • I think the problem isn't that the video file isn't being found., it's that the executable `ffprobe` isn't being found. – Luke Woodward Jul 04 '21 at 19:45
  • Oh right. Do you happen to know how I can fix that? It works in my other python venv just fine, but not in this one. @LukeWoodward – lolnoob lolnooa Jul 06 '21 at 03:42
  • Whether the executable is found depend on whether the directory containing it is on the `PATH`. Take a look at the value of the environment variable `PATH`. I'm not sure virtualenvs make a difference here. – Luke Woodward Jul 06 '21 at 20:56

0 Answers0