Skip to content

Instantly share code, notes, and snippets.

@SMUsamaShah
Last active June 20, 2024 12:33
Show Gist options
  • Save SMUsamaShah/341a9b3e79bf7aa05788c89029a7ff2a to your computer and use it in GitHub Desktop.
Save SMUsamaShah/341a9b3e79bf7aa05788c89029a7ff2a to your computer and use it in GitHub Desktop.
Reduce size of Google Pixel (Android phone) videos (from Google Photos) while preserving metadata
  1. Plug your phone with usb
  2. copy large videos
  3. use the given batch script (requires ffmpeg.exe and exiftool.exe). Can simply drag drop a video on the .bat file to start conversion.
  4. copy the out file back to phone
  5. delete original large file from phone using Google photos

NOTE: the ffmpeg command uses Intel GPU acceleration using -c:v hevc_qsv. Change it if you want/need. for Nvidia GPU, use -c:v hevc_nvenc

@echo on
SET input=%~1
SET filename=%~n1
SET ext=%~x1
SET output=%filename%_conv%ext%
ffmpeg -i %input% -c:v hevc_qsv -crf 23 -preset fast -c:a copy -movflags use_metadata_tags -map_metadata 0 %output%
echo Conversion done
echo copying metadata
exiftool -v0 -overwrite_original -ee -sep * -a -TagsFromFile %input% -All:All -FileCreateDate -FileModifyDate %output%
echo Done. Will close in 5 seconds
timeout /t 5 /nobreak >nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment