Skip to content

Instantly share code, notes, and snippets.

@gnanet
Created June 1, 2019 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnanet/d35701faa02d1095f9c6ff21f973bc65 to your computer and use it in GitHub Desktop.
Save gnanet/d35701faa02d1095f9c6ff21f973bc65 to your computer and use it in GitHub Desktop.
Audió letöltése youtube-ról a youtube-dl segítségvel
#!/bin/bash
# -F, --list-formats List all available formats of requested videos
# -f, --format FORMAT Video format code, see the "FORMAT SELECTION" for all the info: https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection
# You can also use special names to select particular edge case formats:
# - bestaudio: Select the best quality audio only-format. May not be available.
# - best: Select the best quality format represented by a single file with video and audio.
# Since the end of April 2015 and version 2015.04.26, youtube-dl uses -f bestvideo+bestaudio/best as the default format selection.
# -x, --extract-audio Convert video files to audio-only files (requires ffmpeg or avconv and ffprobe or avprobe)
# --audio-format FORMAT Specify audio format: "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav"; "best" by default; No effect without -x
# --audio-quality QUALITY Specify ffmpeg/avconv audio quality, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K
# (default 5)
# -k, --keep-video Keep the video file on disk after the post-processing; the video is erased by default
# --no-post-overwrites Do not overwrite post-processed files; the post-processed files are overwritten by default
if [ $1 ]; then $yt_video_url="$1" ; else echo "Paraméter: VideoURL"; exit; fi
# 0. (opcionális) Listázza ki az elérhető formátumokat/minőségeket
#youtube-dl -F "$yt_video_url"
# Audio formátum választék: "aac", "flac", "mp3", "m4a", "opus", "vorbis", "wav"
audio_format="mp3"
# Audio minőség VBR esetén 0 (legjobb) és 9 (legrosszabb) között, vagy add meg a bitrátát pl: 128K
audio_quality="5"
# Ha meg szeretnéd tartani a letöltött eredeti file-t
#keep_video="--keep-video"
# Véletlen újraletöltés esetén a feldolgozott file-t nem szeretnéd újra generáltatni
keep_result_file="--no-post-overwrites"
# 1. töltse le az elérhető legjobb audiominőséget, vagy a legjobb minőségű kombinált video+audio file-t, készítsen audio-t
youtube-dl -f bestaudio/best -x --audio-format ${audio_format} --audio-quality ${audio_quality} ${keep_result_file} ${keep_video} "$yt_video_url"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment