#!/usr/bin/bash # Find the path of the mp3 file mp3_path=$(ssh max@192.168.1.193 cmus-remote -Q | grep file | sed "s/file //" | tr " " "\\ ") echo $mp3_path # Extract the jpg of it ssh max@192.168.1.193 ffmpeg -i '$mp3_path' -an -c:v copy file.jpg