Skip to content

Instantly share code, notes, and snippets.

@RedRoosterKey
Last active November 23, 2017 21:08
Show Gist options
  • Select an option

  • Save RedRoosterKey/bc7b2cdc641857835b3a8b52c9e83a13 to your computer and use it in GitHub Desktop.

Select an option

Save RedRoosterKey/bc7b2cdc641857835b3a8b52c9e83a13 to your computer and use it in GitHub Desktop.
Convert SD card contents into a format that can be imported into apple devices
#! /bin/bash
set -e
# set -v
# Copy and convert files to an Apple import friendly format and directory structure
# simply provide the script with the directory where you have mounted the SD card
# ./apple_convert.sh /media/user/SD_CARD
src=${1}
dest=${src}/DCIM/000___00
gcp -rv "${src}/PHOTO/*" "${dest}"
find "${src}/VIDEO/*" | sort | while read line
do
echo "${line}"
base=$(basename --suffix=.avi "${line}")
echo "${base}"
# set +e
ffmpeg -nostdin -i "${src}/VIDEO/${line}" -qscale 0 -s 1280x720 -strict -2 "${dest}/${base}.mov" < /dev/null
echo ffmpeg exits with $?
# set -e
echo Done with "${line}"
sleep 1
done
echo Done with all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment