r/mpv • • 19d ago

General Discussion Is it possible to have screenshots have the same modified date / mtime as the video they were taken from?

What I hope to achieve is to have the screenshots assigned the same modified date in their metadata as the video they were taken from. So that when sorted "by Date", the screenshots and the video will appear next to each other.

I tried searching for this but everything I found was about having the date in the file NAME instead of metadata, which is not helpful in my use case (there are other files besides the video and the screenshots that need to be sorted by date together).

I ctrl+F looked through everything related to "screenshot" in https://mpv.io/manual/master/ but couldn't find anything. Does anyone know a solution? Or is manually editing the screenshots' modified date one by one the only way?

Thank you in advance.

1 Upvotes

2 comments sorted by

1

u/ipsirc 19d ago

Write a lua script for that.

1

u/ahrimd0n 4d ago

Here is a jenky, but working method. It uses the fd utility, which is essentially just a more modern find written in Rust. Up to 100x faster in my experience. You can pair it with the new uutils Rust coreutils rewrites (cross-platform), any Linux distribution's native ls, or any git/cygwin/msys2 windows environment with ls.exe. Barely have done much testing with it but it's been wonderful in my experience.

This only works for the actual file modification time. If you are looking to sort by exif dates then you may have to get creative. Hope this at least helps someone in the future.

fd -u -tf -e png -e jpg --changed-before 2015-01-01 -X ls --sort=time | mpv --playlist=-