In the interest of standardizing my video library I'm trying to find a way to quickly create a list of files that need to be converted. After looking at this question and its answer (and much googling) I think I have the basics figured out, but I'm having trouble elaborating on the jq section. For reference, the jq command I'm starting with is as follows:
jq -c '.format.filename as $path |
.streams[]? |
select(.codec_type=="video" and .codec_name!="h264") |
.codec_name as $vcodec |
{video: $vcodec, path: $path}'
and, for simplicity's sake, let's say this is what's being fed to jq:
{
"streams": [
{
"index": 0,
"codec_name": "hevc",
"codec_type": "video"
},
{
"index": 1,
"codec_name": "aac",
"codec_type": "audio"
}
],
"format": {
"filename": "Video.mkv"
}
}
which produces the following output:
{"video":"hevc","path":"./Video.mkv"}
This is great, but I want to go one step further - I would also like to include the codec used for any audio streams. So, given the same input, I would like the following output:
{"video":"hevc","audio":"aac","path":"./Video.mkv"}
How do I accomplish this?