]>
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
)
17 '-y', '-i', url
, '-f', 'mp4', '-c', 'copy',
18 '-bsf:a', 'aac_adtstoasc',
19 encodeFilename(tmpfilename
, for_subprocess
=True)]
21 for program
in ['avconv', 'ffmpeg']:
23 subprocess
.call([program
, '-version'], stdout
=(open(os
.path
.devnull
, 'w')), stderr
=subprocess
.STDOUT
)
25 except (OSError, IOError):
28 self
.report_error(u
'm3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
29 cmd
= [program
] + args
31 retval
= subprocess
.call(cmd
)
33 fsize
= os
.path
.getsize(encodeFilename(tmpfilename
))
34 self
.to_screen(u
'\r[%s] %s bytes' % (cmd
[0], fsize
))
35 self
.try_rename(tmpfilename
, filename
)
37 'downloaded_bytes': fsize
,
45 self
.report_error(u
'ffmpeg exited with code %d' % retval
)