1

I tried searching everywhere for a possible solution but I really can't find it. Hope someone can help me out here.

I have written a batch file to use FFMPEG to compress and sharpen JPGs in a folder.

  FOR %%a in (*.jpg) DO (ffmpeg -i "%%a" -q:v 8 -vf unsharp=5:5:1.0:5:5:0.0 "2022 01 22 %%~na".jpg)
PAUSE

The new file comes out smaller in size, but is missing all the EXIF information that the original photo has.

I tried to add in the command "-metadata" but apparently it works for MP4 only. I have an existing solution with imageMagick but I'm hoping to solve this via FFMPEG. or is there a way to integrate exiftool into the batch file?

Thank you and I really appreciate any help here.

4
  • You can copy EXIF data forward from one file to another with exiftool... Jan 27, 2022 at 7:37
  • 1
    Am I correct in assuming that the new images have the same name with a prefix of "2022 01 22" and are in the same directory? If so, after running your above command, you could run this exiftool command to copy all the data. exiftool -overwrite_Original -TagsFromFile "%d2022 01 22 %F" -All:All /path/to/files/ You do not want to run exiftool in your loop, as exiftool's biggest performance hit is the start up time. See Exiftool Common Mistake #3
    – StarGeek
    Jan 27, 2022 at 15:08
  • @StarGeek and Mark, thank you for your replies. say if, time is not a big issue, can you help me check how i should tweak my batch file code to make it work? @ECHO ON FOR %%a in (*.jpg) DO (ffmpeg -i "%%a" -q:v 8 -vf unsharp=5:5:1.0:5:5:0.0 "2022 01 22 %%~na".jpg exiftool -overwrite_Original -TagsFromFile "%%f.pef" -All:All ) PAUSE Jan 27, 2022 at 16:08
  • Please click edit under your question and add your code in there where it can be formatted and read more easily... comments are not ideal for code. Thanks. Jan 27, 2022 at 16:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.