nbr23 / youtube-dl-server

Web / REST interface for downloading youtube videos onto a server.
MIT License
243 stars 34 forks source link

Youtube download customisation #63

Open simb24 opened 2 years ago

simb24 commented 2 years ago

In many attempts I didn't find way to download from Youtube only H264+AAC mp4 formats video. How I can modify config.yml or any other way to achieving that? I use Synology NAS docker. Any options apart best, such as MP4, created video without audio. Thanks in advance.

iaredavid01 commented 2 years ago

@simb24 Check out youtube-dl's documentation. In your config.yml file you can try adding the following to the ydl_options: section

EDIT: However, this assumes that the format key takes precedence over the webui configuration. I'm still skimming over the project, so I can't be certain. If I find time, I'll spin up a new container and test it out myself. @simb24, In the meantime, this info is still useful if you're comfortable with the command line and really need a specific output format.

I'm sure you can find more on the /r/youtubedl subreddit. I figured it out myself by trying out the stuff from the readme. If you get youtube-dl onto your computer, you can play around with the --list-formats/-F option to list available formats for a particular URL. For example, this is the output from running youtube-dl -F https://www.youtube.com/watch?v=RxzC2S8Z2Ng

[youtube] RxzC2S8Z2Ng: Downloading webpage
[youtube] RxzC2S8Z2Ng: Downloading android player API JSON
[info] Available formats for RxzC2S8Z2Ng:
format code  extension  resolution  note
sb2          mhtml      48x27       storyboard, video only
sb1          mhtml      80x45       storyboard, video only
sb0          mhtml      160x90      storyboard, video only
139          m4a        audio only  low,   48k, m4a_dash container, mp4a.40.5@ 48k (22050Hz), 20.62MiB
249          webm       audio only  low,   50k, webm_dash container, opus @ 50k (48000Hz), 21.32MiB
250          webm       audio only  low,   67k, webm_dash container, opus @ 67k (48000Hz), 28.49MiB
140          m4a        audio only  medium,  129k, m4a_dash container, mp4a.40.2@129k (44100Hz), 54.72MiB
251          webm       audio only  medium,  134k, webm_dash container, opus @134k (48000Hz), 56.81MiB
17           3gp        176x144     144p,   72k, mp4v.20.3@  72k, 7fps, mp4a.40.2@  0k (22050Hz), 30.64MiB
160          mp4        256x144     144p,   64k, mp4_dash container, avc1.4d400c@  64k, 30fps, video only, 27.06MiB
278          webm       256x144     144p,   66k, webm_dash container, vp9@  66k, 30fps, video only, 28.20MiB
242          webm       426x240     240p,  113k, webm_dash container, vp9@ 113k, 30fps, video only, 48.17MiB
133          mp4        426x240     240p,  140k, mp4_dash container, avc1.4d4015@ 140k, 30fps, video only, 59.26MiB
243          webm       640x360     360p,  205k, webm_dash container, vp9@ 205k, 30fps, video only, 87.01MiB
134          mp4        640x360     360p,  265k, mp4_dash container, avc1.4d401e@ 265k, 30fps, video only, 112.29MiB
244          webm       854x480     480p,  364k, webm_dash container, vp9@ 364k, 30fps, video only, 153.95MiB
135          mp4        854x480     480p,  515k, mp4_dash container, avc1.4d401f@ 515k, 30fps, video only, 218.06MiB
247          webm       1280x720    720p,  859k, webm_dash container, vp9@ 859k, 30fps, video only, 363.41MiB
136          mp4        1280x720    720p, 1105k, mp4_dash container, avc1.64001f@1105k, 30fps, video only, 467.26MiB
18           mp4        640x360     360p,  365k, avc1.42001E@ 365k, 30fps, mp4a.40.2@  0k (44100Hz), 154.60MiB
22           mp4        1280x720    720p, 1234k, avc1.64001F@1234k, 30fps, mp4a.40.2@  0k (44100Hz), ~534.05MiB
simb24 commented 2 years ago

Thank you, unfortunately doesn't changed anything, by choosing "best" the video is same as was before, as well as do not affected to any other options chosen. By choosing "MP4" the video is only 720p. My targets is to be able choosing 1080 or less, AAC audio and h264 codec. A1 video and opus audio doesn't supported by my existed players. Any idea how I can achieve it?