[FFmpeg-user] How do I prevent this FFmpeg from removing the Exif metadata?

James Ralston ralston at pobox.com
Thu Dec 14 21:51:06 EET 2023


On Thu, Dec 14, 2023 at 7:07 AM Dave F via ffmpeg-user
<ffmpeg-user at ffmpeg.org> wrote:

> I wish to use ffmpeg.
>
> I've tried ImageMagick with various command combinations.  None come
> anywhere as near as that ffmpeg command in terms of clarity & file
> size reduction.

The file size reduction is based on the JPEG encoding options you
choose: the compression quality (more compression = smaller file but
worse quality), whether the Huffman tables are optimized, whether a
progressive or non-progressive JPEG is written, et. al.

So just because the ffmpeg defaults align with your preferences
doesn’t mean that you can’t achieve the same size/quality with a
different tool.

> Unless someone can categorically say 'ffmpeg can't do that' I'd like
> to search for an answer in thif ffmpeg forum.

If you want to use ffmpeg, another option would be to use ffmpeg to
perform the resize, but then use a different tool to copy the EXIF
metadata.  E.g.:

$ ffmpeg -i Input.JPG -vf scale="iw*.5:-1" -update true Output.jpg
$ touch -r Input.JPG Output.jpg
$ exiftool -args -G1 --filename --directory Input.JPG |
  exiftool -P -@ - -sep ', ' Output.jpg

In English, the exiftool command pipe dumps the metadata from
Input.JPG and then writes the resulting metadata to Output.jpg.


More information about the ffmpeg-user mailing list