rg3/youtube-dl — pull request #2971 by rzhxeo (2014-05-23 03:33:40+00:00)
Title: Add support for merged videos to formats

I've added the new optional field "sub_formats" to formats. It's an array which contains the format used for video and the format used for audio.
The function ```_sort_formats``` in ```extractor/common.py``` assigns merged formats a preference of -1000 if ffmpeg/avconv is not available.
I've also added the function ```_add_merged_formats``` to ```extractor/common.py``` which automatically generates merged formats and makes it very easy for IEs to support merged formats. (E.g. in YoutubeIE: 68c925b)
The source files of merged videos get deleted after merging. (3ab9e41)
I've moved the function ```select_format``` from ```YoutubeDL.py``` to ```utils.py``` that's the biggest change in terms of lines (+40-40).
```
$ youtube-dl-git -F "http://www.youtube.com/watch?v=QAUzWtLMnU0"
...
[info] Available formats for QAUzWtLMnU0:
format code extension resolution note
171 webm audio only DASH audio , audio@ 48k (worst)
140 m4a audio only DASH audio , audio@128k
160 mp4 144p DASH video , video only
242 webm 240p DASH video , video only
133 mp4 240p DASH video , video only
243 webm 360p DASH video , video only
134 mp4 360p DASH video , video only
244 webm 480p DASH video , video only
135 mp4 480p DASH video , video only
247 webm 720p DASH video , video only
136 mp4 720p DASH video , video only
248 webm 1080p DASH video , video only
137 mp4 1080p DASH video , video only
160+140 mp4 144p audio@128k
17 3gp 176x144
242+171 webm 240p audio@ 48k
133+140 mp4 240p audio@128k
36 3gp 320x240
5 flv 400x240
243+171 webm 360p audio@ 48k
134+140 mp4 360p audio@128k
43 webm 640x360
18 mp4 640x360
244+171 webm 480p audio@ 48k
135+140 mp4 480p audio@128k
247+171 webm 720p audio@ 48k
136+140 mp4 720p audio@128k
22 mp4 1280x720
248+171 webm 1080p audio@ 48k
137+140 mp4 1080p audio@128k (best)
```