So I am using FFmpeg to download an m3u8 stream. For optimization, I tried running the FFmpeg directly instead of using youtube-dl with it. But for some reason, the ffmpeg.exe uses 140 MB of memory while ffmpeg.exe via youtube-dl uses only 14 MB of memory.
So I have two questions:
- Is there a way to minimize the direction FFmpeg memory usage
- Add a timer (custom command) to FFmpeg via youtube-dl. FFmpeg has a build-in command -t (seconds). Is there a way to use it via youtube-dl?
FFmpeg directly (140MB in memory):
import os
os.system('cmd /k "ffmpeg -i https://36-d4.divas.cloud/CHAN-3792/CHAN-3792_1.stream/playlist.m3u8 -t 100 output.mp4"')
FFmpeg using youtube-dl (14MB in memory):
import youtube_dl
ydl_opts = {
'nopart': True,
'outtmpl': 'output.mp4',
'nocheckcertificate': True
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://36-d4.divas.cloud/CHAN-3792/CHAN-3792_1.stream/playlist.m3u8'])
Edit:
I double checked and both the exe FFmpeg for the direct and youtube-dl are both the same version.