This is exactly what the restore_cached_data plugin does – it extracts metadata from directly uploaded files on assignment.
If you want to extract metadata in the background, you can use the refresh_metadata plugin (which restore_cached_data plugin uses internally) to extract metadata explicitly.
Shrine.plugin :refresh_metadata
You can then call UploadedFile#refresh_metadata! in the processing block for background promotion.
process(:store) do |io, context|
io.refresh_metadata!(context)
# processing
{ original: io, **versions }
end