AssemblyAI / cookbook

A resource of code examples, guides, and tutorials for using the AssemblyAI API.
MIT License
97 stars 4 forks source link

Problems with ffmpeg location #59

Closed davemaster closed 2 weeks ago

davemaster commented 2 months ago

using your transcribe_youtube_videos, I have an error about ffmpeg location:

import yt_dlp

URLS = ['https://www.youtube.com/watch?v=wtolixa9XTg']

my_ffmpeg = "C:\\Program Files (x86)\\WinFF"

ydl_opts = {
    'format': 'm4a/bestaudio/best',  # The best audio version in m4a format
    'outtmpl': '%(id)s.%(ext)s',  # The output name should be the id followed by the extension
    'ffmpeg-location': my_ffmpeg,
    'postprocessors': [{  # Extract audio using ffmpeg
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'm4a',
        #'ffmpeg-location': my_ffmpeg,
    }]
}

the output: [youtube] Extracting URL: https://www.youtube.com/watch?v=wtolixa9XTg [youtube] wtolixa9XTg: Downloading webpage [youtube] wtolixa9XTg: Downloading ios player API JSON [youtube] wtolixa9XTg: Downloading web creator player API JSON [youtube] wtolixa9XTg: Downloading m3u8 information [info] wtolixa9XTg: Downloading 1 format(s): 140 [download] wtolixa9XTg.m4a has already been downloaded [download] 100% of 7.14MiB ERROR: Postprocessing: ffprobe and ffmpeg not found. Please install or provide the path using --ffmpeg-location

Error at the end:

DownloadError: ERROR: Postprocessing: ffprobe and ffmpeg not found. Please install or provide the path using --ffmpeg-location

a-dinoto commented 1 month ago

@davemaster Hello! Thanks for reaching out. I find that using "ffmpeg-location" can cause issues and that it is better to download it with either Homebrew (for Mac) or Chocolatey (for Windows) as these both automatically add ffmpeg to PATH. If using Homebrew to install ffmpeg run the code brew install ffmpeg . If you are using Chocolatey to install ffmpeg then use the code choco install ffmpeg-full . Once ffmpeg is installed then your code should look like this when you run it:

import yt_dlp

URLS = ['https://www.youtube.com/watch?v=wtolixa9XTg']

ydl_opts = {
    'format': 'm4a/bestaudio/best',  # The best audio version in m4a format
    'outtmpl': '%(id)s.%(ext)s',  # The output name should be the id followed by the extension
    'postprocessors': [{  # Extract audio using ffmpeg
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'm4a',
    }]
}

with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    error_code = ydl.download(URLS)

Please let me know if that helps!

davemaster commented 1 month ago

Ok, I'll try in a break time

El jue, 12 sept 2024 a las 9:20, Amanda DiNoto @.***>) escribió:

@davemaster https://github.com/davemaster Hello! Thanks for reaching out. I find that using "ffmpeg-location" can cause issues and that it is better to download it with either Homebrew https://docs.brew.sh/Installation (for Mac) or Chocolatey https://chocolatey.org/install (for Windows) as these both automatically add ffmpeg to PATH. If using Homebrew to install ffmpeg https://formulae.brew.sh/formula/ffmpeg run the code brew install ffmpeg . If you are using Chocolatey to install ffmpeg https://community.chocolatey.org/packages/ffmpeg-full then use the code choco install ffmpeg-full . Once ffmpeg is installed then your code should look like this when you run it:

import yt_dlp

URLS = ['https://www.youtube.com/watch?v=wtolixa9XTg']

ydl_opts = { 'format': 'm4a/bestaudio/best', # The best audio version in m4a format 'outtmpl': '%(id)s.%(ext)s', # The output name should be the id followed by the extension 'postprocessors': [{ # Extract audio using ffmpeg 'key': 'FFmpegExtractAudio', 'preferredcodec': 'm4a', }] }

with yt_dlp.YoutubeDL(ydl_opts) as ydl: error_code = ydl.download(URLS)

Please let me know if that helps!

— Reply to this email directly, view it on GitHub https://github.com/AssemblyAI/cookbook/issues/59#issuecomment-2346437602, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGUX3SASU3JEXPQLU5M4DZWGPK3AVCNFSM6AAAAABNRGER72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBWGQZTONRQGI . You are receiving this because you were mentioned.Message ID: @.***>

-- David Elias Flores Escalante TeleTracking SAC

davemaster commented 1 month ago

I think Youtube now is delivering video and audio separately

[image: imagen.png]

El jue, 12 sept 2024 a las 10:00, David Elias Flores Escalante (< @.***>) escribió:

Ok, I'll try in a break time

El jue, 12 sept 2024 a las 9:20, Amanda DiNoto @.***>) escribió:

@davemaster https://github.com/davemaster Hello! Thanks for reaching out. I find that using "ffmpeg-location" can cause issues and that it is better to download it with either Homebrew https://docs.brew.sh/Installation (for Mac) or Chocolatey https://chocolatey.org/install (for Windows) as these both automatically add ffmpeg to PATH. If using Homebrew to install ffmpeg https://formulae.brew.sh/formula/ffmpeg run the code brew install ffmpeg . If you are using Chocolatey to install ffmpeg https://community.chocolatey.org/packages/ffmpeg-full then use the code choco install ffmpeg-full . Once ffmpeg is installed then your code should look like this when you run it:

import yt_dlp

URLS = ['https://www.youtube.com/watch?v=wtolixa9XTg']

ydl_opts = { 'format': 'm4a/bestaudio/best', # The best audio version in m4a format 'outtmpl': '%(id)s.%(ext)s', # The output name should be the id followed by the extension 'postprocessors': [{ # Extract audio using ffmpeg 'key': 'FFmpegExtractAudio', 'preferredcodec': 'm4a', }] }

with yt_dlp.YoutubeDL(ydl_opts) as ydl: error_code = ydl.download(URLS)

Please let me know if that helps!

— Reply to this email directly, view it on GitHub https://github.com/AssemblyAI/cookbook/issues/59#issuecomment-2346437602, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGUX3SASU3JEXPQLU5M4DZWGPK3AVCNFSM6AAAAABNRGER72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBWGQZTONRQGI . You are receiving this because you were mentioned.Message ID: @.***>

-- David Elias Flores Escalante TeleTracking SAC

-- David Elias Flores Escalante TeleTracking SAC

davemaster commented 1 month ago

@davemaster Hello! Thanks for reaching out. I find that using "ffmpeg-location" can cause issues and that it is better to download it with either Homebrew (for Mac) or Chocolatey (for Windows) as these both automatically add ffmpeg to PATH. If using Homebrew to install ffmpeg run the code brew install ffmpeg . If you are using Chocolatey to install ffmpeg then use the code choco install ffmpeg-full . Once ffmpeg is installed then your code should look like this when you run it:

import yt_dlp

URLS = ['https://www.youtube.com/watch?v=wtolixa9XTg']

ydl_opts = {
    'format': 'm4a/bestaudio/best',  # The best audio version in m4a format
    'outtmpl': '%(id)s.%(ext)s',  # The output name should be the id followed by the extension
    'postprocessors': [{  # Extract audio using ffmpeg
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'm4a',
    }]
}

with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    error_code = ydl.download(URLS)

Please let me know if that helps!

Doesn't. Seems Youtube is serving audio separate from video

imagen

The file downloaded by script, has no audio

dan-ince-aai commented 1 month ago

@davemaster Hello David!

Everything looks to be set up as intended, when running the script on my end it results in a successful m4a download. Could you double check by first deleting the current wtolixa9XTg.m4a file you have stored and re-running the script?

davemaster commented 1 month ago

Yes, I will check.

file downloaded, no-audio

I re-do everything, as soon as I get some time

El vie, 13 sept 2024 a las 3:17, Daniel Ince @.***>) escribió:

@davemaster https://github.com/davemaster Hello David!

Everything looks to be set up as intended, when running the script on my end it results in a successful m4a download. Could you double check by first deleting the current wtolixa9XTg.m4a file you have stored and re-running the script?

— Reply to this email directly, view it on GitHub https://github.com/AssemblyAI/cookbook/issues/59#issuecomment-2348321839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGUX7YYLUXZUDEJ4RDG2LZWKNPXAVCNFSM6AAAAABNRGER72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBYGMZDCOBTHE . You are receiving this because you were mentioned.Message ID: @.***>

-- David Elias Flores Escalante TeleTracking SAC