I am unable to get ffmpeg to add artwork to aif file. Also, only Title and Comment fields are mapped/preserved (on my version). All others lost or not mapped.
Issue is with the aif format as target output.
Feature/Bug reported.
Confirmed no problem adding artwork, mp3 -> mp3, and preserving all tags (except comment !!!).
My command:
ffmpeg \
-i "${fullpathfile}" \
-i "${startDIR}/${fileroot}.png" \
-map 0:a \
-map 1:0 \
-c:0 copy \
-c:1 copy \
-id3v2_version 4 \
"${libraryDIR}/${fileroot}.${sufOut}"
My environment:
Ubuntu MATE 20.04
Linux 5.4.0-135-generic
#152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022
ffmpeg version 4.2.7-0ubuntu0.1
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
My test script:
#!/bin/bash
doTransform()
{
cd "${libraryDIR}" ;
skip_start=0
time_end=unknown
while read line
do
#sufIn=mp3
sufIn=`echo "${line}" | awk '{ n=split( $0, val, "." ) ; print val[n] ; }' `
fileroot=`basename "${line}" ".${sufIn}" `
rm -f "${libraryDIR}/${fileroot}.${sufOut}"
ffprobe -hide_banner "${line}"
echo -e "\n sufIn = ${sufIn} ..."
echo " Hit return to continue ..." >&2
read k <&2
case "${sufOut}" in
"${sufIn}" )
#codec="-codec copy" ;;
codec="-c:0 copy -c:1 copy" ;;
* )
case "${SufIn}" in
mp3 )
#codec="-codec copy" ;;
codec="-c:0 copy -c:1 copy" ;;
* )
# Issues with AIC/AIF format and codec specificaiton
codec="-c:0 copy -c:1 copy" ;;
esac
::
esac
#-to ${time_end} \
#-b:a 192k \
#-i "${fullpathfile}" \
ffmpeg \
-i "${line}" \
-i "${startDIR}/${fileroot}.png" \
-map 0:a \
-map 1:0 \
${codec} \
-ss ${skip_start} \
-id3v2_version 4 \
"${libraryDIR}/${fileroot}.${sufOut}"
### MP3 -> MP3 : metadata is preseved (except comment) for
### MP3 -> MP3 : only Title and Comment preserved, all others lost
### Try these again after upgrade to 22.04
# -metadata title="Album cover" \
# -metadata comment="Cover (front)" \
# -metadata:s:a:0 title="Album cover" \
# -metadata:s:a:0 comment="Cover (front)" \
done
}
startDIR=`pwd`
sourceDIR=${startDIR}/FFMPEG_Test
libraryDIR=${startDIR}/Output
sufOut=mp3
sufOut=aif
#-ipath "${libraryDIR}" \
#\( -ipath "${libraryDIR}" \) \
find "${sourceDIR}" \
-type f \( -name "*.wav" -o -name "*.aac" -o -name "*.m4a" -o -name "*.mp3" \) \
-print |
grep -v '/Output' |
doTransform
ffmpeg
command . Yourfind
command looks reasonable, but I would try adding the/full/path/to/new/aifStorage
prepended to'{}.aif'
at the end. Good luck.