]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/downloader/hls.py
4 from .common
import FileDownloader
10 class HlsFD(FileDownloader
):
11 def real_download(self
, filename
, info_dict
):
12 url
= info_dict
['url']
13 self
.report_destination(filename
)
14 tmpfilename
= self
.temp_name(filename
)
16 args
= ['-y', '-i', url
, '-f', 'mp4', '-c', 'copy',
17 '-bsf:a', 'aac_adtstoasc', tmpfilename
]
19 for program
in ['avconv', 'ffmpeg']:
21 subprocess
.call([program
, '-version'], stdout
=(open(os
.path
.devnull
, 'w')), stderr
=subprocess
.STDOUT
)
23 except (OSError, IOError):
26 self
.report_error(u
'm3u8 download detected but ffmpeg or avconv could not be found')
27 cmd
= [program
] + args
29 retval
= subprocess
.call(cmd
)
31 fsize
= os
.path
.getsize(encodeFilename(tmpfilename
))
32 self
.to_screen(u
'\r[%s] %s bytes' % (cmd
[0], fsize
))
33 self
.try_rename(tmpfilename
, filename
)
35 'downloaded_bytes': fsize
,
43 self
.report_error(u
'ffmpeg exited with code %d' % retval
)