Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Video2GeoEXIF
- # Converts a video into a serie of JPEG images with timestamp (must use JOSM)
- # Author: PanierAvide
- echo "Video2GeoEXIF"
- if [ $# == "2" ]; then
- if [ -r $1 ]; then
- # Video to images (r = fps, must be changed depending of your camera)
- ffmpeg -i $1 -r 1.265 img-%8d.jpg
- # Create minimal EXIF
- jhead -mkexif *.jpg
- # Convert date to UNIX timestamp
- date_unix=`date -u --date="$2" +%s`
- seconds=0
- # Change images timestamp (1 image per second)
- for i in `ls *.jpg`; do
- time=$(($date_unix+$seconds))
- ts=`date -u --date="@$time" +"%Y:%m:%d-%T"` # timestamp -> date
- jhead -ts$ts $i # Add timestamp on the image
- seconds=$(($seconds+1))
- done
- # Copy date from EXIF
- jhead -ft *.jpg
- # Edit images in JOSM
- echo "Go to JOSM"
- read key
- # Set orientation to default value
- exiftool -Orientation=1 -overwrite_original -n *.jpg
- else
- echo "The video isn't readable"
- fi
- else
- echo "Usage: video2geoexif video.mp4 start_date"
- echo "Date format: YYYY-MM-DD HH:MM:SS"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement