Score:3

Store the output of ffprobe into a string

io flag

I know that normally you can do something like var=echo "hello world" | grep hello and var will be equal to "hello world" However when I'm trying to do "var=ffprobe file.mp3 | grep artist" to store the song's artist into var as a string, it doesn't work. Any thoughts?

Cagri avatar
cn flag
you're doing `var=$(command)` right? if so, iirc ffprobe outputs in stderr so you have to add `2>&1` at the end of ffprobe command
cn flag
`var=echo "hello world" | grep hello` doesn't set `var` to the output of the command. It sets `var` to the word `echo`, then tries to execute `"hello world"` as a command. You're missing the `$()` or backticks around the command whose output should be substituted.
Score:3
ph flag

Seems ffprobe, writing to stderr(comment has this mentioned already) But if you want only artist, you have to use 'w' flag as well.

> $ ffprobe "Adigo Alladigo.mp3" 2>&1 | grep artist
    artist          : SP.Balu
    album_artist    : 
> $ ffprobe "Adigo Alladigo - SenSongsMp3.Co.mp3" 2>&1 | grep -w artist
    artist          : SP.Balu

Hope it helps.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.