If I have a .opus file, how can I use FFmpeg to set the album art?

This ffmpeg command can be used:

ffmpeg -i in.opus -i metadata.dat -map_metadata 1 -codec copy out.opus

where metadata.dat is a text file composed as:

;FFMETADATA1
METADATA_BLOCK_PICTURE=<img_blob64>

where <img_blob64> is a base64 encoding of some info about the image and the image itself. Unfortunately, forming this encoded blob is a bit complicated. For more info on doing so, including some helper scripts, see Embed album art in OGG through command line in linux