The Google Pixel 2 and probably other phones since have the capability to cover \"Motion Photos\". These are saved as MVIMG and comparatively big.
I’m looking for a way
I did find https://github.com/cliveontoast/GoMoPho which scans for the mp4 header and then dumps the video.
We can do the same, scanning for ftypmp4
from the MP4 header (actual file starts 4 bytes earlier):
Thus to extract videos:
for i in MVIMG*.jpg; do \
ofs=$(grep -F --byte-offset --only-matching --text ftypmp4 "$i"); \
ofs=${ofs%:*}; \
[[ $ofs ]] && dd "if=$i" "of=${i%.jpg}.mp4" bs=$((ofs-4)) skip=1; \
done
And to remove videos:
for i in MVIMG*.jpg; do \
ofs=$(grep -F --byte-offset --only-matching --text ftypmp4 "$i"); \
ofs=${ofs%:*}; \
[[ $ofs ]] && truncate -s $((ofs-4)) "$i"; \
done