IPB

Welcome Guest ( Log In | Register )

How to extract cover album art from mpc?, on Linux terminal
klonuo
post Feb 26 2012, 10:30
Post #1





Group: Members
Posts: 258
Joined: 29-April 10
Member No.: 80274



If using foobar, data is added at the end of the file enclosed in APE tag.

How to extract this from terminal? mpcdec doesn't have much options
Go to the top of the page
+Quote Post
 
Start new topic
Replies
klonuo
post Feb 26 2012, 12:17
Post #2





Group: Members
Posts: 258
Joined: 29-April 10
Member No.: 80274



Here is brute force extractor for JPG files and size to 1MB (just in case):

CODE
x=`xxd -g0 "$1" | grep -im1 FFD8FFE0  | awk -F: '{print $1}'`
if [ -n "$x" ]; then
    y=`xxd -g0 "$1" | grep -im1 4150455441474558d0 | awk -F: '{print $1}'`
    if [ $((0x$y)) -gt $((0x$x)) ] && [ 1000000 -gt $((0x$y-0x$x)) ]; then
        dd ibs=1 count=$((0x$y-0x$x+2)) skip=$((0x$x+1)) if="$1" of=${1%.*}.jpg
    fi
fi


It expects mpc (or any other file with JPG inside) as argument
It's rather fragile, as can fail if searched signatures are wrapped by `xxd`, but it's better than no solution

This post has been edited by klonuo: Feb 26 2012, 12:19
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st October 2014 - 15:52