picking a frame and an overlapping audio from a video
The inverse way of doing this is faster.

Get file duration

ffprobe in.mp4 -show_entries format=duration -of compact=p=0:nk=1 -v 0


This will print the duration in fractional seconds.

Pick a random value between (0, duration - 1)

Run

ffmpeg -ss value -t 1 -i in.mp4 -map 0:a -c:a copy audio.m4a -vf thumbnail -vframes 1 img.png


The thumbnail filter will pick one frame out of the 1 second of video provided to it.