mpv_thumbnail_script
mpv_thumbnail_script copied to clipboard
When used with ffmpeg leverage vaapi for much faster generation
I've been experimenting with hw accelerated ffmpeg thumbnailer via changing ffmpeg command to:
local ffmpeg_command = {
"ffmpeg",
"-loglevel", "quiet",
"-noaccurate_seek",
"-hwaccel", "vaapi",
"-hwaccel_device", "/dev/dri/renderD128",
"-hwaccel_output_format", "vaapi",
"-ss", format_time(timestamp, ":"),
"-i", file_path,
"-frames:v", "1",
"-an",
"-vf", ("scale_vaapi=%d:%d,scale_vaapi=format=rgb32,hwdownload,format=rgb32"):format(size.w, size.h),
"-c:v", "rawvideo",
"-pix_fmt", "bgra",
"-f", "rawvideo",
"-y", output_path
}```
And it is much much faster. could it be used when ffmpeg is picked?
I tested these same configurations but didn't worked properly without modifications. Here's my config if anyone with similar specs want to try: CPU: 3th Gen Intel Ivybridge, GPU: Intel Ivybridge (Gen 7) Integrated Graphics
local ffmpeg_command = {
"ffmpeg",
--"-loglevel", "quiet",
"-noaccurate_seek",
"-ss", format_time(timestamp, ":"),
"-hwaccel_output_format","vaapi",
"-hwaccel_device","/dev/dri/renderD128",
"-hwaccel", "vaapi",
"-i", file_path,
"-frames:v", "1",
"-an",
"-vf", ("scale_vaapi=%d:%d,scale_vaapi=format=rgb32,hwdownload,format=nv12"):format(size.w, size.h),
"-c:v", "rawvideo",
"-pix_fmt", "bgra",
"-f", "rawvideo",
"-y", output_path
}
Works like a charm.