Similar to the above I use the following to download the best video and best audio for all videos in a playlist
There's a manual component and you need FFMpeg folder in the same director as youtube-dl
First run .\youtube-dl.exe --list-formats https://www.youtube.com/watch?v=cTcMtgA6iYt
sample output:
Output of .\youtube-dl.exe --list-formats https://www.youtube.com/watch?v=cTcMtgA6iYt
Now pick the format numbers you want to merge [137 for video and 140 for audio]
Note | you need to pick the same format container e.g. 313 for video won't work with 140, you need a webm audio only file like 251
then run the following
.\youtube-dl.exe --ffmpeg-location "D:\FFmpeg\ffmpeg-N-100072-g1555cfedf6-win64-gpl-shared-vulkan\bin\ffmpeg.exe" --format 137+140 --yes-playlist -i https://www.youtube.com/playlist?list=PLFfX4Mdr5gLs52KWVl3KQNrRpTmLOn
once that finishes downloading all files where 137 was available, then re-run the same command, but this time with the next best code like 136+140
and what i usually do is...
at the very end...i run
.\youtube-dl.exe --ffmpeg-location "D:\FFmpeg\ffmpeg-N-100072-g1555cfedf6-win64-gpl-shared-vulkan\bin\ffmpeg.exe" --format 22 --yes-playlist -i https://www.youtube.com/playlist?list=PLFfX4Mdr5gLs52KWVl3ZQNrSoTmLOnQdk
22 - will pick up all videos missed, its a video and audio merged file that youtube-dl downloads by default, when you ommmit the format switch