Difference between revisions of "Hacks"
From Jon's Wiki
(Created page with "== Image renaming by create date == When you have a bunch of files from your old Android phone with a timestamp filename (e.g. 1388042328550.jpg), you can rename them thus: ...") |
|||
Line 23: | Line 23: | ||
ffmpeg -i original.mp4 -acodec copy -vcodec libx264 -crf 20 -metadata:s:v:0 rotate=0 unrotated.mp4 | ffmpeg -i original.mp4 -acodec copy -vcodec libx264 -crf 20 -metadata:s:v:0 rotate=0 unrotated.mp4 | ||
+ | |||
+ | == Export your photos == | ||
+ | |||
+ | Before uploading your photos, remove all the EXIF tags, and reduce the resolution; nobody needs 5000x4000 pixels, much less corporations hoovering up your stuff to put in adverts. | ||
+ | |||
+ | mkdir tmp | ||
+ | for f in $.jpg; do | ||
+ | convert -resize 1600x1200 $f tmp/$f | ||
+ | exiftool -all= -P -overwrite_original tmp/$f | ||
+ | done |
Revision as of 03:11, 28 January 2017
Image renaming by create date
When you have a bunch of files from your old Android phone with a timestamp filename (e.g. 1388042328550.jpg), you can rename them thus:
for f in 1*.jpg; do mv $f $(date +IMG_%Y%m%d_%H%M%S.jpg -d @$(echo $f|cut -c 1-10)) done
Otherwise, we can fish out the Create Date from the EXIF data, using exiftool:
exiftool '-FileName<CreateDate' -d %Y%m%d_%H%M%S%%-c.%%e .
Repair broken or rotated phone videos
You can fix broken video .tmp files from your Android phone using untrunc. This will create a fixed.mp4 file in cwd:
untrunc working_video_from_the_same_camera.mp4 broken.mk4.tmp
Did your phone unhelpfully rotate your video? Fix the metadata:
ffmpeg -i original.mp4 -acodec copy -vcodec copy -metadata:s:v:0 rotate=0 unrotated.mp4
Or, did you actually film your shit the wrong way up? You'll need to re-encode it:
ffmpeg -i original.mp4 -acodec copy -vcodec libx264 -crf 20 -metadata:s:v:0 rotate=0 unrotated.mp4
Export your photos
Before uploading your photos, remove all the EXIF tags, and reduce the resolution; nobody needs 5000x4000 pixels, much less corporations hoovering up your stuff to put in adverts.
mkdir tmp for f in $.jpg; do convert -resize 1600x1200 $f tmp/$f exiftool -all= -P -overwrite_original tmp/$f done