Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Video2GeoEXIF
  4. # Converts a video into a serie of JPEG images with timestamp (must use JOSM)
  5. # Author: PanierAvide
  6.  
  7. echo "Video2GeoEXIF"
  8.  
  9. if [ $# == "2" ]; then
  10. if [ -r $1 ]; then
  11. # Video to images (r = fps, must be changed depending of your camera)
  12. ffmpeg -i $1 -r 1.265 img-%8d.jpg
  13.  
  14. # Create minimal EXIF
  15. jhead -mkexif *.jpg
  16.  
  17. # Convert date to UNIX timestamp
  18. date_unix=`date -u --date="$2" +%s`
  19. seconds=0
  20.  
  21. # Change images timestamp (1 image per second)
  22. for i in `ls *.jpg`; do
  23. time=$(($date_unix+$seconds))
  24. ts=`date -u --date="@$time" +"%Y:%m:%d-%T"` # timestamp -> date
  25. jhead -ts$ts $i # Add timestamp on the image
  26. seconds=$(($seconds+1))
  27. done
  28.  
  29. # Copy date from EXIF
  30. jhead -ft *.jpg
  31.  
  32. # Edit images in JOSM
  33. echo "Go to JOSM"
  34.  
  35. read key
  36.  
  37. # Set orientation to default value
  38. exiftool -Orientation=1 -overwrite_original -n *.jpg
  39. else
  40. echo "The video isn't readable"
  41. fi
  42. else
  43. echo "Usage: video2geoexif video.mp4 start_date"
  44. echo "Date format: YYYY-MM-DD HH:MM:SS"
  45. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement