I'm currently trying to decode some video files with ffmpeg
on my computer but am not able to make ffmpeg
copy the tags from the source file to the destination file. I read through the man page but there seems to be no way to extract the file tags from the source file or am I missing something?
I was able to extract the information via mdls
but this isn't getting me anywhere. Also, I found about xattr
and tried to apply extended attributes this way but the option -x
seems to be removed and applying the attribute without that option doesn't work either.
Best Answer
I needed this too—also after running FFmpeg!—so I wrote a shell script to do it. It’s not very quick, and it won’t work if any individual attribute contains more than about 128 KB of data. (Behind the scenes, it’s encoding each attribute value in hexadecimal to make sure that binary data is copied correctly.) It worked fine for my needs, though.
Save this to a file called
copy_xattrs
:Then run
chmod u+x copy_xattrs
to make it executable. Now you can runcopy_xattrs source target
to copy all of the extended attributes from the filesource
to the filetarget
.