====== Videos aus dem Web herunterladen ======
:!: **Wichtige Info:**\\
Das letzte offizielle Release des Projekts, Version 2021.12.17, ist inzwischen disfunktional. Ein aktiv entwickelter Fork, der auch regelmäßig Releases herausgibt, ist "yt-dlp": [[https://wiki.ubuntuusers.de/yt-dlp/]]\\
Quelle: [[https://wiki.ubuntuusers.de/youtube-dl/]]
Das Tool fürs Herunterladen lautet **youtube-dl** (ein Python-Programm).
Die **Voraussetzung** für das Tool: **ffmpeg**.
Die Installation (unter Ubuntu aus der Repository "universe") von "ffmpeg":
sudo apt-get install ffmpeg
Die **Installation** (unter Ubuntu aus der Repository "universe") von "youtube-dl" ist nicht empfehlenswert - die Programmversion in den offiziellen Paketquellen ist veraltet.
Installation von "youtube-dl" mit **pip** (das Programm wird nur für den aktuellen Nutzer installiert):
pip3 install --user youtube-dl
Falls "pip3" nicht installiert ist, nachholen:
sudo apt install python3-pip
Die Nutzung von "youtube-dl":
youtube-dl [OPTIONEN] URL_DER_WEBSEITE_DES_VIDEOS
Beispiel:
juergen@ws45:~/tmp$ youtube-dl "https://youtu.be/walwdY8ssrE"
Ergebnis:
[youtube] walwdY8ssrE: Downloading webpage
[youtube] walwdY8ssrE: Downloading video info webpage
[download] Destination: In Memory of Gregg Nielson Chopin Nocturne #20 C Sharp Minor Valentina Lisitsa-walwdY8ssrE.mp4
[download] 100% of 14.72MiB in 00:03
Wenn nur der Ton gespeichert werden soll:
juergen@ws45:~/tmp$ youtube-dl -x "https://youtu.be/walwdY8ssrE"
Man kann auch festlegen, in welchen Format der Ton gespeichert werden soll:
juergen@ws45:~/tmp$ youtube-dl -x --audio-format mp3 --audio-quality 0 "https://youtu.be/walwdY8ssrE"
Es ist möglich, mit dem Parameter **-F** auf eine einfache Weise herauszufinden, welche Download-Formate zur Verfügung stehen. Zum Beispiel:
juergen@ws45:~/Downloads$ youtube-dl -F https://youtu.be/tOvT9foopvo
[youtube] tOvT9foopvo: Downloading webpage
[info] Available formats for tOvT9foopvo:
format code extension resolution note
249 webm audio only tiny 58k , opus @ 50k (48000Hz), 29.35MiB
250 webm audio only tiny 79k , opus @ 70k (48000Hz), 36.86MiB
140 m4a audio only tiny 135k , m4a_dash container, mp4a.40.2@128k (44100Hz), 78.59MiB
251 webm audio only tiny 146k , opus @160k (48000Hz), 65.13MiB
278 webm 256x144 144p 107k , webm container, vp9, 25fps, video only, 30.07MiB
160 mp4 256x144 144p 184k , avc1.4d400c, 25fps, video only, 27.99MiB
242 webm 426x240 240p 223k , vp9, 25fps, video only, 45.11MiB
133 mp4 426x240 240p 340k , avc1.4d4015, 25fps, video only, 59.67MiB
243 webm 640x360 360p 430k , vp9, 25fps, video only, 76.76MiB
134 mp4 640x360 360p 638k , avc1.4d401e, 25fps, video only, 106.85MiB
244 webm 854x480 480p 804k , vp9, 25fps, video only, 119.69MiB
135 mp4 854x480 480p 944k , avc1.4d401e, 25fps, video only, 194.23MiB
247 webm 1280x720 720p 1573k , vp9, 25fps, video only, 220.48MiB
136 mp4 1280x720 720p 1985k , avc1.4d401f, 25fps, video only, 386.62MiB
18 mp4 640x360 360p 299k , avc1.42001E, 25fps, mp4a.40.2@ 96k (44100Hz), 181.70MiB
22 mp4 1280x720 720p 765k , avc1.64001F, 25fps, mp4a.40.2@192k (44100Hz) (best)
juergen@ws45:~/Downloads$
In der 1. Spalte stehen die direkten Format-Codes, die man fürs Download direkt verwenden kann. Ich möchte z.B. in dem Format "%%mp4 1280x720 720p 765k , avc1.64001F, 25fps, mp4a.40.2@192k (44100Hz)%%" herunterladen (die unterste Zeile), das hat den Format-Code "22".
Damit starten wir das Download:
juergen@ws45:~/Downloads$ youtube-dl -f 22 https://youtu.be/tOvT9foopvo
[youtube] tOvT9foopvo: Downloading webpage
[download] Destination: VIDEOAKTIV-Expert-Talk - Insta 360 One R und Schnitt-Ratgeber-tOvT9foopvo.mp4
[download] 100% of 464.61MiB in 01:21
juergen@ws45:~/Downloads$
Um jetzt zu ermitteln, welche Parameter das heruntergeladene Video hat (das gilt auch für jedes beliebiges Video), brauchen wir **ffmpeg** mit dem Parameter **-i**:
juergen@ws45:~/Downloads$ ffmpeg -i VIDEOAKTIV-Expert-Talk\ -\ Insta\ 360\ One\ R\ und\ Schnitt-Ratgeber-tOvT9foopvo.mp4
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VIDEOAKTIV-Expert-Talk - Insta 360 One R und Schnitt-Ratgeber-tOvT9foopvo.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2020-06-07T08:37:54.000000Z
Duration: 01:24:51.58, start: 0.000000, bitrate: 765 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 634 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 2020-06-07T08:37:54.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 06/07/2020.
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
creation_time : 2020-06-07T08:37:54.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 06/07/2020.
At least one output file must be specified
juergen@ws45:~/Downloads$
Quelle: [[https://wiki.ubuntuusers.de/youtube-dl/]]
Viel Spaß beim Herunterladen! :-)
:!: Sollte "youtube-dl" auf einmal nicht mehr funktionieren, dann einfach Update einspielen:
pip3 install youtube-dl
----
Stand: 18.01.2021
EOF