Closed cedricve closed 6 years ago
Not all media stream formats are encoded sequentially. Some can't even be seeked without decoding the entire stream. Even if they are, you can only guess how many bytes you need to get N seconds of a stream.
Makes sense (I focus on MP4's). I'm just thinking about scalibility. FYI: I'll use your library to generate base64 thumbs of security videos (Kerberos.io project). It works great but I noticed that loading (downloading from S3 + in memory copy) takes a lot of time. Not sure if this can be optimised.
A workaround (but not sure about the performance) might be to download the file to filesystem, clip it with ffmpeg and load the new file in memory; I only need to first frame. Not sure if that makes sense.
MP4
Those aren't seekable, if you only have a part of the file.
clip it with ffmpeg
FFmpeg will load the file into memory either way.
Only way I can think of optimising this is, if you can control the source video format, using a streamable container like MKV or WEBM instead.
Thanks for the clarification @bakape. I'll look further.
Hey (again),
I was wondering if it would be possible to only load the first x bytes of a video in memory, instead of the whole file. When thumbnailing a large video it's very memory intensive., and might take some time.