• EnglishSpanishGermanFrenchPolishChinese (Traditional)


EnglishSpanishGermanFrenchPolishChinese (Traditional)

Operating systems, scripting, PowerShell and security

Operating systems, software development, scripting, PowerShell tips, network and security

Menú principal
  • Categorías
  • Cursos
  • Libro de PowerShell
  • Lo mejor
  • Lo último
  • Proyectos
  • Contactar
Ir al contenido

Download videos from YouTube (youtube-dl) and convert to MP3 (FFmpeg)

PowerShell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#Open file
(Get-Content F:\power\urls.txt) | %{
#URL
Write-Host $_
#Save file in c:\power
Set-Location F:\power
#Use youtube-dl to download video from Youtube
#Youtube-dl is a small command-line program to download videos from YouTube.com and a few more sites.
F:\power\youtube-dl.exe $_ > result.txt
#Select file in result.txt
$result=(Get-Content result.txt)
$file=$result -match 'Destination: '
$file=$file.Replace('[download] Destination: ','')
$filewithoutspaces=$file.Replace(' ','')
$filewithoutext=$filewithoutspaces.replace('.mp4','.mp3')
#Rename file and replace spaces
Rename-Item $file $filewithoutspaces
#Convert MP4 to MP3 with FFmpeg
#FFmpeg complete, cross-platform solution to record, convert and stream audio and video.
#Example ffmpeg -i input.mp4 output.mp3
F:\power\ffmpeg\bin\ffmpeg.exe -i $filewithoutspaces -acodec libmp3lame -ab 128k $filewithoutext
}

 

Publicado el día 19 de octubre de 2014

CATEGORÍAS

Multimedia, PowerShell

ETIQUETAS

Download, FFmpeg, Get-Content, input, Jesús Niño Camazón, match, Rename-Item, Replace, Set-Location, Write-Host, Youtube

MÁS

  • Ejercicios de PowerShell: ejercicios sobre ficheros, programas y procesos
  • Ejercicios de PowerShell: ejercicios básicos sobre el sistema de archivos en PowerShell
  • Ejercicios de PowerShell: repaso del bucle foreach y de ficheros
  • Capturar las teclas que se pulsan desde PowerShell y calcular el tiempo total que transcurre desde el inicio hasta que se empezó a pulsar la primera letra y se siguen pulsando hasta finalizar
  • Functions in PowerShell
  • Ejercicios de PowerShell: ejercicios sobre sistemas de archivos (mezclado con procesos)