icon robot josef

“Simply” downloading best available audio and video stream without merging them

For this case, an output template should be used since by default, bestvideo and bestaudio will have the same file name.

$ yt-dlp -f "bv,ba" -o "%(title)s.f%(format_id)s.%(ext)s" <url>

Download the best video available with the largest resolution but no better than 720p

or the best video with the smallest resolution if there is no video under 480p (Resolution is determined by using the smallest dimension. This works correctly for vertical videos as well

$ yt-dlp -S "res:720" <url>

List available AV tracks

$ yt-dlp -F <URL>

e.g.

$ yt-dlp -F https://www.arte.tv/de/videos/087960-005-A/

which give a table similar to this:

Available formats for 087960-005-A
ID EXT RESOLUTION FPS VCODEC VBR ACODEC MORE INFO
VFAUD-program_audio_0-VFAUD mp4 audio only audio only unknown [fr] Französisch (Hörfilm) [AD (frz.)]
VF-STF-program_audio_0-VF mp4 audio only audio only unknown [fr] Französisch [FR]
VOA-STA-program_audio_0-VOA mp4 audio only audio only unknown [de] Deutsch [DE]
VOA-STA-422 mp4 384x216 25 avc1.42e00d 423k video only Deutsch [DE]
VOA-STA-717 mp4 640x360 25 avc1.4d401e 718k video only Deutsch [DE]
VOA-STA-1111 mp4 768x432 25 avc1.4d401e 1112k video only Deutsch [DE]
VOA-STA-1900 mp4 1280x720 25 avc1.4d401f 1900k video only Deutsch [DE]
VOA-STA-1997 mp4 1920x1080 25 avc1.4d0028 1998k video only Deutsch [DE]

Download video

$ yt-dlp -f VOA-STA-1997 <URL>

If downloading audio or video tracks of a series and tracks are named identical for all the episodes, a loop may make things easier:

for i in {1..5}; do yt-dlp -f VFAUD-program_audio_0-VFAUD https://www.arte.tv/de/videos/087960-00"$i"-A; done

List available subtitles

$ yt-dlp --list-subs <URL>

Download all subtitles, nothing else

$ yt-dlp --all-subs --skip-download <URL>

Config

Place the config in your PATH, e.g. < kbd>{XDG_CONFIG_HOME}/yt-dlp/config This may or may not work:

# Check all formats for whether they are actually downloadable
--check-all-formats

# Subtitle format; accepts formats preference separated by "/", e.g.  "srt" or "ass/srt/best"
--sub-format srt

# Languages of the subtitles to download (can be regex) or "all" separated by commas,
--sub-langs all

--write-subs

# Download without merge
-f 'bestvideo,bestaudio'

Demux mp4

mediainfo shows, what codecs are used. Extract the video and audio streams from the container:

$ ffmpeg -i file.mp4 -vcodec copy -an -bsf:v h264_mp4toannexb file.h264
$ ffmpeg -i file.mp4 -acodec copy -vn file.aac

via
via