1. 程式人生 > >如何下載高清晰度音視訊檔案(youtube-dl 相關tips)

如何下載高清晰度音視訊檔案(youtube-dl 相關tips)

在油管下載的1080p以上的視訊,一般是視訊檔案和音訊檔案分開的。

1、獲得指定連結中的視訊格式

youtube-dl --list-formats 【url】

 

比如:youtube-dl --list-formats  https://www.youtube.com/watch?v=OAxsrhmWztA&t=2s

 

2、按format code下載指定的質量的視訊

youtube-dl -f 【format code】 【url】 

注:一般最好的格式是137

比如:youtube-dl -f 137  https://www.youtube.com/watch?v=OAxsrhmWztA&t=2s

 

 

3、下載音訊

youtube-dl -f 【format code】 【url】 

注:格式是m4a檔案,一般格式編號為140

比如:youtube-dl -f 140  https://www.youtube.com/watch?v=OAxsrhmWztA&t=2s

 

4、使用ffmpeg 合併影視訊檔案:

ffmpeg -i 【不帶音訊的視訊檔案.mp4】 -i 【音訊檔案.m4a】 -c:v  copy -c:a copy  【音視訊合成後的檔案.mp4】

比如:ffmpeg -i fanghuanoaudio137.mp4 -i  fanghuaaudio.m4a -c:v  copy -c:a copy  fanghuavideoandaudio.mp4